File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -461,8 +461,7 @@ def test_var_annot_simple_exec(self):
461
461
# exec('X: str', {}, CNS2())
462
462
# self.assertEqual(nonloc_ns['__annotations__']['x'], str)
463
463
464
- # TODO: RUSTPYTHON
465
- @unittest .expectedFailure
464
+
466
465
def test_var_annot_rhs (self ):
467
466
ns = {}
468
467
exec ('x: tuple = 1, 2' , ns )
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ ExpressionStatement: ast::Statement = {
107
107
}
108
108
}
109
109
},
110
- <location:@L> <target:TestOrStarExprList> <op:AugAssign> <rhs:TestList > => {
110
+ <location:@L> <target:TestOrStarExprList> <op:AugAssign> <rhs:TestListOrYieldExpr > => {
111
111
ast::Statement {
112
112
location,
113
113
node: ast::StatementType::AugAssign {
@@ -117,23 +117,27 @@ ExpressionStatement: ast::Statement = {
117
117
},
118
118
}
119
119
},
120
- <location:@L> <target:Test> ":" <annotation:Test> <rhs:("=" Test) ?> => {
120
+ <location:@L> <target:Test> ":" <annotation:Test> <rhs:AssignSuffix ?> => {
121
121
ast::Statement {
122
122
location,
123
123
node: ast::StatementType::AnnAssign {
124
124
target: Box::new(target),
125
125
annotation: Box::new(annotation),
126
- value: rhs.map(|e| e.1)
126
+ value: rhs
127
127
},
128
128
}
129
129
},
130
130
};
131
131
132
132
AssignSuffix: ast::Expression = {
133
- "=" <e:TestList> => e,
134
- "=" <e:YieldExpr> => e,
133
+ "=" <e:TestListOrYieldExpr> => e
135
134
};
136
135
136
+ TestListOrYieldExpr: ast::Expression = {
137
+ TestList,
138
+ YieldExpr
139
+ }
140
+
137
141
TestOrStarExprList: ast::Expression = {
138
142
<location:@L> <elements:OneOrMore<TestOrStarExpr>> <comma:","?> => {
139
143
if elements.len() == 1 && comma.is_none() {
You can’t perform that action at this time.
0 commit comments