#NEWLINE# def test_easy_files( self ) : #NEWLINE# #INDENT# ' Objective of this test to is to demonstrate correct processing\n            for a pair of simple files.\n        ' #NEWLINE# file1_recs = [ [ 'Alabama' , '8' , '18' ] , [ 'Alaska' , '6' , '16' ] , [ 'Arizona' , '4' , '14' ] , [ 'Arkansas' , '2' , '12' ] ] #NEWLINE# file1 = generate_test_file ( '|' , file1_recs ) #NEWLINE# file2_recs = [ [ 'Alabama' , '8' , '18' ] , [ 'Arizona' , '4' , '1a' ] , [ 'Arkansas' , '2a' , '12' ] , [ 'Wisconsin' , '13a' , '45b' ] ] #NEWLINE# file2 = generate_test_file ( '|' , file2_recs ) #NEWLINE# cmd = [ os . path . join ( script_path , 'gristle_differ' ) , '-1' , file1 , '-2' , file2 , '-k' , '0' , '-c' , '1' ] #NEWLINE# p = subprocess . Popen ( cmd , stdout = subprocess . PIPE , close_fds = True ) #NEWLINE# p_output = p . communicate ( ) [ 0 ] #NEWLINE# p_recs = p_output [ : ( - 1 ) ] . split ( '\n' ) #NEWLINE# for rec in p_recs : #NEWLINE# #INDENT# fields = rec . split ( ':' ) #NEWLINE# if fields [ 0 ] . strip ( ) . startswith ( 'In file1' ) : #NEWLINE# #INDENT# assert ( fields [ 1 ] . strip ( ) == 'Alaska' ) #NEWLINE# #UNINDENT# if fields [ 0 ] . strip ( ) . startswith ( 'In file2' ) : #NEWLINE# #INDENT# assert ( fields [ 1 ] . strip ( ) == 'Wisconsin' ) #NEWLINE# #UNINDENT# if fields [ 0 ] . strip ( ) . startswith ( 'In both' ) : #NEWLINE# #INDENT# assert ( fields [ 1 ] . strip ( ) == 'Arkansas' ) #NEWLINE# #UNINDENT# #UNINDENT# os . remove ( file1 ) #NEWLINE# os . remove ( cmd )