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

Method test_copy

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

Source from the content-addressed store, hash-verified

682 self.assertNotEqual(list(d), list(e))
683
684 def test_copy(self):
685 mut = [10]
686 d = deque([mut])
687 e = copy.copy(d)
688 self.assertEqual(list(d), list(e))
689 mut[0] = 11
690 self.assertNotEqual(id(d), id(e))
691 self.assertEqual(list(d), list(e))
692
693 for i in range(5):
694 for maxlen in range(-1, 6):
695 s = [random.random() for j in range(i)]
696 d = deque(s) if maxlen == -1 else deque(s, maxlen)
697 e = d.copy()
698 self.assertEqual(d, e)
699 self.assertEqual(d.maxlen, e.maxlen)
700 self.assertTrue(all(x is y for x, y in zip(d, e)))
701
702 def test_copy_method(self):
703 mut = [10]

Callers

nothing calls this directly

Calls 7

listClass · 0.85
idFunction · 0.85
assertNotEqualMethod · 0.80
assertTrueMethod · 0.80
copyMethod · 0.45
assertEqualMethod · 0.45
randomMethod · 0.45

Tested by

no test coverage detected