]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Check that 'd' isn't allowed as an exponent specifier in inputs to the float function.
authorMark Dickinson <dickinsm@gmail.com>
Fri, 12 Feb 2010 21:16:38 +0000 (21:16 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 12 Feb 2010 21:16:38 +0000 (21:16 +0000)
Lib/test/test_float.py

index b043c4d25214843fa5e36695ec49bf7ff7956179..b0f353b1f79f9cfe6655fb21cdd33b70241d1fec 100644 (file)
@@ -104,6 +104,9 @@ class GeneralFloatCases(unittest.TestCase):
         self.assertRaises(ValueError, float, "+-3.14")
         self.assertRaises(ValueError, float, "-+3.14")
         self.assertRaises(ValueError, float, "--3.14")
+        # check that we don't accept alternate exponent markers
+        self.assertRaises(ValueError, float, "-1.7d29")
+        self.assertRaises(ValueError, float, "3D-14")
         if test_support.have_unicode:
             self.assertEqual(float(unicode("  3.14  ")), 3.14)
             self.assertEqual(float(unicode("  \u0663.\u0661\u0664  ",'raw-unicode-escape')), 3.14)