summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-12 20:03:24 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-12 20:03:24 (GMT)
commit94628eeb58b1ba95e967c0d338f57edbe71ee265 (patch)
treed486ebb64038f31568c29f629056b6a13d1a4fe4 /Lib/test/test_struct.py
parentc779515a75fc083d355aef5121ed78f0b0a58588 (diff)
downloadcpython-94628eeb58b1ba95e967c0d338f57edbe71ee265.zip
cpython-94628eeb58b1ba95e967c0d338f57edbe71ee265.tar.gz
cpython-94628eeb58b1ba95e967c0d338f57edbe71ee265.tar.bz2
Yield more information on failure in test_struct boolean test.
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index d3840cc..b923f45 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -512,8 +512,13 @@ class StructTest(unittest.TestCase):
self.assertFalse(prefix, msg='encoded bool is not one byte: %r'
%packed)
- self.assertRaises(IOError, struct.pack, prefix + '?',
- ExplodingBool())
+ try:
+ 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']:
self.assertTrue(struct.unpack('>?', c)[0])