From: Benjamin Peterson Date: Wed, 7 Jul 2010 22:45:06 +0000 (+0000) Subject: ValueError in this case is also acceptable X-Git-Tag: v3.2a1~276 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ef08a0ebe156adbb0d2091b9e2418215740dedd;p=thirdparty%2FPython%2Fcpython.git ValueError in this case is also acceptable --- diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 3168a7b55609..ecf38ba28b06 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -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