diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-01-24 16:40:29 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-01-24 16:40:29 (GMT) |
commit | a3ecd2c6689d8376dfda38e4bbd03a43a69a968a (patch) | |
tree | 65e7ed578360ccb54a0c149252851a89eef67f24 /Lib/test/pickletester.py | |
parent | c187d11af3407ea424d1debf8a37775ea7cdf95f (diff) | |
download | cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.zip cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.tar.gz cpython-a3ecd2c6689d8376dfda38e4bbd03a43a69a968a.tar.bz2 |
Issue #1672332: Fix unpickling of subnormal floats, which was raising
ValueError on some platforms as a result of the platform strtod setting
errno on underflow.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r-- | Lib/test/pickletester.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index bd0a3a4..e34d55b 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -535,6 +535,16 @@ class AbstractPickleTests(unittest.TestCase): got = self.loads(p) self.assertEqual(n, got) + def test_float(self): + test_values = [0.0, 4.94e-324, 1e-310, 7e-308, 6.626e-34, 0.1, 0.5, + 3.14, 263.44582062374053, 6.022e23, 1e30] + test_values = test_values + [-x for x in test_values] + for proto in protocols: + for value in test_values: + pickle = self.dumps(value, proto) + got = self.loads(pickle) + self.assertEqual(value, got) + @run_with_locale('LC_ALL', 'de_DE', 'fr_FR') def test_float_format(self): # make sure that floats are formatted locale independent |