Add OrderedDict test for PEP 468 (guaranteed ordered of kwargs)

This commit is contained in:
Raymond Hettinger 2017-01-08 00:37:13 -08:00
parent d15bb26248
commit ec53b07ef1
1 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,14 @@ class OrderedDictTests:
self.assertEqual(list(d.items()), self.assertEqual(list(d.items()),
[('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6), ('g', 7)]) [('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): def test_update(self):
OrderedDict = self.OrderedDict OrderedDict = self.OrderedDict
with self.assertRaises(TypeError): with self.assertRaises(TypeError):