mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Make Fraction(-1).__hash__() return -2 rather than -1 (see issue 10356).
This commit is contained in:
parent
24854cac99
commit
fec6620dfb
3 changed files with 9 additions and 6 deletions
|
|
@ -546,6 +546,9 @@ class FractionTest(unittest.TestCase):
|
|||
self.assertEquals(hash(2.5), hash(F(5, 2)))
|
||||
self.assertEquals(hash(10**50), hash(F(10**50)))
|
||||
self.assertNotEquals(hash(float(10**23)), hash(F(10**23)))
|
||||
# Check that __hash__ produces the same value as hash(), for
|
||||
# consistency with int and Decimal. (See issue #10356.)
|
||||
self.assertEquals(hash(F(-1)), F(-1).__hash__())
|
||||
|
||||
def testApproximatePi(self):
|
||||
# Algorithm borrowed from
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue