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

Method test_copying

Lib/test/test_weakset.py:457–479  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

455 self.assertIsInstance(self.s, MutableSet)
456
457 def test_copying(self):
458 for cls in WeakSet, WeakSetWithSlots:
459 s = cls(self.items)
460 s.x = ['x']
461 s.z = ['z']
462
463 dup = copy.copy(s)
464 self.assertIsInstance(dup, cls)
465 self.assertEqual(dup, s)
466 self.assertIsNot(dup, s)
467 self.assertIs(dup.x, s.x)
468 self.assertIs(dup.z, s.z)
469 self.assertNotHasAttr(dup, 'y')
470
471 dup = copy.deepcopy(s)
472 self.assertIsInstance(dup, cls)
473 self.assertEqual(dup, s)
474 self.assertIsNot(dup, s)
475 self.assertEqual(dup.x, s.x)
476 self.assertIsNot(dup.x, s.x)
477 self.assertEqual(dup.z, s.z)
478 self.assertIsNot(dup.z, s.z)
479 self.assertNotHasAttr(dup, 'y')
480
481
482if __name__ == "__main__":

Callers

nothing calls this directly

Calls 7

assertIsInstanceMethod · 0.80
assertIsNotMethod · 0.80
assertNotHasAttrMethod · 0.80
clsClass · 0.50
copyMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected