%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/lib2to3/tests/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyc

ó
Pêáac@€s`dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZmZmZddlmZddlmZejjejjeƒdƒZejjed	ƒZejjeƒzejd
ƒZWdejjƒXejdƒZdej fd
„ƒYZ!dS(s
Unit tests for refactor.py.
iÿÿÿÿ(twith_statementN(trefactortpygramt
fixer_base(ttokeni(tsupporttdatatfixerstmyfixess
lib2to3.fixestTestRefactoringToolcB€sìeZd„Zd„Zd„Zdedd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„Zd„Zedded
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cC€stjjtƒdS(N(tsystpathtappendt	FIXER_DIR(tself((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytsetUp%scC€stjjƒdS(N(R
Rtpop(R((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttearDown(scC€sJxCt||ƒD]2\}}t||ƒs|jd||ƒqqWdS(Ns%s are not instances of %s(tzipt
isinstancetfail(Rt	instancestclassestinsttcls((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytcheck_instances+scC€stj|||ƒS(N(RtRefactoringTool(RtoptionsRtexplicit((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytrt0scC€sI|jitd6ƒ}|j|jtjƒ|j|jjtjƒdS(Ntprint_function(RtTruetassertIstgrammarRt!python_grammar_no_print_statementtdriver(RR((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_print_function_option3scC€sF|jƒ}|j|jƒ|jitd6ƒ}|j|jƒdS(Ntwrite_unchanged_files(RtassertFalseR%Rt
assertTrue(RR((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyt!test_write_unchanged_files_option9scC€s§dddddg}tjdƒ}tjdtƒ}tjdƒ}|j|g|D]}d|^qUƒ|j||ƒ|j|g|D]}d|^qŒƒdS(	NRtfirsttlasttparrottpreorderRtfix_smyfixes.fix_(Rtget_all_fix_namestFalsetget_fixers_from_packagetassertEqual(Rtcontentstnon_prefixedtprefixedt
full_namestname((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_fixer_loading_helpers?s'	cC€stj}t}|ƒ}|j|dƒ|ƒ|j|dƒ|dƒƒ|j|dƒ|dƒƒ|j|dƒ|dƒƒd}|j||ƒ|dƒƒd	}|j||ƒ|dƒƒd
}|j||ƒ|d ƒƒd}|j||ƒ|d!ƒƒd}|j||ƒ|d"ƒƒd}|j||ƒ|d#ƒƒd$}x$|D]}|j||ƒ|ƒq[Wd}|j||ƒ|d%ƒƒd}|j||ƒ|ƒd}|j||ƒ|d&ƒƒd}|j||ƒ|d'ƒƒd}|j||ƒ|ƒdS((Nts%from __future__ import print_functionRs!from __future__ import generatorst
generatorss*from __future__ import generators, featuretfeatures1from __future__ import generators, print_functions1from __future__ import print_function, generatorss(from __future__ import (print_function,)s3from __future__ import (generators, print_function)s2from __future__ import (generators, nested_scopes)t
nested_scopessGfrom __future__ import generators
from __future__ import print_functiontfromsfrom 4sfrom xsfrom x 5s	from x ims
from x importsfrom x import 4s1'docstring'
from __future__ import print_functions9'docstring'
'somng'
from __future__ import print_functions/# comment
from __future__ import print_functions5# comment
'doc'
from __future__ import print_functions3class x: pass
from __future__ import print_function(R(R9(R9R:(R9R(RR9(R(R9R(R9R;(R9R(R<sfrom 4sfrom xsfrom x 5s	from x ims
from x importsfrom x import 4(R(R(R(Rt_detect_future_featurest	frozensetR1(Rtruntfstemptytinptinvalid((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_detect_future_featuresIsR		



cC€sdtjfd„ƒY}dtjfd„ƒY}dtjfd„ƒY}|igƒ}|igƒ}|igƒ}tj|||gƒ}|jtjjƒ}|j|||gƒ|jt	j
ƒ}	|j|	||gƒx'|jƒD]}
|j|
|gƒqðWdS(NtNoneFixcB€seZRS((t__name__t
__module__(((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyREwstFileInputFixcB€seZdZRS(sfile_input< any * >(RFRGtPATTERN(((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyRHzst	SimpleFixcB€seZdZRS(s'name'(RFRGRI(((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyRJ}s(RtBaseFixRt_get_headnode_dictRRtpython_symbolst
file_inputR1RtNAMEt
itervalues(RRERHRJtno_headt	with_headtsimpletdt	top_fixest
name_fixestfixes((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_get_headnode_dictvscC€sŽddlm}ddlm}ddlm}ddlm}|jƒ}|j	ƒ\}}|j
||gƒ|j
||||gƒdS(Niÿÿÿÿ(tFixFirst(tFixLast(t	FixParrot(tFixPreorder(tmyfixes.fix_firstRYtmyfixes.fix_lastRZtmyfixes.fix_parrotR[tmyfixes.fix_preorderR\Rt
get_fixersR(RRYRZR[R\Rtpretpost((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_fixer_loading‹scC€s^|jt|jddgƒ|jtj|jddgƒ|jtj|jddgƒdS(NRtnot_heretno_fixer_clst	bad_order(tassertRaisestImportErrorRRt
FixerError(R((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_naughty_fixers—scC€sl|jƒ}d}|j|dƒ}|jt|ƒ|ƒd}|j|dƒ}|jt|ƒ|ƒdS(Nsdef parrot(): pass

s<test>sdef f(): pass

(Rtrefactor_stringtassertNotEqualtstrR1(RRtinputttree((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_refactor_stringœsc€sdtjf‡fd†ƒY}g‰|tƒ}tj}tjdƒt_z|jƒWd|t_Xdddtg}|jˆ|ƒdS(NtMyRTc€seZ‡fd†ZRS(c€sˆj||||gƒdS(N(textend(Rtold_texttnew_texttfilenametequal(tresults(s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytprint_outputªs(RFRGRy((Rx(s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyRr¨ssdef parrot(): pass

sdef cheese(): pass

s<stdin>(	RRt_DEFAULT_FIXERSR
tstdintStringIOtrefactor_stdinR/R1(RRrRtsavetexpected((Rxs7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_refactor_stdin¦s	
c€sÿtjddƒ}|jtj|ƒtjˆ|ƒtjj|tjj	ˆƒƒ‰tj
ˆdƒ‡fd†}|ƒ}|jd|d|ƒ}	|r¨||	_n|	j
ˆƒ|j||ƒƒ|sÒdS|	j
ˆtƒ|ƒ}
|j||
ƒ|
S(Ntprefixs2to3-test_refactori¤c€s&tˆdƒ}|jƒSWdQXdS(Ntrb(topentread(tfp(t	test_file(s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyt	read_fileÄsRR(ttempfiletmkdtempt
addCleanuptshutiltrmtreetcopytosRtjointbasenametchmodRt	log_debugt
refactor_fileR1RRm(RR†RRtmock_log_debugtactually_writettmpdirR‡told_contentsRtnew_contents((R†s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytcheck_file_refactoringºs$!	
	cC€s)tjjtdƒ}|j|tƒdS(Nsparrot_example.py(RŽRRR
R™Rz(RR†((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_refactor_file×sc
€sÈtjjtdƒ}g‰‡fd†}|j|ddditd6d|dtƒdtjtj	tjj
|ƒƒ}xEˆD]&}d	|krƒ|j||ƒPqƒqƒW|jd
|ˆfƒdS(Nsparrot_example.pyc€sˆj||ƒdS(N(R(tmsgtargs(tdebug_messages(s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytrecording_log_debugÞsRRR%R”R•sNot writing changes to .*%ssNot writing changess%r not matched in %r((
RŽRRR
R™RR/tretescapetsepRtassertRegexpMatchesR(RR†Ržt
message_regextmessage((Rs7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyt'test_refactor_file_write_unchanged_fileÛs
#
c€sv‡fd†}|ggƒddddddg}dg}|||ƒdtjjdd	ƒg}|||ƒdS(
Nc€sþ‡fd†}tjj}|tj_ˆjƒ}g‰tjddƒ}z`tjtjj	|dƒƒx0|D](}t
tjj	||ƒdƒjƒqqW|j|ƒWd|tj_t
j|ƒXˆjˆg|D]}tjj	||ƒ^q؃dS(Nc€sˆj|ƒdS(N(R(RtfRœ(tgot(s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytmock_refactor_fileñsRs2to3-test_refactorta_dirtwb(RRR“RRˆR‰RŽtmkdirRRRƒtclosetrefactor_dirR‹RŒR1(t	structureRR¨t	save_funcRtdirtfnR(R(R§s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pytcheckðs
&	tnothingshi.pys.dumbs	.after.pys	notpy.npytsappyR©sstuff.py(RŽRR(RR²RpR((Rs7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_refactor_dirïs
		
cC€s&tjjtdƒ}|j|ƒdS(Nsdifferent_encoding.py(RŽRRt
TEST_DATA_DIRR™(RR±((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_file_encodingscC€s(tjjtdƒ}|j|ƒ}dS(Nsfalse_encoding.py(RŽRRR¶R™(RR±R((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_false_file_encodingscC€sAtjjtdƒ}|j|ƒ}|j|jtjƒƒdS(Nsbom.py(	RŽRRR¶R™R't
startswithtcodecstBOM_UTF8(RR±R((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_bomscC€s[tj}dt_z8tjjtdƒ}tjdƒ}|j||ƒWd|t_XdS(Ns
scrlf.pys
lib2to3.fixes(RŽtlinesepRRR¶RR0R™(Rtold_sepR±RW((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_crlf_newliness		cC€s`|jƒ}d}|j|dƒ}|j||ƒd}|j|dƒ}|j||ƒdS(Ns
>>> example()
42
s<test>s&
>>> def parrot():
...      return 43
(Rtrefactor_docstringR1Rm(RRtdoctout((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyttest_refactor_docstring&scC€s‹ddlm}|jddgƒ}|jt|jƒdƒ|jddgƒ}x1|jD]}t||ƒr]Pq]q]W|jdƒdS(Niÿÿÿÿ(tFixExplicitRsmyfixes.fix_explicitiRsexplicit fixer not loaded(tmyfixes.fix_explicitRÄRR1tlent
post_orderRR(RRÄRtfix((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyt
test_explicit7sN(RFRGRRRtNoneRzRR$R(R7RDRXRdRkRqR€t_2TO3_FIXERSRR™RšR¥RµR·R¸R¼R¿RÃRÉ(((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyR	#s2						
	-				
				 				
	("t__doc__t
__future__RR
RŽRºtoperatorRŸR|RˆR‹tunittesttwarningstlib2to3RRRt
lib2to3.pgen2RR8RRRtdirnamet__file__R¶R
RR0RzRRËtTestCaseR	(((s7/usr/local/lib/python2.7/lib2to3/tests/test_refactor.pyt<module>s,!

Zerion Mini Shell 1.0