]> granicus.if.org Git - python/commitdiff
Add OrderedDict test for PEP 468 (guaranteed ordered of kwargs)
authorRaymond Hettinger <python@rcn.com>
Sun, 8 Jan 2017 08:37:13 +0000 (00:37 -0800)
committerRaymond Hettinger <python@rcn.com>
Sun, 8 Jan 2017 08:37:13 +0000 (00:37 -0800)
Lib/test/test_ordered_dict.py

index a35ed12436a95d2f00b94fea47cb56d941367d0f..93f812a530f603fa0a36787feba84ac957f62cc6 100644 (file)
@@ -52,6 +52,14 @@ class OrderedDictTests:
         self.assertEqual(list(d.items()),
             [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6), ('g', 7)])
 
+    def test_468(self):
+        OrderedDict = self.OrderedDict
+        items = [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6), ('g', 7)]
+        shuffle(items)
+        argdict = OrderedDict(items)
+        d = OrderedDict(**argdict)
+        self.assertEqual(list(d.items()), items)
+
     def test_update(self):
         OrderedDict = self.OrderedDict
         with self.assertRaises(TypeError):