diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-04-17 20:59:58 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-04-17 20:59:58 (GMT) |
commit | 7efad9ec5a7d60630c9e9378467ed81b14efd57f (patch) | |
tree | d8b0bf242c790a31380a06a3345f8d3d8f688d43 | |
parent | 1a6b73dcdf1c45d3c77959ae8a2e9ea38ebe57b2 (diff) | |
download | cpython-7efad9ec5a7d60630c9e9378467ed81b14efd57f.zip cpython-7efad9ec5a7d60630c9e9378467ed81b14efd57f.tar.gz cpython-7efad9ec5a7d60630c9e9378467ed81b14efd57f.tar.bz2 |
Sort out some confusion in test_float.py: the two
separate FormatTestCase classes have been combined,
and test_short_repr has been moved from FormatTestCase
to the existing ReprTestCase.
-rw-r--r-- | Lib/test/test_float.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 8c250e8..24202be 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -313,19 +313,6 @@ class FormatTestCase(unittest.TestCase): self.assertRaises(ValueError, format, 1e-100, format_spec) self.assertRaises(ValueError, format, -1e-100, format_spec) -class ReprTestCase(unittest.TestCase): - def test_repr(self): - floats_file = open(os.path.join(os.path.split(__file__)[0], - 'floating_points.txt')) - for line in floats_file: - line = line.strip() - if not line or line.startswith('#'): - continue - v = eval(line) - self.assertEqual(v, eval(repr(v))) - floats_file.close() - -class FormatTestCase(unittest.TestCase): @unittest.skipUnless(float.__getformat__("double").startswith("IEEE"), "test requires IEEE 754 doubles") def test_format_testfile(self): @@ -341,6 +328,18 @@ class FormatTestCase(unittest.TestCase): self.assertEqual(fmt % float(arg), rhs) self.assertEqual(fmt % -float(arg), '-' + rhs) +class ReprTestCase(unittest.TestCase): + def test_repr(self): + floats_file = open(os.path.join(os.path.split(__file__)[0], + 'floating_points.txt')) + for line in floats_file: + line = line.strip() + if not line or line.startswith('#'): + continue + v = eval(line) + self.assertEqual(v, eval(repr(v))) + floats_file.close() + @unittest.skipUnless(getattr(sys, 'float_repr_style', '') == 'short', "applies only when using short float repr style") def test_short_repr(self): @@ -390,8 +389,6 @@ class FormatTestCase(unittest.TestCase): self.assertEqual(s, repr(float(s))) self.assertEqual(negs, repr(float(negs))) - - # Beginning with Python 2.6 float has cross platform compatible # ways to create and represent inf and nan class InfNanTest(unittest.TestCase): |