#NEWLINE# def test_unique( ) : #NEWLINE# #INDENT# 'Test unique() replacement\n    ' #NEWLINE# if ( LooseVersion ( np . __version__ ) < LooseVersion ( '1.5' ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for arr in [ np . array ( [ ] ) , rng . rand ( 10 ) , np . ones ( 10 ) ] : #NEWLINE# #INDENT# assert_array_equal ( np . unique ( x1 ) , _unique ( arr ) ) #NEWLINE# ( x1 , x2 ) = np . unique ( arr , return_index = True , return_inverse = False ) #NEWLINE# ( y1 , y2 ) = _unique ( arr , return_index = True , return_inverse = False ) #NEWLINE# assert_array_equal ( x1 , y1 ) #NEWLINE# assert_array_equal ( x2 , y2 ) #NEWLINE# ( x1 , x2 ) = np . unique ( arr , return_index = False , return_inverse = True ) #NEWLINE# ( y1 , y2 ) = _unique ( arr , return_index = False , return_inverse = True ) #NEWLINE# assert_array_equal ( x1 , y1 ) #NEWLINE# assert_array_equal ( x2 , y2 ) #NEWLINE# ( x1 , x2 , x3 ) = np . unique ( arr , return_index = True , return_inverse = True ) #NEWLINE# ( y1 , y2 , y3 ) = _unique ( arr , return_index = True , return_inverse = True ) #NEWLINE# assert_array_equal ( x1 , y1 ) #NEWLINE# assert_array_equal ( x2 , y2 ) #NEWLINE# assert_array_equal ( x3 , y3 )