#NEWLINE# def test_order( self ) : #NEWLINE# #INDENT# with tm . assert_produces_warning ( FutureWarning ) : #NEWLINE# #INDENT# self . ts . order ( ) #NEWLINE# #UNINDENT# ts = self . ts . copy ( ) #NEWLINE# ts [ : 5 ] = np . NaN #NEWLINE# vals = ts . values #NEWLINE# result = ts . sort_values ( ) #NEWLINE# self . assertTrue ( np . isnan ( result [ ( - 5 ) : ] ) . all ( ) ) #NEWLINE# self . assert_numpy_array_equal ( result [ : ( - 5 ) ] , np . sort ( vals [ 5 : ] ) ) #NEWLINE# result = ts . sort_values ( na_position = 'first' ) #NEWLINE# self . assertTrue ( np . isnan ( result [ : 5 ] ) . all ( ) ) #NEWLINE# self . assert_numpy_array_equal ( result [ 5 : ] , np . sort ( vals [ 5 : ] ) ) #NEWLINE# ser = Series ( [ 'A' , 'B' ] , [ 1 , 2 ] ) #NEWLINE# ser . sort_values ( ) #NEWLINE# ordered = ts . sort_values ( ascending = False ) #NEWLINE# expected = np . sort ( ts . valid ( ) . values ) [ : : ( - 1 ) ] #NEWLINE# assert_almost_equal ( expected , ordered . valid ( ) . values ) #NEWLINE# ordered = ts . sort_values ( ascending = False , na_position = 'first' ) #NEWLINE# assert_almost_equal ( expected , ordered . valid ( ) . values )