summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-11-13 10:27:38 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-11-13 10:27:38 (GMT)
commitfec6620dfb9b7e99b68c07b623235f87f5fd1a60 (patch)
tree36c6d0c627256a1dd1efb9d866e232271336d77b /Lib/test/test_fractions.py
parent24854cac996ebe2f534cbe58b141fe51fd2d8d0e (diff)
downloadcpython-fec6620dfb9b7e99b68c07b623235f87f5fd1a60.zip
cpython-fec6620dfb9b7e99b68c07b623235f87f5fd1a60.tar.gz
cpython-fec6620dfb9b7e99b68c07b623235f87f5fd1a60.tar.bz2
Make Fraction(-1).__hash__() return -2 rather than -1 (see issue 10356).
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index a41fd9c..c28f06c 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -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