@@ -206,6 +206,15 @@ def test_tstrings(self):
206206 self .check_ast_roundtrip ("t'foo'" )
207207 self .check_ast_roundtrip ("t'foo {bar}'" )
208208 self .check_ast_roundtrip ("t'foo {bar!s:.2f}'" )
209+ self .check_ast_roundtrip ("t'{a + b}'" )
210+ self .check_ast_roundtrip ("t'{a + b:x}'" )
211+ self .check_ast_roundtrip ("t'{a + b!s}'" )
212+ self .check_ast_roundtrip ("t'{ {a}}'" )
213+ self .check_ast_roundtrip ("t'{ {a}=}'" )
214+ self .check_ast_roundtrip ("t'{{a}}'" )
215+ self .check_ast_roundtrip ("t''" )
216+ self .check_ast_roundtrip ('t""' )
217+ self .check_ast_roundtrip ("t'{(lambda x: x)}'" )
209218
210219 def test_strings (self ):
211220 self .check_ast_roundtrip ("u'foo'" )
@@ -813,15 +822,6 @@ def test_type_params(self):
813822 self .check_ast_roundtrip ("def f[T: int = int, **P = int, *Ts = *int]():\n pass" )
814823 self .check_ast_roundtrip ("class C[T: int = int, **P = int, *Ts = *int]():\n pass" )
815824
816- def test_tstr (self ):
817- self .check_ast_roundtrip ("t'{a + b}'" )
818- self .check_ast_roundtrip ("t'{a + b:x}'" )
819- self .check_ast_roundtrip ("t'{a + b!s}'" )
820- self .check_ast_roundtrip ("t'{ {a}}'" )
821- self .check_ast_roundtrip ("t'{ {a}=}'" )
822- self .check_ast_roundtrip ("t'{{a}}'" )
823- self .check_ast_roundtrip ("t''" )
824-
825825
826826class ManualASTCreationTestCase (unittest .TestCase ):
827827 """Test that AST nodes created without a type_params field unparse correctly."""
0 commit comments