MCPcopy Index your code
hub / github.com/RustPython/RustPython / test___copy__

Method test___copy__

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

Source from the content-addressed store, hash-verified

2591 self.assertNotEqual(element_foo.attrib, attrib)
2592
2593 def test___copy__(self):
2594 element_foo = ET.Element("foo", { "zix": "wyp" })
2595 element_foo.append(ET.Element("bar", { "baz": "qix" }))
2596
2597 element_foo2 = copy.copy(element_foo)
2598
2599 # elements are not the same
2600 self.assertIsNot(element_foo2, element_foo)
2601
2602 # string attributes are equal
2603 self.assertEqual(element_foo2.tag, element_foo.tag)
2604 self.assertEqual(element_foo2.text, element_foo.text)
2605 self.assertEqual(element_foo2.tail, element_foo.tail)
2606
2607 # number of children is the same
2608 self.assertEqual(len(element_foo2), len(element_foo))
2609
2610 # children are the same
2611 for (child1, child2) in itertools.zip_longest(element_foo, element_foo2):
2612 self.assertIs(child1, child2)
2613
2614 # attrib is a copy
2615 self.assertEqual(element_foo2.attrib, element_foo.attrib)
2616
2617 def test___deepcopy__(self):
2618 element_foo = ET.Element("foo", { "zix": "wyp" })

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected