diff options
-rw-r--r-- | tests/basics/builtin_hash.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/builtin_hash.py b/tests/basics/builtin_hash.py index b6b2ad15cb..76fb183044 100644 --- a/tests/basics/builtin_hash.py +++ b/tests/basics/builtin_hash.py @@ -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) |