]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133211: Test that PEP750 types are final (#133212)
authorsobolevn <mail@sobolevn.me>
Wed, 30 Apr 2025 16:03:19 +0000 (19:03 +0300)
committerGitHub <noreply@github.com>
Wed, 30 Apr 2025 16:03:19 +0000 (18:03 +0200)
Lib/test/test_string/test_templatelib.py

index 5cf187828510c4c6cab5ad8707580d9bd9248035..5221ca673b24ec6ca5f16eac42aa1cdde2e70599 100644 (file)
@@ -18,6 +18,13 @@ class TestTemplate(unittest.TestCase, TStringBaseCase):
         self.assertEqual(type(i).__qualname__, 'Interpolation')
         self.assertEqual(type(i).__module__, 'string.templatelib')
 
+    def test_final_types(self):
+        with self.assertRaisesRegex(TypeError, 'is not an acceptable base type'):
+            class Sub(Template): ...
+
+        with self.assertRaisesRegex(TypeError, 'is not an acceptable base type'):
+            class Sub(Interpolation): ...
+
     def test_basic_creation(self):
         # Simple t-string creation
         t = t'Hello, world'