#NEWLINE# def test_get_joined( self ) : #NEWLINE# #INDENT# for t in xrange ( 1 , 120 ) : #NEWLINE# #INDENT# self . series . insert ( 'test1' , t , timestamp = _time ( t ) ) #NEWLINE# self . series . insert ( 'test2' , t , timestamp = _time ( t ) ) #NEWLINE# #UNINDENT# for t in xrange ( 3600 , 3720 ) : #NEWLINE# #INDENT# self . series . insert ( 'test1' , t , timestamp = _time ( t ) ) #NEWLINE# self . series . insert ( 'test2' , t , timestamp = _time ( t ) ) #NEWLINE# #UNINDENT# for t in xrange ( 120 , 240 ) : #NEWLINE# #INDENT# self . series . insert ( 'test1' , t , timestamp = _time ( t ) ) #NEWLINE# #UNINDENT# for t in xrange ( 3721 , 3840 ) : #NEWLINE# #INDENT# self . series . insert ( 'test1' , t , timestamp = _time ( t ) ) #NEWLINE# #UNINDENT# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' , timestamp = _time ( 100 ) ) #NEWLINE# assert_equals ( [ _time ( 60 ) ] , interval . keys ( ) ) #NEWLINE# assert_equals ( ( 2 * sum ( range ( 60 , 120 ) ) ) , interval [ _time ( 60 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' , timestamp = _time ( 100 ) , transform = 'rate' ) #NEWLINE# assert_equals ( ( ( 2 * sum ( range ( 60 , 120 ) ) ) / 60.0 ) , interval [ _time ( 60 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' , timestamp = _time ( 122 ) ) #NEWLINE# assert_equals ( [ _time ( 120 ) ] , interval . keys ( ) ) #NEWLINE# assert_equals ( sum ( range ( 120 , 180 ) ) , interval [ _time ( 120 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' , timestamp = _time ( 122 ) , transform = 'rate' ) #NEWLINE# assert_equals ( ( sum ( range ( 120 , 180 ) ) / 60.0 ) , interval [ _time ( 120 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' ) #NEWLINE# assert_equals ( 1 , len ( interval ) ) #NEWLINE# assert_equals ( 0 , interval . values ( ) [ 0 ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'minute' , transform = 'rate' ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'hour' , timestamp = _time ( 100 ) ) #NEWLINE# assert_equals ( map ( _time , [ 0 , 60 , 120 , 180 ] ) , interval . keys ( ) ) #NEWLINE# assert_equals ( ( 2 * sum ( range ( 1 , 60 ) ) ) , interval [ _time ( 0 ) ] ) #NEWLINE# assert_equals ( ( 2 * sum ( range ( 60 , 120 ) ) ) , interval [ _time ( 60 ) ] ) #NEWLINE# assert_equals ( sum ( range ( 120 , 180 ) ) , interval [ _time ( 120 ) ] ) #NEWLINE# assert_equals ( sum ( range ( 180 , 240 ) ) , interval [ _time ( 180 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'hour' , timestamp = _time ( 100 ) , condensed = True ) #NEWLINE# assert_equals ( [ _time ( 0 ) ] , interval . keys ( ) ) #NEWLINE# assert_equals ( ( ( 2 * sum ( range ( 1 , 120 ) ) ) + sum ( range ( 120 , 240 ) ) ) , interval [ _time ( 0 ) ] ) #NEWLINE# interval = self . series . get ( [ 'test1' , 'test2' ] , 'hour' , timestamp = _time ( 100 ) , condensed = True , transform = 'rate' ) #NEWLINE# assert_equals ( ( ( ( 2 * sum ( range ( 1 , 120 ) ) ) + sum ( range ( 120 , 240 ) ) ) / 3600.0 ) , interval [ _time ( 0 ) ] )