tests: Add further tests for class defining __hash__.
This commit is contained in:
parent
c50772d19f
commit
7bab32ef89
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue