#NEWLINE# def test_11_sorting( self ) : #NEWLINE# #INDENT# 'Sorting' #NEWLINE# ( pl , ul ) = self . lists_of_len ( ) #NEWLINE# pl . insert ( 0 , pl . pop ( ) ) #NEWLINE# ul . insert ( 0 , ul . pop ( ) ) #NEWLINE# pl . sort ( ) #NEWLINE# ul . sort ( ) #NEWLINE# self . assertEqual ( pl [ : ] , ul [ : ] , 'sort' ) #NEWLINE# mid = pl [ ( len ( pl ) / 2 ) ] #NEWLINE# pl . sort ( key = ( lambda x : ( ( mid - x ) ** 2 ) ) ) #NEWLINE# ul . sort ( key = ( lambda x : ( ( mid - x ) ** 2 ) ) ) #NEWLINE# self . assertEqual ( pl [ : ] , ul [ : ] , 'sort w/ key' ) #NEWLINE# pl . insert ( 0 , pl . pop ( ) ) #NEWLINE# ul . insert ( 0 , ul . pop ( ) ) #NEWLINE# pl . sort ( reverse = True ) #NEWLINE# ul . sort ( reverse = True ) #NEWLINE# self . assertEqual ( pl [ : ] , ul [ : ] , 'sort w/ reverse' ) #NEWLINE# mid = pl [ ( len ( pl ) / 2 ) ] #NEWLINE# pl . sort ( key = ( lambda x : ( ( mid - x ) ** 2 ) ) ) #NEWLINE# ul . sort ( key = ( lambda x : ( ( mid - x ) ** 2 ) ) ) #NEWLINE# self . assertEqual ( pl [ : ] , ul [ : ] , 'sort w/ key' )