#NEWLINE# def test_timedelta64_equal_timedelta_supported_ops( self ) : #NEWLINE# #INDENT# ser = Series ( [ Timestamp ( '20130301' ) , Timestamp ( '20130228 23:00:00' ) , Timestamp ( '20130228 22:00:00' ) , Timestamp ( '20130228 21:00:00' ) ] ) #NEWLINE# intervals = ( 'D' , 'h' , 'm' , 's' , 'us' ) #NEWLINE# def timedelta64( * args ) : #NEWLINE# #INDENT# return sum ( starmap ( np . timedelta64 , zip ( args , intervals ) ) ) #NEWLINE# #UNINDENT# for ( op , d , h , m , s , us ) in product ( [ operator . add , operator . sub ] , * ( [ range ( 2 ) ] * 5 ) ) : #NEWLINE# #INDENT# nptd = timedelta64 ( d , h , m , s , us ) #NEWLINE# pytd = timedelta ( days = d , hours = h , minutes = m , seconds = s , microseconds = us ) #NEWLINE# lhs = op ( ser , nptd ) #NEWLINE# rhs = op ( ser , pytd ) #NEWLINE# try : #NEWLINE# #INDENT# assert_series_equal ( lhs , rhs ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise AssertionError ( 'invalid comparsion [op->{0},d->{1},h->{2},m->{3},s->{4},us->{5}]\n{6}\n{7}\n' . format ( op , d , h , m , s , us , lhs , rhs ) )