#NEWLINE# def testToDeltas( self ) : #NEWLINE# #INDENT# s = self . makeSeries ( ) #NEWLINE# self . assertEqual ( 100 , len ( s . data ) ) #NEWLINE# s . ToDeltas ( ) #NEWLINE# self . assertEqual ( 99 , len ( s . data ) ) #NEWLINE# self . assertEqual ( [ 1 , 60000 ] , s . data [ 0 ] ) #NEWLINE# self . assertEqual ( [ 1 , 1040000 ] , s . data [ ( - 1 ) ] ) #NEWLINE# s = timeseries . Timeseries ( ) #NEWLINE# for i in range ( 0 , 1000 ) : #NEWLINE# #INDENT# s . Append ( i , ( i * 1000000.0 ) ) #NEWLINE# #UNINDENT# s . Normalize ( ( 20 * 1000000.0 ) , ( 500 * 1000000.0 ) , ( 1000 * 1000000.0 ) , mode = timeseries . NORMALIZE_MODE_COUNTER ) #NEWLINE# self . assertEqual ( 25 , len ( s . data ) ) #NEWLINE# self . assertListEqual ( s . data [ 0 ] , [ 519 , int ( ( 500 * 1000000.0 ) ) ] ) #NEWLINE# s . ToDeltas ( ) #NEWLINE# self . assertEqual ( 24 , len ( s . data ) ) #NEWLINE# self . assertListEqual ( s . data [ 0 ] , [ 20 , int ( ( 500 * 1000000.0 ) ) ] ) #NEWLINE# self . assertListEqual ( s . data [ 23 ] , [ 20 , int ( ( 960 * 1000000.0 ) ) ] )