<s> import autopep8 <EOL> from tests . util import * <EOL> GLOBAL_CONFIG = os . path . join ( TEMP_DIR , '<STR_LIT>' ) <EOL> LOCAL_CONFIG = os . path . join ( TEMP_DIR , '<STR_LIT>' ) <EOL> class TestMain ( TestCase ) : <EOL> def setUp ( self ) : <EOL> remove ( LOCAL_CONFIG ) <EOL> remove ( GLOBAL_CONFIG ) <EOL> def tearDown ( self ) : <EOL> remove ( GLOBAL_CONFIG ) <EOL> remove ( LOCAL_CONFIG ) <EOL> def test_autopep8_args ( self ) : <EOL> import autopep8 <EOL> args = [ '<STR_LIT>' ] <EOL> us = parse_args ( args ) <EOL> them = autopep8 . parse_args ( args ) <EOL> self . assertEqual ( us . select , them . select ) <EOL> self . assertEqual ( us . ignore , them . ignore ) <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> us = parse_args ( args ) <EOL> them = autopep8 . parse_args ( args ) <EOL> self . assertEqual ( us . select , them . select ) <EOL> self . assertEqual ( us . ignore , them . ignore ) <EOL> self . assertEqual ( us . max_line_length , them . max_line_length ) <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> us = parse_args ( args ) <EOL> them = autopep8 . parse_args ( args ) <EOL> self . assertEqual ( us . aggressive , them . aggressive ) <EOL> def test_version_number ( self ) : <EOL> version_ = pep8radius_main ( [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( version_ , version ) <EOL> def test_list_fixes ( self ) : <EOL> fixes = pep8radius_main ( [ '<STR_LIT>' ] ) <EOL> afixes = shell_out ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEqual ( fixes , afixes ) <EOL> def test_no_config ( self ) : <EOL> args_before = parse_args ( apply_config = False , root = TEMP_DIR ) <EOL> self . assertNotIn ( '<STR_LIT>' , args_before . ignore ) <EOL> def test_global_config ( self ) : <EOL> with open ( GLOBAL_CONFIG , mode = '<STR_LIT:w>' ) as f : <EOL> f . write ( "<STR_LIT>" ) <EOL> args_after = parse_args ( [ '<STR_LIT>' % GLOBAL_CONFIG ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertIn ( '<STR_LIT>' , args_after . ignore ) <EOL> args_after = parse_args ( [ '<STR_LIT>' ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertNotIn ( '<STR_LIT>' , args_after . ignore ) <EOL> def test_local_config ( self ) : <EOL> with open ( LOCAL_CONFIG , mode = '<STR_LIT:w>' ) as f : <EOL> f . write ( "<STR_LIT>" ) <EOL> args_after = parse_args ( [ '<STR_LIT>' ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertIn ( '<STR_LIT>' , args_after . ignore ) <EOL> args_after = parse_args ( [ '<STR_LIT>' ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertNotIn ( '<STR_LIT>' , args_after . ignore ) <EOL> def test_local_and_global_config ( self ) : <EOL> with open ( GLOBAL_CONFIG , mode = '<STR_LIT:w>' ) as f : <EOL> f . write ( "<STR_LIT>" ) <EOL> with open ( LOCAL_CONFIG , mode = '<STR_LIT:w>' ) as f : <EOL> f . write ( "<STR_LIT>" ) <EOL> args_after = parse_args ( [ '<STR_LIT>' % GLOBAL_CONFIG ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertEqual ( <NUM_LIT:3> , args_after . indent_size ) <EOL> args_after = parse_args ( [ '<STR_LIT>' % GLOBAL_CONFIG , <EOL> '<STR_LIT>' ] , <EOL> apply_config = True , root = TEMP_DIR ) <EOL> self . assertEqual ( <NUM_LIT:2> , args_after . indent_size ) <EOL> def test_help ( self ) : <EOL> self . check_help ( ) <EOL> def test_help_outside_project ( self ) : <EOL> home = os . path . expanduser ( '<STR_LIT>' ) <EOL> try : <EOL> VersionControl . which ( cwd = home ) <EOL> raise SkipTest ( "<STR_LIT>" ) <EOL> except NotImplementedError : <EOL> pass <EOL> self . check_help ( cwd = home ) <EOL> def check_help ( self , cwd = TEMP_DIR ) : <EOL> help_message = pep8radius_main ( [ '<STR_LIT>' ] , cwd = cwd ) <EOL> self . assertIn ( "<STR_LIT>" , help_message ) <EOL> self . assertIn ( "<STR_LIT>" , help_message ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_main ( ) </s>
