diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-23 01:51:40 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-23 01:51:40 (GMT) |
commit | 578ceee04226d94322e29dbdb26c0919c8e18fa4 (patch) | |
tree | 3b1b82d67d0c2505553075a715a6136b279149a1 /Lib/test/test_grammar.py | |
parent | 2528b19a86ed8d3ed26114c414a7a312fa85e72d (diff) | |
download | cpython-578ceee04226d94322e29dbdb26c0919c8e18fa4.zip cpython-578ceee04226d94322e29dbdb26c0919c8e18fa4.tar.gz cpython-578ceee04226d94322e29dbdb26c0919c8e18fa4.tar.bz2 |
Add simple test of list comprehension that uses a name that isn't
otherwise used in the same code block. (Not sure this is the right
place, but there is no test_list_comprehensions.py.)
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index b64fcdf..3e7318a 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -612,6 +612,12 @@ print [3 * x for x in nums] print [x for x in nums if x > 2] print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] + +def test_in_func(l): + return [None < x < 3 for x in l if x > 2] + +print test_in_func(nums) + try: eval("[i, s for i in nums for s in strs]") print "FAIL: should have raised a SyntaxError!" |