Skip to content

Commit c0da9c4

Browse files
Fix typo in test dir name + update examples
1 parent 958fddb commit c0da9c4

File tree

5 files changed

+3
-3
lines changed

5 files changed

+3
-3
lines changed

python/ql/src/Functions/examples/IncorrectRaiseInSpecialMethod.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ def __init__(self, a):
55
def __add__(self, other):
66
# BAD: Should return NotImplemented instead of raising
77
if not isinstance(other,A):
8-
raise TypeError(f"Cannot add A to {other.__type__}")
8+
raise TypeError(f"Cannot add A to {other.__class__}")
99
return A(self.a + other.a)
1010

1111
class B:
1212
def __init__(self, a):
1313
self.a = a
1414

1515
def __add__(self, other):
16-
# GOOD: Returning NotImplemented allows for other classes to support adding do B.
16+
# GOOD: Returning NotImplemented allows for the operation to fallback to other implementations to allow other classes to support adding to B.
1717
if not isinstance(other,B):
1818
return NotImplemented
1919
return B(self.a + other.a)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class D:
22
def __hash__(self):
33
# BAD: Use `__hash__ = None` instead.
4-
raise NotImplementedError(f"{self.__type__} is unhashable.")
4+
raise NotImplementedError(f"{self.__class__} is unhashable.")

0 commit comments

Comments
 (0)