File tree Expand file tree Collapse file tree 2 files changed +64
-1
lines changed Expand file tree Collapse file tree 2 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -740,6 +740,69 @@ class AtomTest(CSTNodeTest):
740
740
"parser" : parse_expression ,
741
741
"expected_position" : None ,
742
742
},
743
+ # Unpacked tuple
744
+ {
745
+ "node" : cst .FormattedString (
746
+ parts = [
747
+ cst .FormattedStringExpression (
748
+ expression = cst .Tuple (
749
+ elements = [
750
+ cst .Element (
751
+ value = cst .Name (
752
+ value = "a" ,
753
+ ),
754
+ comma = cst .Comma (
755
+ whitespace_before = cst .SimpleWhitespace (
756
+ value = "" ,
757
+ ),
758
+ whitespace_after = cst .SimpleWhitespace (
759
+ value = " " ,
760
+ ),
761
+ ),
762
+ ),
763
+ cst .Element (
764
+ value = cst .Name (
765
+ value = "b" ,
766
+ ),
767
+ ),
768
+ ],
769
+ lpar = [],
770
+ rpar = [],
771
+ ),
772
+ ),
773
+ ],
774
+ start = "f'" ,
775
+ end = "'" ,
776
+ ),
777
+ "code" : "f'{a, b}'" ,
778
+ "parser" : parse_expression ,
779
+ "expected_position" : None ,
780
+ },
781
+ # Conditional expression
782
+ {
783
+ "node" : cst .FormattedString (
784
+ parts = [
785
+ cst .FormattedStringExpression (
786
+ expression = cst .IfExp (
787
+ test = cst .Name (
788
+ value = "b" ,
789
+ ),
790
+ body = cst .Name (
791
+ value = "a" ,
792
+ ),
793
+ orelse = cst .Name (
794
+ value = "c" ,
795
+ ),
796
+ ),
797
+ ),
798
+ ],
799
+ start = "f'" ,
800
+ end = "'" ,
801
+ ),
802
+ "code" : "f'{a if b else c}'" ,
803
+ "parser" : parse_expression ,
804
+ "expected_position" : None ,
805
+ },
743
806
# Concatenated strings
744
807
{
745
808
"node" : cst .ConcatenatedString (
Original file line number Diff line number Diff line change @@ -1396,7 +1396,7 @@ parser! {
1396
1396
1397
1397
rule _f_expr( ) -> Expression <' a>
1398
1398
= ( g: _bare_genexp( ) { Expression :: GeneratorExp ( g) } )
1399
- / _conditional_expression ( )
1399
+ / star_expressions ( )
1400
1400
/ yield_expr( )
1401
1401
1402
1402
rule _f_conversion( ) -> & ' a str
You can’t perform that action at this time.
0 commit comments