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

Method test___copy__

Lib/test/test_xml_etree.py:2628–2650  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2626 self.assertNotEqual(element_foo.attrib, attrib)
2627
2628 def test___copy__(self):
2629 element_foo = ET.Element("foo", { "zix": "wyp" })
2630 element_foo.append(ET.Element("bar", { "baz": "qix" }))
2631
2632 element_foo2 = copy.copy(element_foo)
2633
2634 # elements are not the same
2635 self.assertIsNot(element_foo2, element_foo)
2636
2637 # string attributes are equal
2638 self.assertEqual(element_foo2.tag, element_foo.tag)
2639 self.assertEqual(element_foo2.text, element_foo.text)
2640 self.assertEqual(element_foo2.tail, element_foo.tail)
2641
2642 # number of children is the same
2643 self.assertEqual(len(element_foo2), len(element_foo))
2644
2645 # children are the same
2646 for (child1, child2) in itertools.zip_longest(element_foo, element_foo2):
2647 self.assertIs(child1, child2)
2648
2649 # attrib is a copy
2650 self.assertEqual(element_foo2.attrib, element_foo.attrib)
2651
2652 def test___deepcopy__(self):
2653 element_foo = ET.Element("foo", { "zix": "wyp" })

Callers

nothing calls this directly

Calls 5

appendMethod · 0.95
assertIsNotMethod · 0.80
copyMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected