]> granicus.if.org Git - python/commitdiff
Yield more information on failure in test_struct boolean test.
authorMark Dickinson <dickinsm@gmail.com>
Mon, 12 Jul 2010 20:03:24 +0000 (20:03 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Mon, 12 Jul 2010 20:03:24 +0000 (20:03 +0000)
Lib/test/test_struct.py

index d3840cc9962c6cdd9271dcce6867a6ec0aa01183..b923f45f2bfeaab3cfe6181a341738c4f59d8472 100644 (file)
@@ -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])