]> granicus.if.org Git - python/commitdiff
Sort out some confusion in test_float.py: the two
authorMark Dickinson <dickinsm@gmail.com>
Fri, 17 Apr 2009 20:59:58 +0000 (20:59 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 17 Apr 2009 20:59:58 +0000 (20:59 +0000)
separate FormatTestCase classes have been combined,
and test_short_repr has been moved from FormatTestCase
to the existing ReprTestCase.

Lib/test/test_float.py

index 8c250e8e6db09228025b92d6fbe2e41614907207..24202be7f62ebce145a3bfcc2c181bc3af371e85 100644 (file)
@@ -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):