https://github.com/python/cpython/commit/5cc9e466b02858d667fddb885b521ab2029c6e36
commit: 5cc9e466b02858d667fddb885b521ab2029c6e36
branch: main
author: dr-carlos <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-08-13T14:18:35Z
summary:
gh-141174: Test `type_repr()` of `Template` with invalid syntax in
`Interpolation` (#155661)
Test `type_repr()` of `Template` with invalid syntax in `Interpolation`
files:
M Lib/test/test_annotationlib.py
diff --git a/Lib/test/test_annotationlib.py b/Lib/test/test_annotationlib.py
index 23d31b05efea2a..530114161701b5 100644
--- a/Lib/test/test_annotationlib.py
+++ b/Lib/test/test_annotationlib.py
@@ -1881,6 +1881,10 @@ def nested():
type_repr(Template("hi", Interpolation(42, " "))),
"Template('hi', Interpolation(42, ' ', None, ''))",
)
+ self.assertEqual(
+ type_repr(Template("hi", Interpolation(42, "4!2"))),
+ "Template('hi', Interpolation(42, '4!2', None, ''))",
+ )
# gh138558: perhaps in the future, we can improve this behavior:
self.assertEqual(type_repr(Template(Interpolation(42, "99"))),
"t'{99}'")
_______________________________________________
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]