MCPcopy Index your code
hub / github.com/python/cpython / test_truncated_large_long4

Method test_truncated_large_long4

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

Source from the content-addressed store, hash-verified

1157 self._test_truncated_data(data(size))
1158
1159 def test_truncated_large_long4(self):
1160 data = lambda size: b'\x8b' + struct.pack('<I', size) + b'.' * 5
1161 # 0: \x8b LONG4 0x2e2e2e2e
1162 # 9: . STOP
1163 self.assertEqual(self.loads(data(4)), 0x2e2e2e2e) # self-testing
1164 for size in itersize(1 << 10, min(sys.maxsize - 5, (1 << 31) - 1)):
1165 self._test_truncated_data(data(size))
1166 self._test_truncated_data(data(1 << 31),
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.'

Callers

nothing calls this directly

Calls 5

loadsMethod · 0.95
_test_truncated_dataMethod · 0.95
itersizeFunction · 0.85
packMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected