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

Method test_copy_pickle

Lib/test/test_deque.py:819–841  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

817 self.assertEqual(len(d), 0)
818
819 def test_copy_pickle(self):
820 for cls in Deque, DequeWithSlots:
821 for d in cls('abc'), cls('abcde', maxlen=4):
822 d.x = ['x']
823 d.z = ['z']
824
825 e = d.__copy__()
826 self.assertEqual(type(d), type(e))
827 self.assertEqual(list(d), list(e))
828
829 e = cls(d)
830 self.assertEqual(type(d), type(e))
831 self.assertEqual(list(d), list(e))
832
833 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
834 s = pickle.dumps(d, proto)
835 e = pickle.loads(s)
836 self.assertNotEqual(id(d), id(e))
837 self.assertEqual(type(d), type(e))
838 self.assertEqual(list(d), list(e))
839 self.assertEqual(e.x, d.x)
840 self.assertEqual(e.z, d.z)
841 self.assertNotHasAttr(e, 'y')
842
843 def test_pickle_recursive(self):
844 for proto in range(pickle.HIGHEST_PROTOCOL + 1):

Callers

nothing calls this directly

Calls 9

listClass · 0.85
idFunction · 0.85
assertNotEqualMethod · 0.80
assertNotHasAttrMethod · 0.80
clsClass · 0.50
__copy__Method · 0.45
assertEqualMethod · 0.45
dumpsMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected