diff Lib/test/test_struct.py @ 62991:60fdf147032c

Yield more information on failure in test_struct boolean test.
author Mark Dickinson <dickinsm@gmail.com>
date Mon, 12 Jul 2010 20:03:24 +0000
parents 5e60c7db0f51
children f214ad09c384
line wrap: on
line diff
--- a/Lib/test/test_struct.py	Mon Jul 12 20:01:52 2010 +0000
+++ b/Lib/test/test_struct.py	Mon Jul 12 20:03:24 2010 +0000
@@ -512,8 +512,13 @@
                 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])