@@ -116,7 +116,7 @@ public void FStringErrors() {
116
116
new ErrorResult ( "f-string: expecting '}'" , new SourceSpan ( 19 , 4 , 19 , 5 ) ) ,
117
117
new ErrorResult ( "unexpected token 'import'" , new SourceSpan ( 21 , 4 , 21 , 10 ) ) ,
118
118
new ErrorResult ( "f-string: empty expression not allowed" , new SourceSpan ( 23 , 4 , 23 , 5 ) ) ,
119
- new ErrorResult ( "unexpected token '='" , new SourceSpan ( 25 , 6 , 25 , 7 ) ) ,
119
+ new ErrorResult ( "f-string: expecting '}' but found '='" , new SourceSpan ( 25 , 6 , 25 , 7 ) ) ,
120
120
new ErrorResult ( "expected ':'" , new SourceSpan ( 27 , 12 , 27 , 12 ) ) ,
121
121
new ErrorResult ( "f-string: lambda must be inside parentheses" , new SourceSpan ( 27 , 4 , 27 , 12 ) ) ,
122
122
new ErrorResult ( "f-string: expecting '}'" , new SourceSpan ( 29 , 6 , 29 , 7 ) ) ,
@@ -125,7 +125,9 @@ public void FStringErrors() {
125
125
new ErrorResult ( "f-string: unmatched ')'" , new SourceSpan ( 35 , 4 , 35 , 5 ) ) ,
126
126
new ErrorResult ( "f-string: unmatched ')'" , new SourceSpan ( 37 , 6 , 37 , 7 ) ) ,
127
127
new ErrorResult ( "f-string: closing parenthesis '}' does not match opening parenthesis '('" , new SourceSpan ( 39 , 6 , 39 , 7 ) ) ,
128
- new ErrorResult ( "f-string: unmatched ']'" , new SourceSpan ( 41 , 4 , 41 , 5 ) )
128
+ new ErrorResult ( "f-string: unmatched ']'" , new SourceSpan ( 41 , 4 , 41 , 5 ) ) ,
129
+ new ErrorResult ( "unexpected EOF while parsing" , new SourceSpan ( 43 , 7 , 43 , 7 ) ) ,
130
+ new ErrorResult ( "f-string: expecting '}' but found '='" , new SourceSpan ( 43 , 7 , 43 , 8 ) )
129
131
) ;
130
132
}
131
133
@@ -408,6 +410,72 @@ public void FStrings() {
408
410
)
409
411
)
410
412
)
413
+ ) ,
414
+ CheckExprStmt (
415
+ CheckFString (
416
+ CheckFormattedValue (
417
+ CheckConditionalExpression (
418
+ CheckNameExpr ( "x" ) ,
419
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . Equal , CheckConstant ( 1.0 ) ) ,
420
+ CheckConstant ( 0 )
421
+ )
422
+ )
423
+ )
424
+ ) ,
425
+ CheckExprStmt (
426
+ CheckFString (
427
+ CheckFormattedValue (
428
+ CheckConditionalExpression (
429
+ CheckNameExpr ( "x" ) ,
430
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . NotEqual , CheckConstant ( 1.0 ) ) ,
431
+ CheckConstant ( 0 )
432
+ )
433
+ )
434
+ )
435
+ ) ,
436
+ CheckExprStmt (
437
+ CheckFString (
438
+ CheckFormattedValue (
439
+ CheckConditionalExpression (
440
+ CheckNameExpr ( "x" ) ,
441
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . GreaterThanOrEqual , CheckConstant ( 1.0 ) ) ,
442
+ CheckConstant ( 0 )
443
+ )
444
+ )
445
+ )
446
+ ) ,
447
+ CheckExprStmt (
448
+ CheckFString (
449
+ CheckFormattedValue (
450
+ CheckConditionalExpression (
451
+ CheckNameExpr ( "x" ) ,
452
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . LessThanOrEqual , CheckConstant ( 1.0 ) ) ,
453
+ CheckConstant ( 0 )
454
+ )
455
+ )
456
+ )
457
+ ) ,
458
+ CheckExprStmt (
459
+ CheckFString (
460
+ CheckFormattedValue (
461
+ CheckConditionalExpression (
462
+ CheckNameExpr ( "x" ) ,
463
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . GreaterThan , CheckConstant ( 1.0 ) ) ,
464
+ CheckConstant ( 0 )
465
+ )
466
+ )
467
+ )
468
+ ) ,
469
+ CheckExprStmt (
470
+ CheckFString (
471
+ CheckFormattedValue (
472
+ CheckConditionalExpression (
473
+ CheckNameExpr ( "x" ) ,
474
+ CheckBinaryExpression ( CheckNameExpr ( "x" ) , PythonOperator . LessThan , CheckConstant ( 1.0 ) ) ,
475
+ CheckConstant ( 0 )
476
+ )
477
+ )
478
+ )
411
479
)
412
480
)
413
481
) ;
@@ -478,7 +546,9 @@ public void FStringEqualsErrors() {
478
546
ParseErrors ( "FStringEqualsErrors.py" ,
479
547
PythonLanguageVersion . V38 ,
480
548
new ErrorResult ( "f-string: expecting '}' but found 'f'" , new SourceSpan ( 1 , 9 , 1 , 10 ) ) ,
481
- new ErrorResult ( "f-string: expecting '}' but found 'a'" , new SourceSpan ( 2 , 10 , 2 , 11 ) )
549
+ new ErrorResult ( "f-string: expecting '}' but found 'a'" , new SourceSpan ( 2 , 10 , 2 , 11 ) ) ,
550
+ new ErrorResult ( "unexpected EOF while parsing" , new SourceSpan ( 3 , 9 , 3 , 9 ) ) ,
551
+ new ErrorResult ( "f-string: expecting '}' but found 'a'" , new SourceSpan ( 3 , 11 , 3 , 12 ) )
482
552
) ;
483
553
}
484
554
0 commit comments