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

Method test_copy_registry

Lib/test/test_copy.py:42–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40 self.assertEqual(y.foo, x.foo)
41
42 def test_copy_registry(self):
43 class C(object):
44 def __new__(cls, foo):
45 obj = object.__new__(cls)
46 obj.foo = foo
47 return obj
48 def pickle_C(obj):
49 return (C, (obj.foo,))
50 x = C(42)
51 self.assertRaises(TypeError, copy.copy, x)
52 copyreg.pickle(C, pickle_C, C)
53 y = copy.copy(x)
54 self.assertIsNot(x, y)
55 self.assertEqual(type(y), C)
56 self.assertEqual(y.foo, x.foo)
57
58 def test_copy_reduce_ex(self):
59 class C(object):

Callers

nothing calls this directly

Calls 5

assertIsNotMethod · 0.80
CClass · 0.70
assertRaisesMethod · 0.45
copyMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected