]> granicus.if.org Git - python/commitdiff
ValueError in this case is also acceptable
authorBenjamin Peterson <benjamin@python.org>
Wed, 7 Jul 2010 22:45:06 +0000 (22:45 +0000)
committerBenjamin Peterson <benjamin@python.org>
Wed, 7 Jul 2010 22:45:06 +0000 (22:45 +0000)
Lib/test/test_struct.py

index 3168a7b5560921ad43db738758b521730a5084cf..ecf38ba28b06f5a9fbc469f588d74adce30d3fea 100644 (file)
@@ -438,8 +438,10 @@ class StructTest(unittest.TestCase):
 
         # 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 @@ class StructTest(unittest.TestCase):
 
         # 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