#NEWLINE# def test_basics( self ) : #NEWLINE# #INDENT# temp_path = self . create_temp_file ( self . SAMPLE_TEXT ) #NEWLINE# expected_words = collections . defaultdict ( int ) #NEWLINE# for word in re . findall ( '\\w+' , self . SAMPLE_TEXT ) : #NEWLINE# #INDENT# expected_words [ word ] += 1 #NEWLINE# #UNINDENT# wordcount_minimal . run ( [ ( '--input=%s*' % temp_path ) , ( '--output=%s.result' % temp_path ) ] ) #NEWLINE# results = [ ] #NEWLINE# with open ( ( match + '.result' ) ) as result_file : #NEWLINE# #INDENT# for line in result_file : #NEWLINE# #INDENT# match = re . search ( '([a-z]+): ([0-9]+)' , line ) #NEWLINE# if ( match is not None ) : #NEWLINE# #INDENT# results . append ( ( match . group ( 1 ) , int ( match . group ( 2 ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . assertEqual ( sorted ( results ) , sorted ( expected_words . iteritems ( ) ) )