Skip to content

Commit ba210d6

Browse files
committed
Keep Element.remove regression in the XML snippet [skip ci]
Move all six cases unchanged into the existing XML snippet as requested in review. Assisted-by: OpenAI Codex:model identifier unavailable
1 parent 58fd96d commit ba210d6

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

‎extra_tests/snippets/stdlib_elementtree.py‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎extra_tests/snippets/stdlib_xml.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import array
12
import xml.sax
3+
from xml.etree.ElementTree import Element
24
from xml.parsers import expat
35

46
from testutils import assert_raises
@@ -66,3 +68,18 @@ def endElement(self, name):
6668
("characters", "text"),
6769
("end-cdata",),
6870
]
71+
72+
root = Element("root")
73+
for value, type_name in (
74+
(None, "None"),
75+
(1, "int"),
76+
("child", "str"),
77+
(array.array("b"), "array.array"),
78+
(type("A" * 60, (), {})(), "A" * 50),
79+
(type("€" * 20, (), {})(), "€" * 16),
80+
):
81+
with assert_raises(TypeError) as caught:
82+
root.remove(value)
83+
assert str(caught.exception) == (
84+
"remove() argument must be xml.etree.ElementTree.Element, not " + type_name
85+
)

0 commit comments

Comments
 (0)