B €/g^œã@sèdZddlZddlZddlZddlmZddlmZmZddl m Z ej   e¡Zej  ej  ed¡¡Zej  edd¡Ze  e¡Ze  e¡Zejd=e jeejd Z e jeejd Zd d „Zdd d „Zdd„Zddd„Zdd„Zej Z dS)z Support code for test_*.py fileséN)Údedent)ÚpytreeÚrefactor)Údriverz..z Grammar.txtÚprint)ÚconvertcCstjt|ƒddS)NT)Údebug)rÚ parse_stringÚreformat)Ústring©r ú-/usr/lib64/python3.7/lib2to3/tests/support.pyr sr cCs,|dkrt ¡ |¡}tjdd |¡dS)Né)Ú verbosity)ÚunittestZ TestLoaderZloadTestsFromModuleZTextTestRunnerÚrun)Ztest_modZtestsr r r Ú run_all_testssrcCs t|ƒdS)Nz )r)r r r r r "sr Úlib2to3csB|dk r‡fdd„|Dƒ}nt ˆd¡}|p0i}tj||ddS)a  A convenience function for creating a RefactoringTool for tests. fixers is a list of fixers for the RefactoringTool to use. By default "lib2to3.fixes.*" is used. options is an optional dictionary of options to be passed to the RefactoringTool. Ncsg|]}ˆd|‘qS)z .fixes.fix_r )Ú.0Zfix)Ú fixer_pkgr r ú .sz"get_refactorer..z.fixesT)Zexplicit)rZget_fixers_from_packageZRefactoringTool)rZfixersZoptionsr )rr Úget_refactorer%s rccsFx@t t¡D]2\}}}x&|D]}| d¡rtj ||¡VqWq WdS)Nz.py)ÚosÚwalkÚproj_dirÚendswithÚpathÚjoin)ÚdirpathZdirnamesÚ filenamesÚfilenamer r r Úall_project_files4s  r!)NN)rNN)!Ú__doc__rrZos.pathÚtextwraprrrrZ lib2to3.pgen2rZ pgen2_driverrÚdirnameÚ__file__Ztest_dirÚnormpathrrZ grammar_pathZ load_grammarZgrammarZgrammar_no_print_statementÚkeywordsZDriverrZdriver_no_print_statementr rr rr!ZTestCaser r r r Ús,