summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2014-04-05 08:29:00 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2014-04-05 08:29:00 (GMT)
commit3c286e2e0d2aa17b5a90d671280a95ba5cd6521c (patch)
tree9e2d14f065f88831490e1673a1ac3ac0ca032bd5 /Lib/test/test_fractions.py
parent2a32200838be1359fa489869b366bf33db19da5c (diff)
downloadcpython-3c286e2e0d2aa17b5a90d671280a95ba5cd6521c.zip
cpython-3c286e2e0d2aa17b5a90d671280a95ba5cd6521c.tar.gz
cpython-3c286e2e0d2aa17b5a90d671280a95ba5cd6521c.tar.bz2
Issue #21136: Avoid unnecessary normalization in Fractions resulting from power and other operations.
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 3336532..e86d5ce 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -330,7 +330,6 @@ class FractionTest(unittest.TestCase):
self.assertTypedEquals(F(-2, 10), round(F(-15, 100), 1))
self.assertTypedEquals(F(-2, 10), round(F(-25, 100), 1))
-
def testArithmetic(self):
self.assertEqual(F(1, 2), F(1, 10) + F(2, 5))
self.assertEqual(F(-3, 10), F(1, 10) - F(2, 5))
@@ -402,6 +401,8 @@ class FractionTest(unittest.TestCase):
self.assertTypedEquals(2.0 , 4 ** F(1, 2))
self.assertTypedEquals(0.25, 2.0 ** F(-2, 1))
self.assertTypedEquals(1.0 + 0j, (1.0 + 0j) ** F(1, 10))
+ self.assertRaises(ZeroDivisionError, operator.pow,
+ F(0, 1), -2)
def testMixingWithDecimal(self):
# Decimal refuses mixed arithmetic (but not mixed comparisons)