summaryrefslogtreecommitdiff
path: root/Lib/test/test_genexps.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-30 22:29:03 +0000
committerRaymond Hettinger <python@rcn.com>2004-09-30 22:29:03 +0000
commit7b46f6b2a59c6217bba1e62aa24052148dd919fe (patch)
treed031d95de97ff6e34def3cd7608e14aaa490ae8a /Lib/test/test_genexps.py
parent0fe00aafc3a40c6979980fd6b713e79b2f5b722f (diff)
downloadcpython-git-7b46f6b2a59c6217bba1e62aa24052148dd919fe.tar.gz
Add tests for syntax errors.
Diffstat (limited to 'Lib/test/test_genexps.py')
-rw-r--r--Lib/test/test_genexps.py13
1 files changed, 13 insertions, 0 deletions
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 ############