File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1693,5 +1693,21 @@ class MyInt(int):
16931693 # GH-117195 -- This shouldn't crash
16941694 object .__sizeof__ (1 )
16951695
1696+ def test_hash (self ):
1697+ # gh-136599
1698+ self .assertEqual (hash (- 1 ), - 2 )
1699+ self .assertEqual (hash (0 ), 0 )
1700+ self .assertEqual (hash (10 ), 10 )
1701+
1702+ self .assertEqual (hash (sys .hash_info .modulus - 2 ), sys .hash_info .modulus - 2 )
1703+ self .assertEqual (hash (sys .hash_info .modulus - 1 ), sys .hash_info .modulus - 1 )
1704+ self .assertEqual (hash (sys .hash_info .modulus ), 0 )
1705+ self .assertEqual (hash (sys .hash_info .modulus + 1 ), 1 )
1706+
1707+ self .assertEqual (hash (- sys .hash_info .modulus - 2 ), - 2 )
1708+ self .assertEqual (hash (- sys .hash_info .modulus - 1 ), - 2 )
1709+ self .assertEqual (hash (- sys .hash_info .modulus ), 0 )
1710+ self .assertEqual (hash (- sys .hash_info .modulus + 1 ), - sys .hash_info .modulus + 1 )
1711+
16961712if __name__ == "__main__" :
16971713 unittest .main ()
You can’t perform that action at this time.
0 commit comments