summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-01-24 15:15:46 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-01-24 15:15:46 (GMT)
commitc4d5e08e3f5463272178ceb226bb7457890e81d3 (patch)
tree3ca1a2dc94c84c77b182ad3fe5c050a265e705e0 /Lib/test/test_xml_etree.py
parent5c6198b3fdecc12cfb6b5bec4d83a1f0ba422b12 (diff)
parentaaa9780fe174a4ed5fc19df1d474fb802a19fa42 (diff)
downloadcpython-c4d5e08e3f5463272178ceb226bb7457890e81d3.zip
cpython-c4d5e08e3f5463272178ceb226bb7457890e81d3.tar.gz
cpython-c4d5e08e3f5463272178ceb226bb7457890e81d3.tar.bz2
Issue #9708: Fix support for iterparse(parser=...) argument per documentation.
When _elementtree is imported, iterparse is redefined as a class and the parser argument was ommitted. Fix this, and add a docstring to the class.
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index def1b61..5c65333 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1886,6 +1886,12 @@ class ElementIterTest(unittest.TestCase):
sourcefile = serialize(doc, to_string=False)
self.assertEqual(next(ET.iterparse(sourcefile))[0], 'end')
+ # With an explitit parser too (issue #9708)
+ sourcefile = serialize(doc, to_string=False)
+ parser = ET.XMLParser(target=ET.TreeBuilder())
+ self.assertEqual(next(ET.iterparse(sourcefile, parser=parser))[0],
+ 'end')
+
tree = ET.ElementTree(None)
self.assertRaises(AttributeError, tree.iter)