From 7b46f6b2a59c6217bba1e62aa24052148dd919fe Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 30 Sep 2004 22:29:03 +0000 Subject: [PATCH] Add tests for syntax errors. --- Lib/test/test_genexps.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index ca5dd7dc314..04694f8e2e7 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 ############