MCPcopy Create free account
hub / github.com/python/cpython / test_truncated_large_frame

Method test_truncated_large_frame

Lib/test/pickletester.py:1169–1180  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1167 (pickle.UnpicklingError, 'LONG pickle has negative byte count'))
1168
1169 def test_truncated_large_frame(self):
1170 data = lambda size: b'\x95' + struct.pack('<Q', size) + b'N.'
1171 # 0: \x95 FRAME 2
1172 # 9: N NONE
1173 # 10: . STOP
1174 self.assertIsNone(self.loads(data(2))) # self-testing
1175 for size in itersize(1 << 10, sys.maxsize - 9):
1176 self._test_truncated_data(data(size))
1177 if sys.maxsize + 1 < 1 << 64:
1178 self._test_truncated_data(data(sys.maxsize + 1),
1179 ((OverflowError, ValueError),
1180 'FRAME length exceeds|frame size > sys.maxsize'))
1181
1182 def test_truncated_large_binunicode8(self):
1183 data = lambda size: b'\x8d' + struct.pack('<Q', size) + b'.' * 5

Callers

nothing calls this directly

Calls 5

loadsMethod · 0.95
_test_truncated_dataMethod · 0.95
itersizeFunction · 0.85
assertIsNoneMethod · 0.80
packMethod · 0.45

Tested by

no test coverage detected