File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from weakref import proxy
77import pickle
88from random import choice
9+ from functools32 import OrderedDict
910
1011@staticmethod
1112def PythonPartial (func , * args , ** keywords ):
@@ -671,6 +672,21 @@ def func(i):
671672 with self .assertRaises (IndexError ):
672673 func (15 )
673674
675+ class TestOrderedDict (unittest .TestCase ):
676+ def test_move_to_end (self ):
677+ od = OrderedDict .fromkeys ('abcde' )
678+ self .assertEqual (list (od ), list ('abcde' ))
679+ od .move_to_end ('c' )
680+ self .assertEqual (list (od ), list ('abdec' ))
681+ od .move_to_end ('c' , 0 )
682+ self .assertEqual (list (od ), list ('cabde' ))
683+ od .move_to_end ('c' , 0 )
684+ self .assertEqual (list (od ), list ('cabde' ))
685+ od .move_to_end ('e' )
686+ self .assertEqual (list (od ), list ('cabde' ))
687+ with self .assertRaises (KeyError ):
688+ od .move_to_end ('x' )
689+
674690def test_main (verbose = None ):
675691 test_classes = (
676692 TestPartial ,
@@ -682,6 +698,7 @@ def test_main(verbose=None):
682698 TestWraps ,
683699 TestReduce ,
684700 TestLRU ,
701+ TestOrderedDict ,
685702 )
686703 support .run_unittest (* test_classes )
687704
You can’t perform that action at this time.
0 commit comments