Skip to content

Commit bfd94cb

Browse files
Correct error messages
Suggested changes from @serhiy-storchaka Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 78118ea commit bfd94cb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Lib/xml/etree/ElementTree.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,7 @@ class ElementTree:
528528
"""
529529
def __init__(self, element=None, file=None):
530530
if element is not None and not iselement(element):
531-
raise TypeError(f"expected an xml.etree.ElementTree.Element or "
532-
f"Element-like object, not "
533-
f"{type(element).__name__}")
531+
raise TypeError('expected an Element, not %s' % type(e).__name__)
534532
self._root = element # first node
535533
if file:
536534
self.parse(file)
@@ -547,9 +545,7 @@ def _setroot(self, element):
547545
548546
"""
549547
if not iselement(element):
550-
raise TypeError(f"expected an xml.etree.ElementTree.Element or "
551-
f"Element-like object, not "
552-
f"{type(element).__name__}")
548+
raise TypeError('expected an Element, not %s' % type(e).__name__)
553549
self._root = element
554550

555551
def parse(self, source, parser=None):

0 commit comments

Comments
 (0)