summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-05-20 18:43:07 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-05-20 18:43:07 (GMT)
commita4e0efa4b13e9a51faad19be27b18ed02c9a26f0 (patch)
tree6dd18a300d5e9ac8fdb18fc7a9015d69324f2a1c /Lib
parentac2380b58a1bde1b38916c85032bc1647f119346 (diff)
downloadcpython-a4e0efa4b13e9a51faad19be27b18ed02c9a26f0.zip
cpython-a4e0efa4b13e9a51faad19be27b18ed02c9a26f0.tar.gz
cpython-a4e0efa4b13e9a51faad19be27b18ed02c9a26f0.tar.bz2
Issue #5829: don't raise OverflowError for complex('1e500'). Backport of r72803.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_complex.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index 56e9083..60c5252 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -431,6 +431,13 @@ class ComplexTest(unittest.TestCase):
@unittest.skipUnless(float.__getformat__("double").startswith("IEEE"),
"test requires IEEE 754 doubles")
+ def test_overflow(self):
+ self.assertEqual(complex("1e500"), complex(INF, 0.0))
+ self.assertEqual(complex("-1e500j"), complex(0.0, -INF))
+ self.assertEqual(complex("-1e500+1.8e308j"), complex(-INF, INF))
+
+ @unittest.skipUnless(float.__getformat__("double").startswith("IEEE"),
+ "test requires IEEE 754 doubles")
def test_repr_roundtrip(self):
vals = [0.0, 1e-500, 1e-315, 1e-200, 0.0123, 3.1415, 1e50, INF, NAN]
vals += [-v for v in vals]