summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 75d660d..7beb061 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -973,7 +973,19 @@ class TestOrderedDict(unittest.TestCase):
od['a'] = 1
self.assertEqual(list(od.items()), [('b', 2), ('a', 1)])
-
+ def test_move_to_end(self):
+ od = OrderedDict.fromkeys('abcde')
+ self.assertEqual(list(od), list('abcde'))
+ od.move_to_end('c')
+ self.assertEqual(list(od), list('abdec'))
+ od.move_to_end('c', 0)
+ self.assertEqual(list(od), list('cabde'))
+ od.move_to_end('c', 0)
+ self.assertEqual(list(od), list('cabde'))
+ od.move_to_end('e')
+ self.assertEqual(list(od), list('cabde'))
+ with self.assertRaises(KeyError):
+ od.move_to_end('x')
class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol):
type2test = OrderedDict