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
This commit is contained in:
Mark Dickinson 2008-08-21 20:02:24 +00:00
parent 6a0b559d26
commit 892429b08b
1 changed files with 7 additions and 1 deletions

View File

@ -417,7 +417,13 @@ class HexFloatTestCase(unittest.TestCase):
'0x1p0\0 0x1p0', # embedded null byte is not end of string '0x1p0\0 0x1p0', # embedded null byte is not end of string
] ]
for x in invalid_inputs: 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): def test_from_hex(self):