(self)
| 2650 | self.assertEqual(element_foo2.attrib, element_foo.attrib) |
| 2651 | |
| 2652 | def test___deepcopy__(self): |
| 2653 | element_foo = ET.Element("foo", { "zix": "wyp" }) |
| 2654 | element_foo.append(ET.Element("bar", { "baz": "qix" })) |
| 2655 | |
| 2656 | element_foo2 = copy.deepcopy(element_foo) |
| 2657 | |
| 2658 | # elements are not the same |
| 2659 | self.assertIsNot(element_foo2, element_foo) |
| 2660 | |
| 2661 | # string attributes are equal |
| 2662 | self.assertEqual(element_foo2.tag, element_foo.tag) |
| 2663 | self.assertEqual(element_foo2.text, element_foo.text) |
| 2664 | self.assertEqual(element_foo2.tail, element_foo.tail) |
| 2665 | |
| 2666 | # number of children is the same |
| 2667 | self.assertEqual(len(element_foo2), len(element_foo)) |
| 2668 | |
| 2669 | # children are not the same |
| 2670 | for (child1, child2) in itertools.zip_longest(element_foo, element_foo2): |
| 2671 | self.assertIsNot(child1, child2) |
| 2672 | |
| 2673 | # attrib is a copy |
| 2674 | self.assertIsNot(element_foo2.attrib, element_foo.attrib) |
| 2675 | self.assertEqual(element_foo2.attrib, element_foo.attrib) |
| 2676 | |
| 2677 | # attrib isn't linked |
| 2678 | element_foo.attrib["bar"] = "baz" |
| 2679 | self.assertIsNot(element_foo2.attrib, element_foo.attrib) |
| 2680 | self.assertNotEqual(element_foo2.attrib, element_foo.attrib) |
| 2681 | |
| 2682 | def test_augmentation_type_errors(self): |
| 2683 | e = ET.Element('joe') |
nothing calls this directly
no test coverage detected