Skip to content
Snippets Groups Projects
Commit 7bab32ef authored by Damien George's avatar Damien George
Browse files

tests: Add further tests for class defining __hash__.

parent c50772d1
No related branches found
No related tags found
No related merge requests found
...@@ -42,3 +42,15 @@ try: ...@@ -42,3 +42,15 @@ try:
hash(D()) hash(D())
except TypeError: except TypeError:
print("TypeError") print("TypeError")
# __hash__ returning a bool should be converted to an int
class E:
def __hash__(self):
return True
print(hash(E()))
# __hash__ returning a large number should be truncated
class F:
def __hash__(self):
return 1 << 70 | 1
print(hash(F()) != 0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment