diff Lib/test/test_struct.py @ 62854:382dcb0c6073

ValueError in this case is also acceptable
author Benjamin Peterson <benjamin@python.org>
date Wed, 07 Jul 2010 22:45:06 +0000
parents f6266c459156
children 43a0fc184a58
line wrap: on
line diff
--- a/Lib/test/test_struct.py	Wed Jul 07 20:54:01 2010 +0000
+++ b/Lib/test/test_struct.py	Wed Jul 07 22:45:06 2010 +0000
@@ -438,8 +438,10 @@
 
         # Go beyond boundaries.
         small_buf = array.array('b', b' '*10)
-        self.assertRaises(struct.error, s.pack_into, small_buf, 0, test_string)
-        self.assertRaises(struct.error, s.pack_into, small_buf, 2, test_string)
+        self.assertRaises((ValueError, struct.error), s.pack_into, small_buf, 0,
+                          test_string)
+        self.assertRaises((ValueError, struct.error), s.pack_into, small_buf, 2,
+                          test_string)
 
         # Test bogus offset (issue 3694)
         sb = small_buf
@@ -463,8 +465,10 @@
 
         # Go beyond boundaries.
         small_buf = array.array('b', b' '*10)
-        self.assertRaises(struct.error, pack_into, small_buf, 0, test_string)
-        self.assertRaises(struct.error, pack_into, small_buf, 2, test_string)
+        self.assertRaises((ValueError, struct.error), pack_into, small_buf, 0,
+                          test_string)
+        self.assertRaises((ValueError, struct.error), pack_into, small_buf, 2,
+                          test_string)
 
     def test_unpack_with_buffer(self):
         # SF bug 1563759: struct.unpack doens't support buffer protocol objects