mirror of
https://github.com/python/cpython.git
synced 2024-11-25 10:54:51 +08:00
ValueError in this case is also acceptable
This commit is contained in:
parent
ccabcd4bd4
commit
6ef08a0ebe
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user