<s> """<STR_LIT>""" <EOL> import unittest <EOL> import sys <EOL> import os <EOL> import os . path <EOL> import re <EOL> from textwrap import dedent <EOL> from lib2to3 import pytree , refactor <EOL> from lib2to3 . pgen2 import driver <EOL> test_dir = os . path . dirname ( __file__ ) <EOL> proj_dir = os . path . normpath ( os . path . join ( test_dir , "<STR_LIT:..>" ) ) <EOL> grammar_path = os . path . join ( test_dir , "<STR_LIT:..>" , "<STR_LIT>" ) <EOL> grammar = driver . load_grammar ( grammar_path ) <EOL> driver = driver . Driver ( grammar , convert = pytree . convert ) <EOL> def parse_string ( string ) : <EOL> return driver . parse_string ( reformat ( string ) , debug = True ) <EOL> def run_all_tests ( test_mod = None , tests = None ) : <EOL> if tests is None : <EOL> tests = unittest . TestLoader ( ) . loadTestsFromModule ( test_mod ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( tests ) <EOL> def reformat ( string ) : <EOL> return dedent ( string ) + u"<STR_LIT>" <EOL> def get_refactorer ( fixer_pkg = "<STR_LIT>" , fixers = None , options = None ) : <EOL> """<STR_LIT>""" <EOL> if fixers is not None : <EOL> fixers = [ fixer_pkg + "<STR_LIT>" + fix for fix in fixers ] <EOL> else : <EOL> fixers = refactor . get_fixers_from_package ( fixer_pkg + "<STR_LIT>" ) <EOL> options = options or { } <EOL> return refactor . RefactoringTool ( fixers , options , explicit = True ) <EOL> def all_project_files ( ) : <EOL> for dirpath , dirnames , filenames in os . walk ( proj_dir ) : <EOL> for filename in filenames : <EOL> if filename . endswith ( "<STR_LIT>" ) : <EOL> yield os . path . join ( dirpath , filename ) <EOL> TestCase = unittest . TestCase </s>
