(self)
| 2615 | self.assertEqual(element_foo2.attrib, element_foo.attrib) |
| 2616 | |
| 2617 | def test___deepcopy__(self): |
| 2618 | element_foo = ET.Element("foo", { "zix": "wyp" }) |
| 2619 | element_foo.append(ET.Element("bar", { "baz": "qix" })) |
| 2620 | |
| 2621 | element_foo2 = copy.deepcopy(element_foo) |
| 2622 | |
| 2623 | # elements are not the same |
| 2624 | self.assertIsNot(element_foo2, element_foo) |
| 2625 | |
| 2626 | # string attributes are equal |
| 2627 | self.assertEqual(element_foo2.tag, element_foo.tag) |
| 2628 | self.assertEqual(element_foo2.text, element_foo.text) |
| 2629 | self.assertEqual(element_foo2.tail, element_foo.tail) |
| 2630 | |
| 2631 | # number of children is the same |
| 2632 | self.assertEqual(len(element_foo2), len(element_foo)) |
| 2633 | |
| 2634 | # children are not the same |
| 2635 | for (child1, child2) in itertools.zip_longest(element_foo, element_foo2): |
| 2636 | self.assertIsNot(child1, child2) |
| 2637 | |
| 2638 | # attrib is a copy |
| 2639 | self.assertIsNot(element_foo2.attrib, element_foo.attrib) |
| 2640 | self.assertEqual(element_foo2.attrib, element_foo.attrib) |
| 2641 | |
| 2642 | # attrib isn't linked |
| 2643 | element_foo.attrib["bar"] = "baz" |
| 2644 | self.assertIsNot(element_foo2.attrib, element_foo.attrib) |
| 2645 | self.assertNotEqual(element_foo2.attrib, element_foo.attrib) |
| 2646 | |
| 2647 | def test_augmentation_type_errors(self): |
| 2648 | e = ET.Element('joe') |
nothing calls this directly
no test coverage detected