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

Method testNormalize

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

Source from the content-addressed store, hash-verified

1018 self.check_clone_node_entity(True)
1019
1020 def testNormalize(self):
1021 doc = parseString("<doc/>")
1022 root = doc.documentElement
1023 root.appendChild(doc.createTextNode("first"))
1024 root.appendChild(doc.createTextNode("second"))
1025 self.confirm(len(root.childNodes) == 2
1026 and root.childNodes.length == 2,
1027 "testNormalize -- preparation")
1028 doc.normalize()
1029 self.confirm(len(root.childNodes) == 1
1030 and root.childNodes.length == 1
1031 and root.firstChild is root.lastChild
1032 and root.firstChild.data == "firstsecond"
1033 , "testNormalize -- result")
1034 doc.unlink()
1035
1036 doc = parseString("<doc/>")
1037 root = doc.documentElement
1038 root.appendChild(doc.createTextNode(""))
1039 doc.normalize()
1040 self.confirm(len(root.childNodes) == 0
1041 and root.childNodes.length == 0,
1042 "testNormalize -- single empty node removed")
1043 doc.unlink()
1044
1045 def testNormalizeCombineAndNextSibling(self):
1046 doc = parseString("<doc/>")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected