diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-07 10:44:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-07 10:44:33 (GMT) |
commit | 667abc7d42e87b87338981276d0eac9895d4abf4 (patch) | |
tree | e4084d5fc93b35d277de58ef09dfa40b69c90be0 /Lib | |
parent | 3410af45f8d2b8479e9a9db29f4631799820ec21 (diff) | |
download | cpython-667abc7d42e87b87338981276d0eac9895d4abf4.zip cpython-667abc7d42e87b87338981276d0eac9895d4abf4.tar.gz cpython-667abc7d42e87b87338981276d0eac9895d4abf4.tar.bz2 |
Issue #21881: Be more tolerant in test_tcl to not parsable by float() NaN
representations (on mips and m68k platforms).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_tcl.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index a4e13ab..cb86a73 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -406,8 +406,9 @@ class TclTest(unittest.TestCase): self.assertEqual(passValue(float('inf')), float('inf')) self.assertEqual(passValue(-float('inf')), -float('inf')) else: - f = float(passValue(float('nan'))) - self.assertNotEqual(f, f) + f = passValue(float('nan')) + self.assertIsInstance(f, str) + self.assertEqual(f.lower()[:3], 'nan') self.assertEqual(float(passValue(float('inf'))), float('inf')) self.assertEqual(float(passValue(-float('inf'))), -float('inf')) self.assertEqual(passValue((1, '2', (3.4,))), @@ -431,9 +432,8 @@ class TclTest(unittest.TestCase): expected = float(expected) self.assertAlmostEqual(float(actual), expected, delta=abs(expected) * 1e-10) - def nan_eq(actual, expected): - actual = float(actual) - self.assertNotEqual(actual, actual) + def starts_with(actual, expected): + self.assertEqual(actual.lower()[:len(expected)], expected) check(True, '1') check(False, '0') @@ -456,7 +456,7 @@ class TclTest(unittest.TestCase): check(f, f, eq=float_eq) check(float('inf'), 'Inf', eq=float_eq) check(-float('inf'), '-Inf', eq=float_eq) - check(float('nan'), 'NaN', eq=nan_eq) + check(float('nan'), 'nan', eq=starts_with) check((), '') check((1, (2,), (3, 4), '5 6', ()), '1 2 {3 4} {5 6} {}') |