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

Method testNormalize

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

Source from the content-addressed store, hash-verified

1005 self.check_clone_node_entity(True)
1006
1007 def testNormalize(self):
1008 doc = parseString("<doc/>")
1009 root = doc.documentElement
1010 root.appendChild(doc.createTextNode("first"))
1011 root.appendChild(doc.createTextNode("second"))
1012 self.confirm(len(root.childNodes) == 2
1013 and root.childNodes.length == 2,
1014 "testNormalize -- preparation")
1015 doc.normalize()
1016 self.confirm(len(root.childNodes) == 1
1017 and root.childNodes.length == 1
1018 and root.firstChild is root.lastChild
1019 and root.firstChild.data == "firstsecond"
1020 , "testNormalize -- result")
1021 doc.unlink()
1022
1023 doc = parseString("<doc/>")
1024 root = doc.documentElement
1025 root.appendChild(doc.createTextNode(""))
1026 doc.normalize()
1027 self.confirm(len(root.childNodes) == 0
1028 and root.childNodes.length == 0,
1029 "testNormalize -- single empty node removed")
1030 doc.unlink()
1031
1032 def testNormalizeCombineAndNextSibling(self):
1033 doc = parseString("<doc/>")

Callers

nothing calls this directly

Calls 6

confirmMethod · 0.95
parseStringFunction · 0.90
createTextNodeMethod · 0.80
appendChildMethod · 0.45
normalizeMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected