#NEWLINE# def test_stc_arithmetic( ) : #NEWLINE# #INDENT# 'Test arithmetic for STC files\n    ' #NEWLINE# stc = _fake_stc ( ) #NEWLINE# data = stc . data . copy ( ) #NEWLINE# out = list ( ) #NEWLINE# for a in [ stc , stc ] : #NEWLINE# #INDENT# a = ( ( ( a + ( a * 3 ) ) + ( 3 * a ) ) - ( ( a ** 2 ) / 2 ) ) #NEWLINE# a += a #NEWLINE# a -= a #NEWLINE# with warnings . catch_warnings ( record = True ) : #NEWLINE# #INDENT# warnings . simplefilter ( 'always' ) #NEWLINE# a /= ( 2 * a ) #NEWLINE# #UNINDENT# a *= ( - a ) #NEWLINE# a += 2 #NEWLINE# a -= 1 #NEWLINE# a *= ( - 1 ) #NEWLINE# a /= 2 #NEWLINE# b = ( 2 + a ) #NEWLINE# b = ( 2 - a ) #NEWLINE# b = ( + a ) #NEWLINE# assert_array_equal ( b . data , a . data ) #NEWLINE# with warnings . catch_warnings ( record = True ) : #NEWLINE# #INDENT# warnings . simplefilter ( 'always' ) #NEWLINE# a **= 3 #NEWLINE# #UNINDENT# out . append ( a ) #NEWLINE# #UNINDENT# assert_array_equal ( out [ 0 ] , out [ 1 ] . data ) #NEWLINE# assert_array_equal ( stc . sqrt ( ) . data , np . sqrt ( stc . data ) ) #NEWLINE# stc_mean = stc . mean ( ) #NEWLINE# assert_array_equal ( stc_mean . data , np . mean ( stc . data , 1 ) [ : , None ] )