From: Mark Dickinson Date: Thu, 21 Aug 2008 20:02:24 +0000 (+0000) Subject: Fix float.fromhex test to give additional information on failure. This X-Git-Tag: v2.6rc1~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=892429b08b0ee2d252e3624951a7b9b38423f074;p=python Fix float.fromhex test to give additional information on failure. This change is aimed at diagnosing issue 3633 (test_float fails on Solaris). Reviewed by Benjamin Peterson --- diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 3f4998d4a4..ab791a3a34 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -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):