#NEWLINE# def test_sweep( self ) : #NEWLINE# #INDENT# 'Test that all and only empty entries are removed from a summary.' #NEWLINE# objects = [ 'the' , 'quick' , 'brown' , 'fox' , 1298 , 123 , 234 , [ ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ] #NEWLINE# summ = summary . summarize ( objects ) #NEWLINE# summary . _subtract ( summ , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# summary . _subtract ( summ , [ ] ) #NEWLINE# summ = summary . _sweep ( summ ) #NEWLINE# found_dict = found_tuple = False #NEWLINE# for row in summ : #NEWLINE# #INDENT# if ( row [ 0 ] == "<type 'dict'>" ) : #NEWLINE# #INDENT# found_dict = True #NEWLINE# #UNINDENT# if ( row [ 0 ] == "<type 'tuple'>" ) : #NEWLINE# #INDENT# found_tuple = True #NEWLINE# #UNINDENT# #UNINDENT# self . assert_ ( ( found_dict == False ) ) #NEWLINE# self . assert_ ( ( found_dict == False ) ) #NEWLINE# summ = summary . _subtract ( summ , 'the' ) #NEWLINE# summ = summary . _subtract ( summ , 'quick' ) #NEWLINE# summ = summary . _subtract ( summ , 'brown' ) #NEWLINE# summ = summary . _subtract ( summ , '42' ) #NEWLINE# summ = summary . _sweep ( summ ) #NEWLINE# found_string = False #NEWLINE# for row in summ : #NEWLINE# #INDENT# if ( row [ 0 ] == summary . _repr ( '' ) ) : #NEWLINE# #INDENT# found_string = True #NEWLINE# self . assert_ ( ( row [ 1 ] == 0 ) ) #NEWLINE# totalsize = ( _getsizeof ( 'fox' ) - _getsizeof ( '42' ) ) #NEWLINE# self . assert_ ( ( row [ 2 ] == totalsize ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . assert_ ( ( found_string == True ) )