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

Method test_huge_str_64b

Lib/test/pickletester.py:4224–4248  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

4222
4223 @bigmemtest(size=_4G, memuse=8, dry_run=False)
4224 def test_huge_str_64b(self, size):
4225 data = "abcd" * (size // 4)
4226 try:
4227 for proto in protocols:
4228 if proto == 0:
4229 continue
4230 with self.subTest(proto=proto):
4231 if proto < 4:
4232 with self.assertRaises((ValueError, OverflowError)):
4233 self.dumps(data, protocol=proto)
4234 continue
4235 try:
4236 pickled = self.dumps(data, protocol=proto)
4237 header = (pickle.BINUNICODE8 +
4238 struct.pack("<Q", len(data)))
4239 data_start = pickled.index(b'abcd')
4240 self.assertEqual(
4241 header,
4242 pickled[data_start-len(header):data_start])
4243 self.assertEqual((pickled.rindex(b"abcd") + len(b"abcd") -
4244 pickled.index(b"abcd")), len(data))
4245 finally:
4246 pickled = None
4247 finally:
4248 data = None
4249
4250
4251# Test classes for reduce_ex

Callers

nothing calls this directly

Calls 8

lenFunction · 0.85
subTestMethod · 0.80
assertRaisesMethod · 0.45
dumpsMethod · 0.45
packMethod · 0.45
indexMethod · 0.45
assertEqualMethod · 0.45
rindexMethod · 0.45

Tested by

no test coverage detected