]> granicus.if.org Git - python/commitdiff
Fix float.fromhex test to give additional information on failure. This
authorMark Dickinson <dickinsm@gmail.com>
Thu, 21 Aug 2008 20:02:24 +0000 (20:02 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Thu, 21 Aug 2008 20:02:24 +0000 (20:02 +0000)
change is aimed at diagnosing issue 3633 (test_float fails on Solaris).

Reviewed by Benjamin Peterson

Lib/test/test_float.py

index 3f4998d4a4a3b1da1a9da3c55e0c9bba25baaa66..ab791a3a34c664dafc62081bfef4bcf74bf98183 100644 (file)
@@ -417,7 +417,13 @@ class HexFloatTestCase(unittest.TestCase):
             '0x1p0\0 0x1p0',  # embedded null byte is not end of string
             ]
         for x in invalid_inputs:
-            self.assertRaises(ValueError, fromHex, x)
+            try:
+                result = fromHex(x)
+            except ValueError:
+                pass
+            else:
+                self.fail('Expected float.fromhex(%r) to raise ValueError; '
+                          'got %r instead' % (x, result))
 
 
     def test_from_hex(self):