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

Method testAddAttr

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

Source from the content-addressed store, hash-verified

317 dom.unlink()
318
319 def testAddAttr(self):
320 dom = Document()
321 child = dom.appendChild(dom.createElement("abc"))
322
323 child.setAttribute("def", "ghi")
324 self.assertEqual(child.getAttribute("def"), "ghi")
325 self.assertEqual(child.attributes["def"].value, "ghi")
326
327 child.setAttribute("jkl", "mno")
328 self.assertEqual(child.getAttribute("jkl"), "mno")
329 self.assertEqual(child.attributes["jkl"].value, "mno")
330
331 self.assertEqual(len(child.attributes), 2)
332
333 child.setAttribute("def", "newval")
334 self.assertEqual(child.getAttribute("def"), "newval")
335 self.assertEqual(child.attributes["def"].value, "newval")
336
337 self.assertEqual(len(child.attributes), 2)
338 dom.unlink()
339
340 def testDeleteAttr(self):
341 dom = Document()

Callers

nothing calls this directly

Calls 7

appendChildMethod · 0.95
createElementMethod · 0.95
unlinkMethod · 0.95
DocumentClass · 0.90
setAttributeMethod · 0.80
getAttributeMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected