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

Method testReplaceWholeText

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

Source from the content-addressed store, hash-verified

1501 self.assertIs(e.parentNode, elem, "After replaceChild()")
1502
1503 def testReplaceWholeText(self):
1504 def setup():
1505 doc = parseString("<doc>a<e/>d</doc>")
1506 elem = doc.documentElement
1507 text1 = elem.firstChild
1508 text2 = elem.lastChild
1509 splitter = text1.nextSibling
1510 elem.insertBefore(doc.createTextNode("b"), splitter)
1511 elem.insertBefore(doc.createCDATASection("c"), text1)
1512 return doc, elem, text1, splitter, text2
1513
1514 doc, elem, text1, splitter, text2 = setup()
1515 text = text1.replaceWholeText("new content")
1516 self.checkWholeText(text, "new content")
1517 self.checkWholeText(text2, "d")
1518 self.assertEqual(len(elem.childNodes), 3)
1519
1520 doc, elem, text1, splitter, text2 = setup()
1521 text = text2.replaceWholeText("new content")
1522 self.checkWholeText(text, "new content")
1523 self.checkWholeText(text1, "cab")
1524 self.assertEqual(len(elem.childNodes), 5)
1525
1526 doc, elem, text1, splitter, text2 = setup()
1527 text = text1.replaceWholeText("")
1528 self.checkWholeText(text2, "d")
1529 self.confirm(text is None
1530 and len(elem.childNodes) == 2)
1531
1532 def testSchemaType(self):
1533 doc = parseString(

Callers

nothing calls this directly

Calls 5

checkWholeTextMethod · 0.95
confirmMethod · 0.95
replaceWholeTextMethod · 0.80
setupFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected