MCPcopy Index your code
hub / github.com/python/cpython / testRemoveAttributeNode

Method testRemoveAttributeNode

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

Source from the content-addressed store, hash-verified

374 dom.unlink()
375
376 def testRemoveAttributeNode(self):
377 dom = Document()
378 child = dom.appendChild(dom.createElement("foo"))
379 child.setAttribute("spam", "jam")
380 self.assertEqual(len(child.attributes), 1)
381 node = child.getAttributeNode("spam")
382 self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNode,
383 None)
384 self.assertIs(node, child.removeAttributeNode(node))
385 self.assertEqual(len(child.attributes), 0)
386 self.assertIsNone(child.getAttributeNode("spam"))
387 dom2 = Document()
388 child2 = dom2.appendChild(dom2.createElement("foo"))
389 node2 = child2.getAttributeNode("spam")
390 self.assertRaises(xml.dom.NotFoundErr, child2.removeAttributeNode,
391 node2)
392 dom.unlink()
393
394 def testHasAttribute(self):
395 dom = Document()

Callers

nothing calls this directly

Calls 11

appendChildMethod · 0.95
createElementMethod · 0.95
unlinkMethod · 0.95
DocumentClass · 0.90
setAttributeMethod · 0.80
getAttributeNodeMethod · 0.80
removeAttributeNodeMethod · 0.80
assertIsNoneMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected