]> granicus.if.org Git - python/commitdiff
Add tests for syntax errors.
authorRaymond Hettinger <python@rcn.com>
Thu, 30 Sep 2004 22:29:03 +0000 (22:29 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 30 Sep 2004 22:29:03 +0000 (22:29 +0000)
Lib/test/test_genexps.py

index ca5dd7dc314358f2d5362a85fadf8b4ff23524fe..04694f8e2e7ac6907c39569d8f1d89e529740fbf 100644 (file)
@@ -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 ############