(self)
| 1594 | and a2.isId) |
| 1595 | |
| 1596 | def testSetIdAttributeNS(self): |
| 1597 | NS1 = "http://xml.python.org/ns1" |
| 1598 | NS2 = "http://xml.python.org/ns2" |
| 1599 | doc = parseString("<doc" |
| 1600 | " xmlns:ns1='" + NS1 + "'" |
| 1601 | " xmlns:ns2='" + NS2 + "'" |
| 1602 | " ns1:a1='v' ns2:a2='w'/>") |
| 1603 | e = doc.documentElement |
| 1604 | a1 = e.getAttributeNodeNS(NS1, "a1") |
| 1605 | a2 = e.getAttributeNodeNS(NS2, "a2") |
| 1606 | self.confirm(doc.getElementById("v") is None |
| 1607 | and not a1.isId |
| 1608 | and not a2.isId) |
| 1609 | e.setIdAttributeNS(NS1, "a1") |
| 1610 | self.confirm(e.isSameNode(doc.getElementById("v")) |
| 1611 | and a1.isId |
| 1612 | and not a2.isId) |
| 1613 | e.setIdAttributeNS(NS2, "a2") |
| 1614 | self.confirm(e.isSameNode(doc.getElementById("v")) |
| 1615 | and e.isSameNode(doc.getElementById("w")) |
| 1616 | and a1.isId |
| 1617 | and a2.isId) |
| 1618 | # replace the a1 node; the new node should *not* be an ID |
| 1619 | a3 = doc.createAttributeNS(NS1, "a1") |
| 1620 | a3.value = "v" |
| 1621 | e.setAttributeNode(a3) |
| 1622 | self.assertTrue(e.isSameNode(doc.getElementById("w"))) |
| 1623 | self.assertFalse(a1.isId) |
| 1624 | self.assertTrue(a2.isId) |
| 1625 | self.assertFalse(a3.isId) |
| 1626 | self.assertIsNone(doc.getElementById("v")) |
| 1627 | # renaming an attribute should not affect its ID-ness: |
| 1628 | doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") |
| 1629 | self.confirm(e.isSameNode(doc.getElementById("w")) |
| 1630 | and a2.isId) |
| 1631 | |
| 1632 | def testSetIdAttributeNode(self): |
| 1633 | NS1 = "http://xml.python.org/ns1" |
nothing calls this directly
no test coverage detected