tests: Add further tests for class defining __hash__.

This commit is contained in:
Damien George 2015-05-12 23:08:18 +01:00
parent c50772d19f
commit 7bab32ef89
1 changed files with 12 additions and 0 deletions

View File

@ -42,3 +42,15 @@ try:
hash(D())
except 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)