Skip to content

Commit 883e8d2

Browse files
committed
improve comments
1 parent 4d3cdd7 commit 883e8d2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Lib/test/test_xml_etree.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,14 +2717,17 @@ def __eq__(self, o):
27172717
with self.subTest('single child'):
27182718
root = E('.')
27192719
root.append(etype('one'))
2720-
test_remove(root, rem_type('baz'), raises)
2720+
test_remove(root, rem_type('missing'), raises)
27212721

27222722
with self.subTest('with children'):
27232723
root = E('.')
27242724
root.extend([etype('one'), rem_type('two')])
2725-
test_remove(root, rem_type('baz'), raises)
2725+
test_remove(root, rem_type('missing'), raises)
27262726

2727-
def test_remove_with_mutate_root_1(self):
2727+
def test_remove_with_mutate_root_assume_missing(self):
2728+
# Check that a concurrent mutation for an assumed-to-be
2729+
# missing element does not make the interpreter crash.
2730+
#
27282731
# See: https://github.com/python/cpython/issues/126033
27292732

27302733
E = ET.Element
@@ -2738,8 +2741,7 @@ def __eq__(self, o):
27382741
with self.subTest('missing', etype=etype, rem_type=rem_type):
27392742
root = E('.')
27402743
root.extend([E('one'), etype('two')])
2741-
to_remove = rem_type('baz')
2742-
self.assertRaises(ValueError, root.remove, to_remove)
2744+
self.assertRaises(ValueError, root.remove, rem_type('missing'))
27432745

27442746
for rem_type, raises in [(X, True), (E, False)]:
27452747
with self.subTest('existing', rem_type=rem_type):
@@ -2750,7 +2752,10 @@ def __eq__(self, o):
27502752
else:
27512753
root.remove(same)
27522754

2753-
def test_remove_with_mutate_root_2(self):
2755+
def test_remove_with_mutate_root_assume_existing(self):
2756+
# Check that a concurrent mutation for an assumed-to-be
2757+
# existing element does not make the interpreter crash.
2758+
#
27542759
# See: https://github.com/python/cpython/issues/126033
27552760

27562761
E = ET.Element
@@ -2764,8 +2769,7 @@ def __eq__(self, o):
27642769
with self.subTest('missing', etype=etype, rem_type=rem_type):
27652770
root = E('.')
27662771
root.extend([E('one'), etype('two')])
2767-
to_remove = rem_type('baz')
2768-
root.remove(to_remove)
2772+
root.remove(rem_type('missing'))
27692773

27702774
for rem_type in [E, X]:
27712775
with self.subTest('existing', rem_type=rem_type):

0 commit comments

Comments
 (0)