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 @@ -1642,5 +1642,21 @@ class MyInt(int):
1642
1642
# GH-117195 -- This shouldn't crash
1643
1643
object .__sizeof__ (1 )
1644
1644
1645
+ def test_hash (self ):
1646
+ # gh-136599
1647
+ self .assertEqual (hash (- 1 ), - 2 )
1648
+ self .assertEqual (hash (0 ), 0 )
1649
+ self .assertEqual (hash (10 ), 10 )
1650
+
1651
+ self .assertEqual (hash (sys .hash_info .modulus - 2 ), sys .hash_info .modulus - 2 )
1652
+ self .assertEqual (hash (sys .hash_info .modulus - 1 ), sys .hash_info .modulus - 1 )
1653
+ self .assertEqual (hash (sys .hash_info .modulus ), 0 )
1654
+ self .assertEqual (hash (sys .hash_info .modulus + 1 ), 1 )
1655
+
1656
+ self .assertEqual (hash (- sys .hash_info .modulus - 2 ), - 2 )
1657
+ self .assertEqual (hash (- sys .hash_info .modulus - 1 ), - 2 )
1658
+ self .assertEqual (hash (- sys .hash_info .modulus ), 0 )
1659
+ self .assertEqual (hash (- sys .hash_info .modulus + 1 ), - sys .hash_info .modulus + 1 )
1660
+
1645
1661
if __name__ == "__main__" :
1646
1662
unittest .main ()
You can’t perform that action at this time.
0 commit comments