From 94628eeb58b1ba95e967c0d338f57edbe71ee265 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Mon, 12 Jul 2010 20:03:24 +0000 Subject: [PATCH] Yield more information on failure in test_struct boolean test. --- Lib/test/test_struct.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index d3840cc996..b923f45f2b 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]) -- 2.50.1