#NEWLINE# def test_update( self ) : #NEWLINE# #INDENT# with self . assertRaises ( TypeError ) : #NEWLINE# #INDENT# OrderedDict ( ) . update ( [ ( 'a' , 1 ) , ( 'b' , 2 ) ] , None ) #NEWLINE# #UNINDENT# pairs = [ ( 'a' , 1 ) , ( 'b' , 2 ) , ( 'c' , 3 ) , ( 'd' , 4 ) , ( 'e' , 5 ) ] #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( dict ( pairs ) ) #NEWLINE# self . assertEqual ( sorted ( od . items ( ) ) , pairs ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( ** dict ( pairs ) ) #NEWLINE# self . assertEqual ( sorted ( od . items ( ) ) , pairs ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( pairs ) #NEWLINE# self . assertEqual ( list ( od . items ( ) ) , pairs ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( [ ( 'a' , 1 ) , ( 'b' , 2 ) , ( 'c' , 9 ) , ( 'd' , 4 ) ] , c = 3 , e = 5 ) #NEWLINE# self . assertEqual ( list ( od . items ( ) ) , pairs ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( self = 23 ) #NEWLINE# self . assertEqual ( list ( od . items ( ) ) , [ ( 'self' , 23 ) ] ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( other = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( list ( od . items ( ) ) , [ ( 'other' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ] ) #NEWLINE# od = OrderedDict ( ) #NEWLINE# od . update ( red = 5 , blue = 6 , other = 7 , self = 8 ) #NEWLINE# self . assertEqual ( sorted ( list ( od . items ( ) ) ) , [ ( 'blue' , 6 ) , ( 'other' , 7 ) , ( 'red' , 5 ) , ( 'self' , 8 ) ] ) #NEWLINE# d = OrderedDict ( [ ( 'a' , 1 ) , ( 'b' , 2 ) , ( 'c' , 3 ) , ( 'd' , 44 ) , ( 'e' , 55 ) ] ) #NEWLINE# d . update ( [ ( 'e' , 5 ) , ( 'f' , 6 ) ] , g = 7 , d = 4 ) #NEWLINE# self . assertEqual ( list ( d . items ( ) ) , [ ( 'a' , 1 ) , ( 'b' , 2 ) , ( 'c' , 3 ) , ( 'd' , 4 ) , ( 'e' , 5 ) , ( 'f' , 6 ) , ( 'g' , 7 ) ] )