diff options
| author | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-11 22:36:12 (GMT) |
|---|---|---|
| committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-11 22:36:12 (GMT) |
| commit | b646547bb45fe1df6abefd94f892c633798d91d2 (patch) | |
| tree | ef1add045741d309129266726f5ba45562184091 /Lib/test/test_grammar.py | |
| parent | 0ca7452794bef03b66f56cc996a73cac066d0ec1 (diff) | |
| download | cpython-b646547bb45fe1df6abefd94f892c633798d91d2.zip cpython-b646547bb45fe1df6abefd94f892c633798d91d2.tar.gz cpython-b646547bb45fe1df6abefd94f892c633798d91d2.tar.bz2 | |
Issue #2333: Backport set and dict comprehensions syntax.
Diffstat (limited to 'Lib/test/test_grammar.py')
| -rw-r--r-- | Lib/test/test_grammar.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 4713d1a..12039e7 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -808,6 +808,13 @@ hello world pass self.assertEqual(G.decorated, True) + def testDictcomps(self): + # dictorsetmaker: ( (test ':' test (comp_for | + # (',' test ':' test)* [','])) | + # (test (comp_for | (',' test)* [','])) ) + nums = [1, 2, 3] + self.assertEqual({i:i+1 for i in nums}, {1: 2, 2: 3, 3: 4}) + def testListcomps(self): # list comprehension tests nums = [1, 2, 3, 4, 5] |
