https://github.com/python/cpython/commit/f7264ddea0ceea7eaf26d7b4b6aa7a144649e214
commit: f7264ddea0ceea7eaf26d7b4b6aa7a144649e214
branch: main
author: sobolevn <[email protected]>
committer: lysnikolaou <[email protected]>
date: 2025-04-30T18:03:19+02:00
summary:
gh-133211: Test that PEP750 types are final (#133212)
files:
M Lib/test/test_string/test_templatelib.py
diff --git a/Lib/test/test_string/test_templatelib.py
b/Lib/test/test_string/test_templatelib.py
index 5cf187828510c4..5221ca673b24ec 100644
--- a/Lib/test/test_string/test_templatelib.py
+++ b/Lib/test/test_string/test_templatelib.py
@@ -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'
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]