Issue #2333: Backport set and dict comprehensions syntax.
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 @@
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]