#NEWLINE# def check( self , original , modified , expected , test_name = 'check' , options = None , cwd = TEMP_DIR , apply_config = False ) : #NEWLINE# #INDENT# 'Modify original to modified, and check that pep8radius turns this\n        into expected.' #NEWLINE# temp_file = os . path . join ( cwd , 'temp.py' ) #NEWLINE# with from_dir ( cwd ) : #NEWLINE# #INDENT# options = parse_args ( options , apply_config = apply_config ) #NEWLINE# #UNINDENT# options . no_color = True #NEWLINE# with open ( temp_file , 'w' ) as f : #NEWLINE# #INDENT# f . write ( original ) #NEWLINE# #UNINDENT# committed = self . successfully_commit_files ( [ temp_file ] , commit = test_name ) #NEWLINE# with open ( temp_file , 'w' ) as f : #NEWLINE# #INDENT# f . write ( modified ) #NEWLINE# #UNINDENT# options . verbose = 1 #NEWLINE# r = Radius ( vc = self . vc , options = options , cwd = cwd ) #NEWLINE# with captured_output ( ) as ( out , err ) : #NEWLINE# #INDENT# r . fix ( ) #NEWLINE# #UNINDENT# self . assertIn ( 'would fix' , out . getvalue ( ) ) #NEWLINE# self . assertNotIn ( '@@' , out . getvalue ( ) ) #NEWLINE# options . verbose = 0 #NEWLINE# options . diff = True #NEWLINE# r = Radius ( vc = self . vc , options = options , cwd = cwd ) #NEWLINE# with captured_output ( ) as ( out , err ) : #NEWLINE# #INDENT# r . fix ( ) #NEWLINE# #UNINDENT# exp_diff = get_diff ( modified , expected , temp_file ) #NEWLINE# self . assert_equal ( out . getvalue ( ) , exp_diff , test_name ) #NEWLINE# options . diff = False #NEWLINE# options . in_place = True #NEWLINE# r = Radius ( vc = self . vc , options = options , cwd = cwd ) #NEWLINE# r . fix ( ) #NEWLINE# with open ( temp_file , 'r' ) as f : #NEWLINE# #INDENT# result = f . read ( ) #NEWLINE# #UNINDENT# self . assert_equal ( result , expected , test_name ) #NEWLINE# out = pep8radius_main ( options , vc = self . vc , cwd = cwd ) #NEWLINE# self . assertEqual ( out , '' ) #NEWLINE# with open ( temp_file , 'r' ) as f : #NEWLINE# #INDENT# result = f . read ( ) #NEWLINE# #UNINDENT# self . assert_equal ( result , expected , test_name )