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

Method test_int_pickling_efficiency

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

Source from the content-addressed store, hash-verified

3811 self.assertEqual(loaded, data)
3812
3813 def test_int_pickling_efficiency(self):
3814 # Test compacity of int representation (see issue #12744)
3815 if self.py_version < (3, 3):
3816 self.skipTest('not supported in Python < 3.3')
3817 for proto in protocols:
3818 with self.subTest(proto=proto):
3819 pickles = [self.dumps(2**n, proto) for n in range(70)]
3820 sizes = list(map(len, pickles))
3821 # the size function is monotonic
3822 self.assertEqual(sorted(sizes), sizes)
3823 if proto >= 2:
3824 for p in pickles:
3825 self.assertFalse(opcode_in_pickle(pickle.LONG, p))
3826
3827 def _check_pickling_with_opcode(self, obj, opcode, proto):
3828 pickled = self.dumps(obj, proto)

Callers

nothing calls this directly

Calls 7

listClass · 0.85
opcode_in_pickleFunction · 0.85
skipTestMethod · 0.80
assertFalseMethod · 0.80
subTestMethod · 0.45
dumpsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected