@@ -206,6 +206,15 @@ def test_tstrings(self):
206
206
self .check_ast_roundtrip ("t'foo'" )
207
207
self .check_ast_roundtrip ("t'foo {bar}'" )
208
208
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)}'" )
209
218
210
219
def test_strings (self ):
211
220
self .check_ast_roundtrip ("u'foo'" )
@@ -813,15 +822,6 @@ def test_type_params(self):
813
822
self .check_ast_roundtrip ("def f[T: int = int, **P = int, *Ts = *int]():\n pass" )
814
823
self .check_ast_roundtrip ("class C[T: int = int, **P = int, *Ts = *int]():\n pass" )
815
824
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
-
825
825
826
826
class ManualASTCreationTestCase (unittest .TestCase ):
827
827
"""Test that AST nodes created without a type_params field unparse correctly."""
0 commit comments