[Python-checkins] r71691 - python/branches/py3k/Lib/test/test_float.py

mark.dickinson python-checkins at python.org
Fri Apr 17 22:59:58 CEST 2009


Author: mark.dickinson
Date: Fri Apr 17 22:59:58 2009
New Revision: 71691

Log:
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.


Modified:
   python/branches/py3k/Lib/test/test_float.py

Modified: python/branches/py3k/Lib/test/test_float.py
==============================================================================
--- python/branches/py3k/Lib/test/test_float.py	(original)
+++ python/branches/py3k/Lib/test/test_float.py	Fri Apr 17 22:59:58 2009
@@ -313,19 +313,6 @@
                 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 @@
             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 @@
             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):


More information about the Python-checkins mailing list