summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-05-20 22:05:25 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-05-20 22:05:25 (GMT)
commitbd16edd305ba8067615e703a2cfeeb33907f40b8 (patch)
tree6c167711c3e67a713c0bfc27eeef1e530816bdd9 /Lib
parent4db6ff683d1b1d6e6c6bef875a88c9121c68137d (diff)
downloadcpython-bd16edd305ba8067615e703a2cfeeb33907f40b8.zip
cpython-bd16edd305ba8067615e703a2cfeeb33907f40b8.tar.gz
cpython-bd16edd305ba8067615e703a2cfeeb33907f40b8.tar.bz2
Refactor to remove duplicated nan/inf parsing code in
pystrtod.c, floatobject.c and dtoa.c.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_float.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index b4b62f0..e74e892 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -532,6 +532,11 @@ class InfNanTest(unittest.TestCase):
self.assertRaises(ValueError, float, "-INFI")
self.assertRaises(ValueError, float, "infinitys")
+ self.assertRaises(ValueError, float, "++Inf")
+ self.assertRaises(ValueError, float, "-+inf")
+ self.assertRaises(ValueError, float, "+-infinity")
+ self.assertRaises(ValueError, float, "--Infinity")
+
def test_inf_as_str(self):
self.assertEqual(repr(1e300 * 1e300), "inf")
self.assertEqual(repr(-1e300 * 1e300), "-inf")
@@ -563,6 +568,11 @@ class InfNanTest(unittest.TestCase):
self.assertRaises(ValueError, float, "+na")
self.assertRaises(ValueError, float, "-na")
+ self.assertRaises(ValueError, float, "++nan")
+ self.assertRaises(ValueError, float, "-+NAN")
+ self.assertRaises(ValueError, float, "+-NaN")
+ self.assertRaises(ValueError, float, "--nAn")
+
def test_nan_as_str(self):
self.assertEqual(repr(1e300 * 1e300 * 0), "nan")
self.assertEqual(repr(-1e300 * 1e300 * 0), "nan")