Skip to content

Commit 2752daa

Browse files
committed
Test the error message
1 parent 0f98b64 commit 2752daa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_capi/test_type.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class MyType:
1515
MyType.attr = "mutable"
1616

1717
type_freeze(MyType)
18-
with self.assertRaises(TypeError):
18+
err_msg = "cannot set 'attr' attribute of immutable type 'MyType'"
19+
with self.assertRaisesRegex(TypeError, err_msg):
1920
# the class is now immutable
2021
MyType.attr = "immutable"
2122

@@ -36,7 +37,6 @@ class D(A, C): pass
3637
# as well
3738
type_freeze(D)
3839

39-
4040
def test_freeze_meta(self):
4141
"""test PyType_Freeze() with overridden MRO"""
4242
type_freeze = _testcapi.type_freeze

0 commit comments

Comments
 (0)