From f7264ddea0ceea7eaf26d7b4b6aa7a144649e214 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 30 Apr 2025 19:03:19 +0300 Subject: gh-133211: Test that PEP750 types are final (#133212) --- Lib/test/test_string/test_templatelib.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_string/test_templatelib.py b/Lib/test/test_string/test_templatelib.py index 5cf1878..5221ca6 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' -- cgit v0.12