(self)
| 1563 | and t.namespace == xml.dom.EMPTY_NAMESPACE) |
| 1564 | |
| 1565 | def testSetIdAttribute(self): |
| 1566 | doc = parseString("<doc a1='v' a2='w'/>") |
| 1567 | e = doc.documentElement |
| 1568 | a1 = e.getAttributeNode("a1") |
| 1569 | a2 = e.getAttributeNode("a2") |
| 1570 | self.confirm(doc.getElementById("v") is None |
| 1571 | and not a1.isId |
| 1572 | and not a2.isId) |
| 1573 | e.setIdAttribute("a1") |
| 1574 | self.confirm(e.isSameNode(doc.getElementById("v")) |
| 1575 | and a1.isId |
| 1576 | and not a2.isId) |
| 1577 | e.setIdAttribute("a2") |
| 1578 | self.confirm(e.isSameNode(doc.getElementById("v")) |
| 1579 | and e.isSameNode(doc.getElementById("w")) |
| 1580 | and a1.isId |
| 1581 | and a2.isId) |
| 1582 | # replace the a1 node; the new node should *not* be an ID |
| 1583 | a3 = doc.createAttribute("a1") |
| 1584 | a3.value = "v" |
| 1585 | e.setAttributeNode(a3) |
| 1586 | self.confirm(doc.getElementById("v") is None |
| 1587 | and e.isSameNode(doc.getElementById("w")) |
| 1588 | and not a1.isId |
| 1589 | and a2.isId |
| 1590 | and not a3.isId) |
| 1591 | # renaming an attribute should not affect its ID-ness: |
| 1592 | doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") |
| 1593 | self.confirm(e.isSameNode(doc.getElementById("w")) |
| 1594 | and a2.isId) |
| 1595 | |
| 1596 | def testSetIdAttributeNS(self): |
| 1597 | NS1 = "http://xml.python.org/ns1" |
nothing calls this directly
no test coverage detected