From: Raymond Hettinger Date: Thu, 30 Sep 2004 22:29:03 +0000 (+0000) Subject: Add tests for syntax errors. X-Git-Tag: v2.4b1~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b46f6b2a59c6217bba1e62aa24052148dd919fe;p=python Add tests for syntax errors. --- diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index ca5dd7dc31..04694f8e2e 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -120,6 +120,19 @@ Verify re-use of tuples (a side benefit of using genexps over listcomps) >>> max(tupleids) - min(tupleids) 0 +Verify that syntax error's are raised for genexps used as lvalues + + >>> (y for y in (1,2)) = 10 + Traceback (most recent call last): + ... + SyntaxError: assign to generator expression not possible + + >>> (y for y in (1,2)) += 10 + Traceback (most recent call last): + ... + SyntaxError: augmented assign to tuple literal or generator expression not possible + + ########### Tests borrowed from or inspired by test_generators.py ############