@@ -260,6 +260,9 @@ var grammarTestData = []struct {
260
260
{"a, b = *a" , "exec" , "Module(body=[Assign(targets=[Tuple(elts=[Name(id='a', ctx=Store()), Name(id='b', ctx=Store())], ctx=Store())], value=Starred(value=Name(id='a', ctx=Load()), ctx=Load()))])" , nil , "" },
261
261
{"a = yield a" , "exec" , "Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Yield(value=Name(id='a', ctx=Load())))])" , nil , "" },
262
262
{"a.b = 1" , "exec" , "Module(body=[Assign(targets=[Attribute(value=Name(id='a', ctx=Load()), attr='b', ctx=Store())], value=Num(n=1))])" , nil , "" },
263
+ {"[e for e in [1, 2, 3]] = 3" , "exec" , "" , py .SyntaxError , "can't assign to list comprehension" },
264
+ {"{e for e in [1, 2, 3]} = 3" , "exec" , "" , py .SyntaxError , "can't assign to set comprehension" },
265
+ {"{e: e**2 for e in [1, 2, 3]} = 3" , "exec" , "" , py .SyntaxError , "can't assign to dict comprehension" },
263
266
{"f() = 1" , "exec" , "" , py .SyntaxError , "can't assign to function call" },
264
267
{"lambda: x = 1" , "exec" , "" , py .SyntaxError , "can't assign to lambda" },
265
268
{"(a + b) = 1" , "exec" , "" , py .SyntaxError , "can't assign to operator" },
0 commit comments