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

Method testSetIdAttributeNode

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

Source from the content-addressed store, hash-verified

1650
1651 @unittest.expectedFailure # TODO: RUSTPYTHON
1652 def testSetIdAttributeNode(self):
1653 NS1 = "http://xml.python.org/ns1"
1654 NS2 = "http://xml.python.org/ns2"
1655 doc = parseString("<doc"
1656 " xmlns:ns1='" + NS1 + "'"
1657 " xmlns:ns2='" + NS2 + "'"
1658 " ns1:a1='v' ns2:a2='w'/>")
1659 e = doc.documentElement
1660 a1 = e.getAttributeNodeNS(NS1, "a1")
1661 a2 = e.getAttributeNodeNS(NS2, "a2")
1662 self.confirm(doc.getElementById("v") is None
1663 and not a1.isId
1664 and not a2.isId)
1665 e.setIdAttributeNode(a1)
1666 self.confirm(e.isSameNode(doc.getElementById("v"))
1667 and a1.isId
1668 and not a2.isId)
1669 e.setIdAttributeNode(a2)
1670 self.confirm(e.isSameNode(doc.getElementById("v"))
1671 and e.isSameNode(doc.getElementById("w"))
1672 and a1.isId
1673 and a2.isId)
1674 # replace the a1 node; the new node should *not* be an ID
1675 a3 = doc.createAttributeNS(NS1, "a1")
1676 a3.value = "v"
1677 e.setAttributeNode(a3)
1678 self.assertTrue(e.isSameNode(doc.getElementById("w")))
1679 self.assertFalse(a1.isId)
1680 self.assertTrue(a2.isId)
1681 self.assertFalse(a3.isId)
1682 self.assertIsNone(doc.getElementById("v"))
1683 # renaming an attribute should not affect its ID-ness:
1684 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1685 self.confirm(e.isSameNode(doc.getElementById("w"))
1686 and a2.isId)
1687
1688 def assert_recursive_equal(self, doc, doc2):
1689 stack = [(doc, doc2)]

Callers

nothing calls this directly

Calls 12

confirmMethod · 0.95
parseStringFunction · 0.90
getAttributeNodeNSMethod · 0.80
getElementByIdMethod · 0.80
setIdAttributeNodeMethod · 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