gh-133211: Test that PEP750 types are final (#133212)

This commit is contained in:
sobolevn 2025-04-30 19:03:19 +03:00 committed by GitHub
parent cc39b19f0f
commit f7264ddea0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,13 @@ def test_common(self):
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'