From: sobolevn Date: Wed, 30 Apr 2025 16:03:19 +0000 (+0300) Subject: gh-133211: Test that PEP750 types are final (#133212) X-Git-Tag: v3.14.0b1~166 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7264ddea0ceea7eaf26d7b4b6aa7a144649e214;p=thirdparty%2FPython%2Fcpython.git gh-133211: Test that PEP750 types are final (#133212) --- diff --git a/Lib/test/test_string/test_templatelib.py b/Lib/test/test_string/test_templatelib.py index 5cf187828510..5221ca673b24 100644 --- a/Lib/test/test_string/test_templatelib.py +++ b/Lib/test/test_string/test_templatelib.py @@ -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'