Yield more information on failure in test_struct boolean test.
This commit is contained in:
parent
c779515a75
commit
94628eeb58
|
@ -512,8 +512,13 @@ class StructTest(unittest.TestCase):
|
||||||
self.assertFalse(prefix, msg='encoded bool is not one byte: %r'
|
self.assertFalse(prefix, msg='encoded bool is not one byte: %r'
|
||||||
%packed)
|
%packed)
|
||||||
|
|
||||||
self.assertRaises(IOError, struct.pack, prefix + '?',
|
try:
|
||||||
ExplodingBool())
|
struct.pack(prefix + '?', ExplodingBool())
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.fail("Expected IOError: struct.pack(%r, "
|
||||||
|
"ExplodingBool())" % (prefix + '?'))
|
||||||
|
|
||||||
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
|
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
|
||||||
self.assertTrue(struct.unpack('>?', c)[0])
|
self.assertTrue(struct.unpack('>?', c)[0])
|
||||||
|
|
Loading…
Reference in New Issue