summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strtod.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-01-16 18:10:25 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-01-16 18:10:25 (GMT)
commit45b6365974b6611c3dc1c2e48c55d36ca0e500d9 (patch)
tree99efe4dbc813f8381d58498b33161f1f683da55c /Lib/test/test_strtod.py
parent747e8b3f589d2f951088cd9c27cdf6097440b878 (diff)
downloadcpython-45b6365974b6611c3dc1c2e48c55d36ca0e500d9.zip
cpython-45b6365974b6611c3dc1c2e48c55d36ca0e500d9.tar.gz
cpython-45b6365974b6611c3dc1c2e48c55d36ca0e500d9.tar.bz2
Merged revisions 77519,77530,77533 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77519 | mark.dickinson | 2010-01-16 10:44:00 +0000 (Sat, 16 Jan 2010) | 5 lines Issue #7632: Fix a serious wrong output bug for string -> float conversion. Also remove some now unused variables, and add comments clarifying the possible outputs of the parsing section of _Py_dg_strtod. Thanks Eric Smith for reviewing. ........ r77530 | mark.dickinson | 2010-01-16 17:57:49 +0000 (Sat, 16 Jan 2010) | 3 lines Issue #7632: Fix one more case of incorrect rounding for str -> float conversion (see bug 5 in the issue tracker). ........ r77533 | mark.dickinson | 2010-01-16 18:06:17 +0000 (Sat, 16 Jan 2010) | 1 line Fix multiple uses of variable 'L' in _Py_dg_strtod, where one use requires an unsigned long and the other a signed long. See also r77421. ........
Diffstat (limited to 'Lib/test/test_strtod.py')
-rw-r--r--Lib/test/test_strtod.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_strtod.py b/Lib/test/test_strtod.py
index 79cfc88..b5a630e 100644
--- a/Lib/test/test_strtod.py
+++ b/Lib/test/test_strtod.py
@@ -123,10 +123,6 @@ class StrtodTests(unittest.TestCase):
digits = m * 5**-e
exponent = e
s = '{}e{}'.format(digits, exponent)
-
- # for the moment, ignore errors from trailing zeros
- if digits % 10 == 0:
- continue
self.check_strtod(s)
# get expected answer via struct, to triple check
@@ -175,7 +171,8 @@ class StrtodTests(unittest.TestCase):
self.check_strtod(s)
def test_parsing(self):
- digits = tuple(map(str, range(10)))
+ # make '0' more likely to be chosen than other digits
+ digits = '000000123456789'
signs = ('+', '-', '')
# put together random short valid strings
@@ -257,7 +254,9 @@ class StrtodTests(unittest.TestCase):
'247032822920623295e-341',
# issue 7632 bug 5: the following 2 strings convert differently
'1000000000000000000000000000000000000000e-16',
- #'10000000000000000000000000000000000000000e-17',
+ '10000000000000000000000000000000000000000e-17',
+ # issue 7632 bug 8: the following produced 10.0
+ '10.900000000000000012345678912345678912345',
]
for s in test_strings:
self.check_strtod(s)