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

Method test_list_chunking

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

Source from the content-addressed store, hash-verified

3553 self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness
3554
3555 def test_list_chunking(self):
3556 n = 10 # too small to chunk
3557 x = list(range(n))
3558 for proto in protocols:
3559 s = self.dumps(x, proto)
3560 y = self.loads(s)
3561 self.assert_is_copy(x, y)
3562 num_appends = count_opcode(pickle.APPENDS, s)
3563 self.assertEqual(num_appends, proto > 0)
3564
3565 n = 2500 # expect at least two chunks when proto > 0
3566 x = list(range(n))
3567 for proto in protocols:
3568 s = self.dumps(x, proto)
3569 y = self.loads(s)
3570 self.assert_is_copy(x, y)
3571 num_appends = count_opcode(pickle.APPENDS, s)
3572 if proto == 0:
3573 self.assertEqual(num_appends, 0)
3574 else:
3575 self.assertTrue(num_appends >= 2)
3576
3577 def test_dict_chunking(self):
3578 n = 10 # too small to chunk

Callers

nothing calls this directly

Calls 7

listClass · 0.85
count_opcodeFunction · 0.85
assert_is_copyMethod · 0.80
assertTrueMethod · 0.80
dumpsMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected