#NEWLINE# def test_operators( self ) : #NEWLINE# #INDENT# def _check_op( a , b , op ) : #NEWLINE# #INDENT# sp_result = op ( a , b ) #NEWLINE# adense = ( a . to_dense ( ) if isinstance ( a , SparseSeries ) else a ) #NEWLINE# bdense = ( b . to_dense ( ) if isinstance ( b , SparseSeries ) else b ) #NEWLINE# dense_result = op ( adense , bdense ) #NEWLINE# tm . assert_almost_equal ( sp_result . to_dense ( ) , dense_result ) #NEWLINE# #UNINDENT# def check( a , b ) : #NEWLINE# #INDENT# _check_op ( a , b , operator . add ) #NEWLINE# _check_op ( a , b , operator . sub ) #NEWLINE# _check_op ( a , b , operator . truediv ) #NEWLINE# _check_op ( a , b , operator . floordiv ) #NEWLINE# _check_op ( a , b , operator . mul ) #NEWLINE# _check_op ( a , b , ( lambda x , y : operator . add ( y , x ) ) ) #NEWLINE# _check_op ( a , b , ( lambda x , y : operator . sub ( y , x ) ) ) #NEWLINE# _check_op ( a , b , ( lambda x , y : operator . truediv ( y , x ) ) ) #NEWLINE# _check_op ( a , b , ( lambda x , y : operator . floordiv ( y , x ) ) ) #NEWLINE# _check_op ( a , b , ( lambda x , y : operator . mul ( y , x ) ) ) #NEWLINE# #UNINDENT# check ( self . bseries , self . bseries ) #NEWLINE# check ( self . iseries , self . iseries ) #NEWLINE# check ( self . bseries , self . iseries ) #NEWLINE# check ( self . bseries , self . bseries2 ) #NEWLINE# check ( self . bseries , self . iseries2 ) #NEWLINE# check ( self . iseries , self . iseries2 ) #NEWLINE# check ( self . bseries , 5 ) #NEWLINE# check ( self . zbseries , ( self . zbseries * 2 ) ) #NEWLINE# check ( self . zbseries , self . zbseries2 ) #NEWLINE# check ( self . ziseries , self . ziseries2 ) #NEWLINE# result = ( self . bseries + self . bseries . to_dense ( ) ) #NEWLINE# tm . assert_sp_series_equal ( result , ( self . bseries + check . bseries ) )