Skip to content

Commit f7264dd

Browse files
authored
gh-133211: Test that PEP750 types are final (#133212)
1 parent cc39b19 commit f7264dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/test/test_string/test_templatelib.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ def test_common(self):
1818
self.assertEqual(type(i).__qualname__, 'Interpolation')
1919
self.assertEqual(type(i).__module__, 'string.templatelib')
2020

21+
def test_final_types(self):
22+
with self.assertRaisesRegex(TypeError, 'is not an acceptable base type'):
23+
class Sub(Template): ...
24+
25+
with self.assertRaisesRegex(TypeError, 'is not an acceptable base type'):
26+
class Sub(Interpolation): ...
27+
2128
def test_basic_creation(self):
2229
# Simple t-string creation
2330
t = t'Hello, world'

0 commit comments

Comments
 (0)