[Python-checkins] r83152 - in python/branches/py3k/Lib: test/test_minidom.py xml/dom/minidom.py
andrew.kuchling
python-checkins at python.org
Mon Jul 26 01:38:47 CEST 2010
Author: andrew.kuchling
Date: Mon Jul 26 01:38:47 2010
New Revision: 83152
Log:
#777884: make .normalize() do nothing for childless nodes, instead of raising an exception
Modified:
python/branches/py3k/Lib/test/test_minidom.py
python/branches/py3k/Lib/xml/dom/minidom.py
Modified: python/branches/py3k/Lib/test/test_minidom.py
==============================================================================
--- python/branches/py3k/Lib/test/test_minidom.py (original)
+++ python/branches/py3k/Lib/test/test_minidom.py Mon Jul 26 01:38:47 2010
@@ -951,6 +951,14 @@
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
Modified: python/branches/py3k/Lib/xml/dom/minidom.py
==============================================================================
--- python/branches/py3k/Lib/xml/dom/minidom.py (original)
+++ python/branches/py3k/Lib/xml/dom/minidom.py Mon Jul 26 01:38:47 2010
@@ -920,6 +920,10 @@
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")
More information about the Python-checkins
mailing list