#NEWLINE# def test_subtract( self ) : #NEWLINE# #INDENT# "Test that a single object's data is correctly subtracted from a summary.\n        - result in correct total size and total number of objects\n        - if object was not listed before, it should be listed negative\n          afterwards\n        " #NEWLINE# objects = [ 'the' , 'quick' , 'brown' , 'fox' , 1298 , 123 , 234 , [ ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ] #NEWLINE# summ = summary . summarize ( objects ) #NEWLINE# summary . _subtract ( summ , 'the' ) #NEWLINE# summary . _subtract ( summ , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# summary . _subtract ( summ , ( 1 , ) ) #NEWLINE# checked_str = checked_dict = checked_tuple = False #NEWLINE# for row in summ : #NEWLINE# #INDENT# if ( row [ 0 ] == summary . _repr ( '' ) ) : #NEWLINE# #INDENT# totalsize = ( ( _getsizeof ( 'quick' ) + _getsizeof ( 'brown' ) ) + _getsizeof ( 'fox' ) ) #NEWLINE# self . assert_ ( ( row [ 1 ] == 3 ) , ( '%s != %s' % ( row [ 1 ] , 3 ) ) ) #NEWLINE# self . assert_ ( ( row [ 2 ] == totalsize ) , totalsize ) #NEWLINE# checked_str = True #NEWLINE# #UNINDENT# if ( row [ 0 ] == summary . _repr ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) : #NEWLINE# #INDENT# self . assert_ ( ( row [ 1 ] == 0 ) ) #NEWLINE# self . assert_ ( ( row [ 2 ] == 0 ) ) #NEWLINE# checked_dict = True #NEWLINE# #UNINDENT# if ( row [ 0 ] == summary . _repr ( ( 1 , ) ) ) : #NEWLINE# #INDENT# self . assert_ ( ( row [ 1 ] == ( - 1 ) ) ) #NEWLINE# self . assert_ ( ( row [ 2 ] == ( - _getsizeof ( ( 1 , ) ) ) ) ) #NEWLINE# checked_tuple = True #NEWLINE# #UNINDENT# #UNINDENT# self . assert_ ( checked_str , 'no str found in summary' ) #NEWLINE# self . assert_ ( checked_dict , 'no dict found in summary' ) #NEWLINE# self . assert_ ( checked_tuple , 'no tuple found in summary' ) #NEWLINE# summary . _subtract ( summ , 'quick' ) #NEWLINE# summary . _subtract ( summ , 'brown' ) #NEWLINE# checked_str = False #NEWLINE# for row in summ : #NEWLINE# #INDENT# if ( row [ 0 ] == summary . _repr ( '' ) ) : #NEWLINE# #INDENT# self . assert_ ( ( row [ 1 ] == 1 ) ) #NEWLINE# self . assert_ ( ( row [ 2 ] == _getsizeof ( 'fox' ) ) ) #NEWLINE# checked_str = True #NEWLINE# #UNINDENT# #UNINDENT# self . assert_ ( checked_str , 'no str found in summ' )