From 60202609a2c2d0971aadfa4729ba30b50e89c6ea Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Wed, 30 Apr 2025 11:46:41 +0200 Subject: gh-132661: Implement PEP 750 (#132662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lysandros Nikolaou Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Wingy Co-authored-by: Koudai Aono Co-authored-by: Dave Peck Co-authored-by: Terry Jan Reedy Co-authored-by: Paul Everitt Co-authored-by: sobolevn --- Lib/test/test_unparse.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Lib/test/test_unparse.py') diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 839326f6436..d3af7a8489e 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -202,6 +202,15 @@ class UnparseTestCase(ASTTestCase): self.check_ast_roundtrip('f" something { my_dict["key"] } something else "') self.check_ast_roundtrip('f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"') + def test_tstrings(self): + self.check_ast_roundtrip("t'foo'") + self.check_ast_roundtrip("t'foo {bar}'") + self.check_ast_roundtrip("t'foo {bar!s:.2f}'") + self.check_ast_roundtrip("t'foo {bar}' f'{bar}'") + self.check_ast_roundtrip("f'{bar}' t'foo {bar}'") + self.check_ast_roundtrip("t'foo {bar}' fr'\\hello {bar}'") + self.check_ast_roundtrip("t'foo {bar}' u'bar'") + def test_strings(self): self.check_ast_roundtrip("u'foo'") self.check_ast_roundtrip("r'foo'") @@ -918,7 +927,7 @@ class DirectoryTestCase(ASTTestCase): run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py", "test_ast.py", "test_asdl_parser.py", "test_fstring.py", "test_patma.py", "test_type_alias.py", "test_type_params.py", - "test_tokenize.py"} + "test_tokenize.py", "test_tstring.py"} _files_to_test = None -- cgit v1.2.3