@@ -511,6 +511,11 @@ def test_mismatched_parens(self):
511
511
])
512
512
self .assertRaises (SyntaxError , eval , "f'{" + "(" * 500 + "}'" )
513
513
514
+ def test_fstring_nested_too_deeply (self ):
515
+ self .assertAllRaise (SyntaxError ,
516
+ "f-string: expressions nested too deeply" ,
517
+ ['f"{1+2:{1+2:{1+1:{1}}}}"' ])
518
+
514
519
def test_double_braces (self ):
515
520
self .assertEqual (f'{{' , '{' )
516
521
self .assertEqual (f'a{{' , 'a{' )
@@ -741,6 +746,7 @@ def test_parens_in_expressions(self):
741
746
self .assertAllRaise (SyntaxError , 'unterminated string literal' ,
742
747
["f'{\n }'" ,
743
748
])
749
+
744
750
def test_newlines_before_syntax_error (self ):
745
751
self .assertAllRaise (SyntaxError , "invalid syntax" ,
746
752
["f'{.}'" , "\n f'{.}'" , "\n \n f'{.}'" ])
@@ -1379,7 +1385,6 @@ def __repr__(self):
1379
1385
#self.assertEqual(f'X{x =}Y', 'Xx\t='+repr(x)+'Y')
1380
1386
#self.assertEqual(f'X{x = }Y', 'Xx\t=\t'+repr(x)+'Y')
1381
1387
1382
-
1383
1388
def test_walrus (self ):
1384
1389
x = 20
1385
1390
# This isn't an assignment expression, it's 'x', with a format
0 commit comments