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

Method testSetIdAttributeNS

Lib/test/test_minidom.py:1615–1649  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1613
1614 @unittest.expectedFailure # TODO: RUSTPYTHON
1615 def testSetIdAttributeNS(self):
1616 NS1 = "http://xml.python.org/ns1"
1617 NS2 = "http://xml.python.org/ns2"
1618 doc = parseString("<doc"
1619 " xmlns:ns1='" + NS1 + "'"
1620 " xmlns:ns2='" + NS2 + "'"
1621 " ns1:a1='v' ns2:a2='w'/>")
1622 e = doc.documentElement
1623 a1 = e.getAttributeNodeNS(NS1, "a1")
1624 a2 = e.getAttributeNodeNS(NS2, "a2")
1625 self.confirm(doc.getElementById("v") is None
1626 and not a1.isId
1627 and not a2.isId)
1628 e.setIdAttributeNS(NS1, "a1")
1629 self.confirm(e.isSameNode(doc.getElementById("v"))
1630 and a1.isId
1631 and not a2.isId)
1632 e.setIdAttributeNS(NS2, "a2")
1633 self.confirm(e.isSameNode(doc.getElementById("v"))
1634 and e.isSameNode(doc.getElementById("w"))
1635 and a1.isId
1636 and a2.isId)
1637 # replace the a1 node; the new node should *not* be an ID
1638 a3 = doc.createAttributeNS(NS1, "a1")
1639 a3.value = "v"
1640 e.setAttributeNode(a3)
1641 self.assertTrue(e.isSameNode(doc.getElementById("w")))
1642 self.assertFalse(a1.isId)
1643 self.assertTrue(a2.isId)
1644 self.assertFalse(a3.isId)
1645 self.assertIsNone(doc.getElementById("v"))
1646 # renaming an attribute should not affect its ID-ness:
1647 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1648 self.confirm(e.isSameNode(doc.getElementById("w"))
1649 and a2.isId)
1650
1651 @unittest.expectedFailure # TODO: RUSTPYTHON
1652 def testSetIdAttributeNode(self):

Callers

nothing calls this directly

Calls 12

confirmMethod · 0.95
parseStringFunction · 0.90
getAttributeNodeNSMethod · 0.80
getElementByIdMethod · 0.80
setIdAttributeNSMethod · 0.80
isSameNodeMethod · 0.80
createAttributeNSMethod · 0.80
setAttributeNodeMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertIsNoneMethod · 0.80
renameNodeMethod · 0.80

Tested by

no test coverage detected