diff --git a/tests/basics/builtin_hash.py b/tests/basics/builtin_hash.py index b6b2ad15cb77c1274f321d4604a51593124a7064..76fb18304413d4e84ce1e2b61a2417f8d62f6e6b 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)