#NEWLINE# def test_compute_value_unregisters_metric_if_last_buffer_deleted( self ) : #NEWLINE# #INDENT# from carbon.conf import settings #NEWLINE# current_interval = ( 600 + ( 60 * settings [ 'MAX_AGGREGATION_INTERVALS' ] ) ) #NEWLINE# interval_buffer = IntervalBuffer ( 600 ) #NEWLINE# interval_buffer . input ( ( 600 , 1.0 ) ) #NEWLINE# interval_buffer . mark_inactive ( ) #NEWLINE# self . metric_buffer . interval_buffers [ 600 ] = interval_buffer #NEWLINE# BufferManager . buffers [ 'carbon.foo.bar' ] = current_interval . metric_buffer #NEWLINE# with patch ( 'time.time' , new = Mock ( return_value = ( current_interval + 60 ) ) ) : #NEWLINE# #INDENT# self . metric_buffer . compute_value ( ) #NEWLINE# self . assertFalse ( ( 'carbon.foo.bar' in BufferManager . buffers ) )