#NEWLINE# def test_order_by_on_list_nested( ) : #NEWLINE# #INDENT# data = [ Struct ( foo = Struct ( bar = 'c' ) ) , Struct ( foo = Struct ( bar = 'b' ) ) , Struct ( foo = Struct ( bar = 'a' ) ) ] #NEWLINE# sorted_data = data [ : ] #NEWLINE# order_by_on_list ( sorted_data , 'foo__bar' ) #NEWLINE# assert ( sorted_data == list ( reversed ( sorted_data ) ) ) #NEWLINE# order_by_on_list ( sorted_data , ( lambda x : x . foo . bar ) ) #NEWLINE# assert ( sorted_data == list ( reversed ( data ) ) )