ó {G_Tc@sKddlZejjddeƒZddlmZddlZddl Z ddl Z ddl Z ddl m Z ddl m Z dZd efd „ƒYZd e jfd „ƒYZejjejjejjfZd dd„ƒYZd\ZZd\ZZgeedƒeddƒƒD]\ZZ ee f^q$Z!e!de!dd!idd6ZiZd„eedƒeddƒƒDƒZd„edƒDƒZ"dhZ"d Z#d!Z#gZ!ddgZ!e!rÖn eeZZy e$GHWn dZ$n Xe$d7Z$zee7ZWddZXddl%Td„Z&e'dkrGe&ƒndS("iÿÿÿÿNtcompilert deprecated(tflatten(trandom(tStringIOii<tTrivialContextcBseZd„Zd„ZRS(cCs|S(N((tself((s./usr/local/lib/python2.7/test/test_compiler.pyt __enter__ scGsdS(N((Rtexc_info((s./usr/local/lib/python2.7/test/test_compiler.pyt__exit__s(t__name__t __module__RR (((s./usr/local/lib/python2.7/test/test_compiler.pyR s t CompilerTestcBsàeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(c Cs¾tjƒt}tjjtjƒ}tjjtjjƒ}xz|gD]o}xfd D]^}|tjƒkr™tjƒt}tj dIJtj j ƒn|j dƒs®qTnt rÊt ƒdkrÊqTntjj||ƒ}tjjr÷dG|GHnt|dƒ}|jƒ}|jƒd|ks4d|krS|jttj||d ƒqTytj||d ƒWqTtk r±} t| jƒ} | jd |ƒt| ƒ| _‚qTXqTWqGWdS( Ns test_os.pys1 testCompileLibrary still working, be patient...s.pyg\Âõ(\ï?t compilingtUt badsyntaxt bad_codingtexecs in file %s](s test_os.py(ttimet_PRINT_WORKING_MSG_INTERVALtostpathtdirnamet__file__ttestt test_supporttsyst __stdout__tflushtendswithtTEST_ALLRtjointverbosetopentreadtcloset assertRaisest SyntaxErrorRtcompilet Exceptiontlisttargstappendttuple( Rt next_timetlibdirttestdirtdirtbasenameRtftbufteR)((s./usr/local/lib/python2.7/test/test_compiler.pyttestCompileLibrarys<     cCstjdddƒdS(Nsclass foo():pass sR(RR&(R((s./usr/local/lib/python2.7/test/test_compiler.pyttestNewClassSyntax?scCstjdddƒdS(Nsdef g(): yield sR(RR&(R((s./usr/local/lib/python2.7/test/test_compiler.pyt testYieldExprBscsc‡fd†}ejdddƒ}|i|d6UˆjeejdƒˆjeejdƒdS(Ncs.ˆj||fdidd6dd6fƒdS(Niiitxity(ii(t assertEqual(R)tkwargs(R(s./usr/local/lib/python2.7/test/test_compiler.pyR1Fssf(x=1, *(2, 3), y=4)sRR1s foo(a=1, b)sfoo(1, *args, 3)(RR&R$R%tparse(RR1tc((Rs./usr/local/lib/python2.7/test/test_compiler.pyttestKeywordAfterStarargsEs cBsYejdddƒ}i}||U|j|jdƒdƒ|j|jdƒdƒdS(Ns)try: 1//0 except: e = 1 finally: f = 1sRR3iR1(RR&R9tget(RR<tdct((s./usr/local/lib/python2.7/test/test_compiler.pyttestTryExceptFinallyNs   cCs|jttjdƒdS(Nsdef foo(a=1, b): pass(R$R%RR;(R((s./usr/local/lib/python2.7/test/test_compiler.pyttestDefaultArgsWscBsfejdddƒ}|jd|jƒejdddƒ}i}||U|j|djdƒdS(Ns"doc"sRt__doc__sdef f(): "doc"R1tdoc(RR&tassertIntco_namesR9RB(RR<tg((s./usr/local/lib/python2.7/test/test_compiler.pyttestDocstringsZs cCsBt}|jdƒr"|d }ntj|ƒ}|j|ƒdS(Ns.pycs.pyoiÿÿÿÿ(s.pycs.pyo(RRRt parseFilet check_lineno(Rtfilenamettree((s./usr/local/lib/python2.7/test/test_compiler.pyt testLineNobs  cCs;y|j|ƒWn#tk r6|jG|jGH‚nXdS(N(t _check_linenotAssertionErrort __class__tlineno(Rtnode((s./usr/local/lib/python2.7/test/test_compiler.pyRIjs  cCs‰|jtkra|j|jtd|j|jfƒ|j|jdkd|j|jfƒnx!|jƒD]}|j|ƒqnWdS(Nslineno=%s on %si(ROtNOLINENOtassertIsInstanceRPtintt assertTruet getChildNodesRI(RRQtchild((s./usr/local/lib/python2.7/test/test_compiler.pyRMqscCsK|jtddggƒddgƒ|jtddfƒddgƒdS(Nii(i(R9R(R((s./usr/local/lib/python2.7/test/test_compiler.pyt testFlattenzs%cBs@ejdddƒ}i}||U|j|jdƒdƒdS(NsHdef g(): a = 1 def f(): return a + 2 return f() result = g()sRtresulti(RR&R9R>(RR<R?((s./usr/local/lib/python2.7/test/test_compiler.pyttestNestedScope~s   cCs8tjdddƒ}|jt|ƒdd d gƒdS( NsKlist((i,j) for i in range(3) if i < 3 for j in range(4) if j > 2)stevaliiii(ii(ii(ii(RR&R9R[(RR<((s./usr/local/lib/python2.7/test/test_compiler.pyt testGenExpŠs  cCsltjdddƒ}|jt|ƒdddhƒtjdddƒ}|jt|ƒdddhƒdS(Ns {1, 2, 3}sR[iiis {1, 2, 3,}(RR&R9R[(RR<((s./usr/local/lib/python2.7/test/test_compiler.pyttestSetLiteral‘scCs„tjdddƒ}|jt|ƒidd6dd6dd6ƒtjdddƒ}|jt|ƒidd6dd6dd6ƒdS( Ns{1:2, 2:3, 3:4}sR[iiiis{1:2, 2:3, 3:4,}(RR&R9R[(RR<((s./usr/local/lib/python2.7/test/test_compiler.pyttestDictLiteral—s+cCsrtjdddƒ}|jt|ƒdddhƒtjdddƒ}|jt|ƒddddd hƒdS( Ns{x for x in range(1, 4)}sR[iiisE{x * y for x in range(3) if x != 0 for y in range(4) if y != 0}ii(RR&R9R[(RR<((s./usr/local/lib/python2.7/test/test_compiler.pyt testSetComps   cCs}tjdddƒ}|jt|ƒidd6dd6dd6ƒtjdddƒ}|jt|ƒidd 6dd 6ƒdS( Ns{x:x+1 for x in range(1, 4)}sR[iiiisO{(x, y) : y for x in range(2) if x != 0 for y in range(3) if y != 0}(ii(ii(RR&R9R[(RR<((s./usr/local/lib/python2.7/test/test_compiler.pyt testDictComp¦s +  cBsGejdddƒ}ied6}||U|j|jdƒdƒdS(Nsgfrom __future__ import with_statement def f(): with TrivialContext(): return 1 result = f()sRRRYi(RR&RR9R>(RR<R?((s./usr/local/lib/python2.7/test/test_compiler.pyttestWith¯s    cBsGejdddƒ}ied6}||U|j|jdƒdƒdS(Nsmfrom __future__ import with_statement def f(): with TrivialContext() as tc: return 1 result = f()sRRRYi(RR&RR9R>(RR<R?((s./usr/local/lib/python2.7/test/test_compiler.pyt testWithAss¼s    cs|g‰dd ‡fd†ƒY}ejdddƒ}i|d6}||U|j|jdƒdƒ|jˆddgƒdS( NtCtxcs)eZd„Z‡fd†Zd„ZRS(cSs ||_dS(N(tn(RRd((s./usr/local/lib/python2.7/test/test_compiler.pyt__init__Ëscsˆj|jƒdS(N(R*Rd(R(tevents(s./usr/local/lib/python2.7/test/test_compiler.pyRÍscWsdS(N((RR)((s./usr/local/lib/python2.7/test/test_compiler.pyR Ïs(R R ReRR ((Rf(s./usr/local/lib/python2.7/test/test_compiler.pyRcÊs srfrom __future__ import with_statement def f(): with Ctx(1) as tc, Ctx(2) as tc2: return 1 result = f()sRRYii((RR&R9R>(RRcR<R?((Rfs./usr/local/lib/python2.7/test/test_compiler.pyt testWithMultÈs   cBsOejdddƒ}iid6}i}|||U|j|jdƒdƒdS(Ns global x x=1sRt __builtins__R7i(RR&R9R>(Rtcodetd1td2((s./usr/local/lib/python2.7/test/test_compiler.pyt testGlobalÝs   cBsKejdddƒ}ieƒd6}||U|j|djƒdƒdS(NsVfrom __future__ import print_function print("a", "b", sep="**", end="++", file=output)sRtoutputsa**b++(RR&RR9tgetvalue(RR<R?((s./usr/local/lib/python2.7/test/test_compiler.pyttestPrintFunctionås   cCsTyt|ddƒWn9tk rO}|j|j|ƒ|j|j|ƒnXdS(NtR(R&R%R9toffsetttext(RtsrcRrRqR3((s./usr/local/lib/python2.7/test/test_compiler.pyt _testErrEncïs cCsjd}d}d}|j||dƒ|j|||dƒ|j|||dƒ|j||dƒdS(Nsprint 'ƒpƒCƒ\ƒ“', ' sprint '12345678', ' s#! -*- coding: ShiftJIS -*- i(Rt(Rtsjistasciitencdef((s./usr/local/lib/python2.7/test/test_compiler.pyttestSourceCodeEncodingsErrorös(R R R4R5R6R=R@RARGRLRIRMRXRZR\R]R^R_R`RaRbRgRlRoRtRx(((s./usr/local/lib/python2.7/test/test_compiler.pyR s0 ,             tTotocBseZdZRS(t docstring(R R RB(((s./usr/local/lib/python2.7/test/test_compiler.pyRysiiii iitacCsi|]\}}||“qS(((t.0R7R8((s./usr/local/lib/python2.7/test/test_compiler.pys s cCsh|] }|’qS(((R|R7((s./usr/local/lib/python2.7/test/test_compiler.pys s i(t*cCs&tjjdƒatjjtƒdS(Ntcpu(RRtis_resource_enabledRt run_unittestR (((s./usr/local/lib/python2.7/test/test_compiler.pyt test_main7st__main__i,((ii(ii((ii((ttest.test_supportRRt import_moduletTrueRt compiler.astRRRRtunittestRRRtobjectRtTestCaseR tasttModuletStmttDiscardRRRyR{tbR<tdtziptrangeR7R8tltstttyotmathRR (((s./usr/local/lib/python2.7/test/test_compiler.pytsN 0ø!  =  (