]> granicus.if.org Git - python/commitdiff
Skip test_strtod entirely when correctly-rounded string->float isn't implemented
authorMark Dickinson <dickinsm@gmail.com>
Sun, 7 Feb 2010 20:31:10 +0000 (20:31 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sun, 7 Feb 2010 20:31:10 +0000 (20:31 +0000)
Lib/test/test_strtod.py

index c7562669a0161532efdca56e0126fc8543ccdf82..0e67e8dcb6ccdfb8474df3d6fe6fbaadd1dfd41d 100644 (file)
@@ -8,6 +8,10 @@ import re
 import sys
 from test import test_support
 
+if getattr(sys, 'float_repr_style', '') != 'short':
+    raise unittest.SkipTest('correctly-rounded string->float conversions '
+                            'not available on this system')
+
 # Correctly rounded str -> float in pure Python, for comparison.
 
 strtod_parser = re.compile(r"""    # A numeric string consists of:
@@ -78,8 +82,6 @@ def strtod(s, mant_dig=53, min_exp = -1021, max_exp = 1024):
 
 TEST_SIZE = 16
 
-@unittest.skipUnless(getattr(sys, 'float_repr_style', '') == 'short',
-                     "applies only when using short float repr style")
 class StrtodTests(unittest.TestCase):
     def check_strtod(self, s):
         """Compare the result of Python's builtin correctly rounded