summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2008-08-21 20:02:24 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2008-08-21 20:02:24 (GMT)
commit892429b08b0ee2d252e3624951a7b9b38423f074 (patch)
treee5aef55d08c43acb37203bf45e22fd8f71477a11 /Lib/test
parent6a0b559d267e179c67eb1b3dc663ee0805bebe6e (diff)
downloadcpython-892429b08b0ee2d252e3624951a7b9b38423f074.zip
cpython-892429b08b0ee2d252e3624951a7b9b38423f074.tar.gz
cpython-892429b08b0ee2d252e3624951a7b9b38423f074.tar.bz2
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
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_float.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 3f4998d..ab791a3 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):