#NEWLINE# def test_symmetric_difference( self ) : #NEWLINE# #INDENT# for ( name , idx ) in compat . iteritems ( self . indices ) : #NEWLINE# #INDENT# first = idx [ 1 : ] #NEWLINE# second = idx [ : ( - 1 ) ] #NEWLINE# if isinstance ( idx , CategoricalIndex ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# answer = idx [ [ 0 , ( - 1 ) ] ] #NEWLINE# result = first . symmetric_difference ( second ) #NEWLINE# self . assertTrue ( tm . equalContents ( result , answer ) ) #NEWLINE# #UNINDENT# cases = [ klass ( second . values ) for klass in [ np . array , Series , list ] ] #NEWLINE# for case in cases : #NEWLINE# #INDENT# if isinstance ( idx , PeriodIndex ) : #NEWLINE# #INDENT# msg = 'can only call with other PeriodIndex-ed objects' #NEWLINE# with tm . assertRaisesRegexp ( ValueError , msg ) : #NEWLINE# #INDENT# result = first . symmetric_difference ( case ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( idx , CategoricalIndex ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = first . symmetric_difference ( case ) #NEWLINE# self . assertTrue ( tm . equalContents ( result , answer ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if isinstance ( idx , MultiIndex ) : #NEWLINE# #INDENT# msg = 'other must be a MultiIndex or a list of tuples' #NEWLINE# with tm . assertRaisesRegexp ( TypeError , msg ) : #NEWLINE# #INDENT# result = first . symmetric_difference ( [ 1 , 2 , 3 ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# with tm . assert_produces_warning ( FutureWarning ) : #NEWLINE# #INDENT# first . sym_diff ( second )