diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-07-07 22:45:06 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-07-07 22:45:06 (GMT) |
commit | 6ef08a0ebe156adbb0d2091b9e2418215740dedd (patch) | |
tree | 880f3e3999dfcc58ab177cbb0158f2979c18c81e /Lib/test/test_struct.py | |
parent | ccabcd4bd441416c276a4755a601fd3fc290e32a (diff) | |
download | cpython-6ef08a0ebe156adbb0d2091b9e2418215740dedd.zip cpython-6ef08a0ebe156adbb0d2091b9e2418215740dedd.tar.gz cpython-6ef08a0ebe156adbb0d2091b9e2418215740dedd.tar.bz2 |
ValueError in this case is also acceptable
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r-- | Lib/test/test_struct.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 3168a7b..ecf38ba 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 |