Skip to content

Commit 06eaff5

Browse files
committed
Add tests for ElementTree constructor
Add tests verifying the new type checking behavior
1 parent f0356c8 commit 06eaff5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_xml_etree.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ def check_element(element):
247247
self.assertRegex(repr(element), r"^<Element 't\xe4g' at 0x.*>$")
248248
element = ET.Element("tag", key="value")
249249

250+
# Verify type checking for ElementTree constructor
251+
252+
with self.assertRaises(TypeError):
253+
tree = ET.ElementTree("")
254+
with self.assertRaises(TypeError):
255+
tree = ET.ElementTree(ET.ElementTree())
256+
250257
# Make sure all standard element methods exist.
251258

252259
def check_method(method):

0 commit comments

Comments
 (0)