MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_boundary_error_message

Method test_boundary_error_message

Lib/test/test_struct.py:612–627  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

610 self.check_sizeof('0c', 0)
611
612 def test_boundary_error_message(self):
613 regex1 = (
614 r'pack_into requires a buffer of at least 6 '
615 r'bytes for packing 1 bytes at offset 5 '
616 r'\(actual buffer size is 1\)'
617 )
618 with self.assertRaisesRegex(struct.error, regex1):
619 struct.pack_into('b', bytearray(1), 5, 1)
620
621 regex2 = (
622 r'unpack_from requires a buffer of at least 6 '
623 r'bytes for unpacking 1 bytes at offset 5 '
624 r'\(actual buffer size is 1\)'
625 )
626 with self.assertRaisesRegex(struct.error, regex2):
627 struct.unpack_from('b', bytearray(1), 5)
628
629 def test_boundary_error_message_with_negative_offset(self):
630 byte_list = bytearray(10)

Callers

nothing calls this directly

Calls 3

assertRaisesRegexMethod · 0.80
unpack_fromMethod · 0.80
pack_intoMethod · 0.45

Tested by

no test coverage detected