Author: collin.winter
Date: Sat Jul 14 21:00:17 2007
New Revision: 56377

Modified:
   python/branches/p3yk/Lib/test/test_grammar.py
Log:
Add a basic example of dictcomps to test_grammar.

Modified: python/branches/p3yk/Lib/test/test_grammar.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_grammar.py       (original)
+++ python/branches/p3yk/Lib/test/test_grammar.py       Sat Jul 14 21:00:17 2007
@@ -704,6 +704,13 @@
         @class_decorator
         class G: pass
 
+    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]
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to