Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Lib/test/test_xml_etree_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@ def __hash__(self):
r = e.get(X())
self.assertIsNone(r)

@support.cpython_only
def test_immutable_types(self):
root = cET.fromstring('<a></a>')
dataset = (
cET.Element,
cET.TreeBuilder,
cET.XMLParser,
type(root.iter()),
)
for tp in dataset:
with self.subTest(tp=tp):
with self.assertRaisesRegex(TypeError, "immutable"):
tp.foo = 1

@support.cpython_only
def test_disallow_instantiation(self):
root = cET.fromstring('<a></a>')
iter_type = type(root.iter())
support.check_disallow_instantiation(self, iter_type)


@unittest.skipUnless(cET, 'requires _elementtree')
class TestAliasWorking(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert :mod:`elementtree` types to heap types. Patch by Erlend E. Aasland.
Loading