Kaydet (Commit) 688b9e38 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

#777884: make .normalize() do nothing for childless nodes, instead of raising an exception

üst ea64a6a4
......@@ -951,6 +951,14 @@ class MinidomTest(unittest.TestCase):
doc.unlink()
def testBug0777884(self):
doc = parseString("<o>text</o>")
text = doc.documentElement.childNodes[0]
self.assertEquals(text.nodeType, Node.TEXT_NODE)
# Should run quietly, doing nothing.
text.normalize()
doc.unlink()
def testBug1433694(self):
doc = parseString("<o><i/>t</o>")
node = doc.documentElement
......
......@@ -920,6 +920,10 @@ class Childless:
raise xml.dom.NotFoundErr(
self.nodeName + " nodes do not have children")
def normalize(self):
# For childless nodes, normalize() has nothing to do.
pass
def replaceChild(self, newChild, oldChild):
raise xml.dom.HierarchyRequestErr(
self.nodeName + " nodes do not have children")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment