mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-92123: Convert _elementtree
types to heap types (#99221)
This commit is contained in:
parent
9109d46051
commit
3847a6c64b
4 changed files with 185 additions and 236 deletions
|
@ -181,6 +181,26 @@ class MiscTests(unittest.TestCase):
|
|||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue