B /g^x@sfddlmZmZddlZddlZddlTGdddejZGdddejZdd Ze d krbedS) ) run_unittestcheck_syntax_errorN)*c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS) TokenTestscCs(d}||ddd}||dddS)Nzbackslash for line continuationrzbackslash ending comment) assertEquals)selfxr ;/usr/lib64/python3.7/lib2to3/tests/data/py3_test_grammar.py testBackslashszTokenTests.testBackslashc Csr|tdtd|dd|dd|dd|dd|ttdddlm}|dkr|dd|ddk|ddk|ddkxd D]4}y t|}Wqtk r| d |YqXqWn|d kr`|d d |d dk|d dk|ddkxPdD]8}y t|}Wn$tk rV| d |YnXq"Wn| d|dS)Nri Z0x)maxsizeil)Z 2147483648Z 0o40000000000Z 0x100000000Z"0b10000000000000000000000000000000z(OverflowError on huge integer literal %rllll)Z9223372036854775808Z0o2000000000000000000000Z0x10000000000000000ZA0b100000000000000000000000000000000000000000000000000000000000000zWeird maxsize value %r) rtype assertRaises SyntaxErrorevalsysrassert_ OverflowErrorfail)rrsr r r r testPlainIntegerss8            zTokenTests.testPlainIntegerscCs$d}d}d}d}d}d}d}d}dS)Nrll?l ~l!]cllr )rr r r r testLongIntegersAszTokenTests.testLongIntegerscCsHd}d}d}d}d}d}d}d}d}d}d}d }d }d }d }d }d }dS)N i[lE#Wi# iw gffffff?@g?@gףp= ?gQ @g BgIae Hg#;7r )rr r r r testUnderscoresInNumbersKs"z#TokenTests.testUnderscoresInNumberscCs0d}d}d}d}d}d}d}d}d}d}d}dS)NgQ @gs@gjt?g Bgt =gWHBgF@r )rr r r r testFloatsaszTokenTests.testFloatscCs*d}d}|t|dko||kd}d}|t|dkoL||koLt|dkd}d}|t|dkoz||kozt|dkd}d}|t|d ko||kd }d }|t|d ko||kd }d }|||d }|||d }|||d }|||d d }d d }|||dS)Nr''""zdoesn't "shrink" does itzdoes "shrink" doesn't itz2 The "quick" brown fox jumps over the 'lazy' dog. zhello \T)rlenordr)rr yr r r testStringLiteralsos6&&     zTokenTests.testStringLiteralscCs$d}||tk|ttddS)N.z.. .)rEllipsisrrr)rr r r r testEllipsisszTokenTests.testEllipsisN) __name__ __module__ __qualname__r rrrrr)r+r r r r rs $ *rc@s<eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMS)N GrammarTestscCs td}dS)Nz 1, 0 or 1)r)rr r r r testEvalInputszGrammarTests.testEvalInputc s dd}||d|didd}dd}||jjd||jjd d d }d d }dd}dd}dd}||d|d|dd|dd||d|d|dd|dddddddddd |d|d|dd|ddd|dddddddddd |dd|ddd|dddd|dddddddddd dzdd} | | d| d | fd!did{d"d#} | d| dd| d|d$did}d%d&} | dd| ddd| d'| d~d(| dd)| dd*didd+d,} | | d| dd| d-| dd.| dd$di| fddd/dd0d1} | d| dd| ddddd2d3}|dd|ddd|dddddd4d5}||d|dd|d6|d |fd!didd7d8}|d|dd|ddddd9d:}|dd|ddd|dddd|d6|dd*didd;d<}||d|dd|ddd|dd=|fddd/dd>d?}|d|dd|ddd|dddd|d6|dd@|dd.d*diddAdB}|dd|ddd|dddd|ddddd|d6|dd@|dd(dCdiytddEdiWntk rYn X|dFdGdH}|dIdJdIdKdLdM}|dddIdN|dddIdOdP|dddIdOdQdIdNdRdS}|dddIdIdOdT|dddIdOdIdUdVdW}||dddgdddXdYdddXf|ttdZ|ttd[t d\d]dW}||j d^t it d_d`dW}||j dDt itd_dadW}||j dDtit d_dbdW}||j dDt iddcdddW}||j dedidddfdgdW}||j dddfddddddhdidW}||j dddddhdddjdkdddddddldmdndodW}||j dddddddldmdndpdq}|t d\drdW}||j d^t idfdsdW}dfdtdW }ddufdvdW }t d\fdwdW }t |dxt |dydS)NcSsdS)Nr r r r r f1z$GrammarTests.testFuncdef..f1r cSsdS)Nr ) one_argumentr r r f2r2z$GrammarTests.testFuncdef..f2cSsdS)Nr )two argumentsr r r f3r2z$GrammarTests.testFuncdef..f3)r3)r5r6cSsdS)Nr )Zone_argr r r a1r2z$GrammarTests.testFuncdef..a1cSsdS)Nr )r5argsr r r a2r2z$GrammarTests.testFuncdef..a2cWsdS)Nr )restr r r v0r2z$GrammarTests.testFuncdef..v0cWsdS)Nr )ar;r r r v1r2z$GrammarTests.testFuncdef..v1cWsdS)Nr )r=br;r r r v2r2z$GrammarTests.testFuncdef..v2r!rrrcSsdS)Nr )r=r r r d01r2z%GrammarTests.testFuncdef..d01)r!r=cSsdS)Nr )r=r?r r r d11r2z%GrammarTests.testFuncdef..d11r?cSsdS)Nr )r=r?cr r r d21r2z%GrammarTests.testFuncdef..d21)r!rrA)rrA)rArIcSsdS)Nr )r=r?r r r d02r2z%GrammarTests.testFuncdef..d02)r!r)r)r=r?cSsdS)Nr )r=r?rIr r r d12r2z%GrammarTests.testFuncdef..d12cSsdS)Nr )r=r?rIdr r r d22r2z%GrammarTests.testFuncdef..d22cWsdS)Nr )r=r;r r r d01vr2z&GrammarTests.testFuncdef..d01v)r!rrArBcWsdS)Nr )r=r?r;r r r d11vr2z&GrammarTests.testFuncdef..d11vcWsdS)Nr )r=r?rIr;r r r d21vr2z&GrammarTests.testFuncdef..d21vcWsdS)Nr )r=r?r;r r r d02v r2z&GrammarTests.testFuncdef..d02v)rrArBcWsdS)Nr )r=r?rIr;r r r d12vr2z&GrammarTests.testFuncdef..d12v)rArBrCcWsdS)Nr )r=r?rIrMr;r r r d22vr2z&GrammarTests.testFuncdef..d22vrMr sfooz/Bytes should not work as keyword argument namescSs|S)Nr )keyr r r pos0key1-r2z*GrammarTests.testFuncdef..pos0key1d)rU)k2cSs ||||fS)Nr )p1p2k1rXr r r pos2key2/r2z*GrammarTests.testFuncdef..pos2key2)r[)r[rX)rXr[c[s|||||fS)Nr )rYrZr[rXZkwargr r r pos2key2dict3r2z.GrammarTests.testFuncdef..pos2key2dict)rXtokwarg1tokwarg2)r_r`rXc_s||fS)Nr )r9kwargsr r r f8sz#GrammarTests.testFuncdef..f)r r()r!rArBzf(1, *(2,3), 4)zf(1, x=2, *(3,4), x=5))returncSsdS)Nr )r r r r rb@r2rc)r cSsdS)Nr )r r r r rbBr2cWsdS)Nr )r r r r rbDr2c[sdS)Nr )r r r r rbFr2)r(cSsdS)Nr )r r(r r r rbHr2r()r?rIcSsdS)Nr )r=r?rIrMr r r rbJr2)r?rIegcWsdS)Nr )r=r?rIrMrdrbrer r r rbLr2r)ij )r?rIrdrehrgkrcc _sdS)Nr ) r=r?rIrMrdrbrjrfrgrerkr r r rbOscSs|S)Nr )r r r r nullUr2z&GrammarTests.testFuncdef..nullcSsdS)Nr )r r r r rbVscsS)Nr r )closurer r rb\r2csS)Nr )r )rmr r rb]r2)rkcsS)Nr )rk)rmr r rb^r2csS)Nr r )rmr r rb_r2z f(*g(1=2))z f(**g(1=2)))r!)r!)r!)r!)r!)r!r)r!r)r!r)r!)r!)r!r)r!r)r!)r!)r!)r!r)r!r)r!)r!r)r!r)r!)r!r)r!r)r!)r )r!)rBrC)rBrC)r!)r__code__ co_varnamesstr TypeErrorrrrrlist__annotations__intfloatr)rr1r4r7r8r:r<r>r@rGrHrJrKrLrNrOrPrQrRrSrTrVr\r^rbrlr )rmr testFuncdefs4                                                    zGrammarTests.testFuncdefcCsdd}||ddd}dd}||dddgdddfddfd d}||ddd d}||dd d ||dd d dt|dt|ddddd}||dd d||dd ddddS)NcSsdS)Nrr r r r r gr2z*GrammarTests.testLambdef..rcSsttS)N)r=rMr r r r rwir2cSsdddDS)NcSsg|] }d|kqS)rr ).0r r r r jsz>GrammarTests.testLambdef....)rArr r r r r rwjr2r!cSs|S)Nr )zr r r rwlr2cSs|S)Nr )r(r r r rwlr2cSs|S)Nr )r r r r rwlr2rcSs |||S)Nr )r r(r{r r r rwnr2rCrArDzlambda x: x = 2zlambda (None,): None)rkcSs |||S)Nr )r r(rkr r r rwsr2rr)r!)r)rr)rl1l2l3l4l5l6r r r testLambdefes   zGrammarTests.testLambdefcCsd}~dd}|dS)Nr!cSs d}~dS)Nr!r )r r r r foo~sz(GrammarTests.testSimpleStmt..foor )rr rr r r testSimpleStmt{szGrammarTests.testSimpleStmtc CsRd}d}d}}}d\}}}d}\}}}\}}}}t|dt|ddS)Nr!)r!rrA)r!r)rArBz x + 1 = 1z a + 1 = b + 2)r) rr r(r{abcr=r?rIxyzr r r testExprStmts   zGrammarTests.testExprStmtcCs,dddg}|\}}}|||f}~~~~~dS)Nr!rrAr )rrr r(r{rr r r testDelStmts    zGrammarTests.testDelStmtcCsdS)Nr )rr r r testPassStmtszGrammarTests.testPassStmtcCs xPqWdS)Nr )rr r r testBreakStmtszGrammarTests.testBreakStmtcCsd}x|rd}qqWd}x(|s@d}y wd}Wqd}YqXqW|dkrT||d}x|srd}zwZWdd}XqZW|dkr||dS)Nr!rrokz&continue failed to continue inside tryz'continue inside try called except blockzfinally block not called)r)rrfmsgr r r testContinueStmts,  zGrammarTests.testContinueStmtcsdfdd }|dS)Nr!rcshd}xD|rH|d7}y$|r*|dkr*|d8}P|d8}wWqYqXqW|dksZ|dkrdddS)Nrr!z1continue then break in try/except in loop broken!)r)Zextra_burning_oilcountZ big_hippo)rr r test_inners  z9GrammarTests.test_break_continue_loop..test_inner)r!rr )rrr )rr test_break_continue_loops z%GrammarTests.test_break_continue_loopcCs*dd}dd}||}t|ddS)NcSsdS)Nr r r r r g1r2z#GrammarTests.testReturn..g1cSsdS)Nr!r r r r r g2r2z#GrammarTests.testReturn..g2zclass foo:return 1)r)rrrr r r r testReturns zGrammarTests.testReturncCst|ddS)Nzclass foo:yield 1)r)rr r r testYieldszGrammarTests.testYieldcCsDy tdWntk r YnXytWntk r>YnXdS)Nz just testing) RuntimeErrorKeyboardInterrupt)rr r r testRaises zGrammarTests.testRaisecCsdddl}ddl}ddl}ddlm}ddlm}ddlm}m}ddlm}m}ddlm}m}dS)Nr)time)pathargv)rrrr)rrrrrr r r testImports  zGrammarTests.testImportcCsdS)Nr )rr r r testGlobalszGrammarTests.testGlobalcsddfdd}dS)NrcsdS)Nr r )r r(r r rbsz$GrammarTests.testNonlocal..fr )rrbr )r r(r testNonlocalszGrammarTests.testNonlocalc Cs>yWn4tk r8}z||jddWdd}~XYnXdS)Nrr)AssertionErrorrr9)rrdr r r testAsserts $zGrammarTests.testAssertcCsdS)Nr )rr r r testIfs zGrammarTests.testIfcCsd}d}||ddS)Nrr)r)rr r r r testWhile&szGrammarTests.testWhilecCsx dD]}qWxdD] \}}}qWGddd}d}x|dD] }||}q>W|dkr`|dg}xd D]\}||qjW||d d d gdS) N)r!rrAr c@s$eZdZddZddZddZdS)z%GrammarTests.testFor..SquarescSs||_g|_dS)N)maxsofar)rrr r r __init__;sz.GrammarTests.testFor..Squares.__init__cSs t|jS)N)r&r)rr r r __len__>r2z-GrammarTests.testFor..Squares.__len__cSsVd|kr|jksntt|j}x$||krJ|j|||d}q(W|j|S)Nrr!)r IndexErrorr&rappend)rrfnr r r __getitem__?s   z1GrammarTests.testFor..Squares.__getitem__N)r,r-r.rrrr r r r Squares:srrrizfor over growing sequence))r!)r)rAr!rrA)rr assertEqual)rrfrgrkrrr resultr r r testFor5s     zGrammarTests.testForc Csy ddWntk r YnXy ddWn^tk rBYnLtk rb}zWdd}~XYn,tk r}zWdd}~XYn YnXy ddWntttfk rYnXy ddWn(tttfk r}zWdd}~XYnXzWdXdS)Nr!r)ZeroDivisionErrorEOFErrorrqr)rrr r r testTryPs2    zGrammarTests.testTrycCsdS)Nr )rr r r testSuitegs zGrammarTests.testSuitecCsdsdrdsdsdrdS)Nr!Fr )rr r r testTestvs  zGrammarTests.testTestcCsddk}ddkrddkrddkr ddkr(ddkr0ddkr8ddkr@ddk rHddkrPddkrXddkrdkrdkrdkrdkrdkrdkrdkrdkrdk rnndS)Nr!r r )rr r r r testComparisonshzGrammarTests.testComparisoncCsd}d}d}dS)Nr!rr )rr r r r testBinaryMaskOpsszGrammarTests.testBinaryMaskOpscCsd}d}d}dS)Nrrr!r )rr r r r testShiftOpsszGrammarTests.testShiftOpscCsd}d}d}d}dS)Nr!rrzr )rr r r r testAdditiveOpsszGrammarTests.testAdditiveOpscCsd}d}d}d}dS)Nr!g?rgr )rr r r r testMultiplicativeOpssz"GrammarTests.testMultiplicativeOpscCsd}d}d}d}d}dS)Nr!rzg?r )rr r r r testUnaryOpss zGrammarTests.testUnaryOpsc Csddl}ddl}|jd}|}|jd}d}|d}|d}|dd}|dd}|dd}|dd}|dd}|dd}|dd}i}d |d <d |d <d |d <d|d<t|}|jddd|t|ddS)NrrZ01234rzrCr!r)r!rA)r!rrB)r!rrAcSst|tr|SdS)Nr ) isinstancetuple)r r r r rwr2z,GrammarTests.testSelectors..)rUz[1, (1,), (1, 2), (1, 2, 3)])rrrmodulesrrsortrrp) rrrrIr r=rrMLr r r testSelectorss,        zGrammarTests.testSelectorscCsd}dpdpd}dpdpdddf}g}dg}dp6dp6dg}dpDdpDdddg}g}i}ddi}ddi}dpjddppdi}ddd}ddd}dddddd d }dh}ddh}ddd h}dddh}|}d }d }dS)Nr!rrAoner5)rr5rBrCrD)rr5threeZfourZfiveZsixrr {r )rr r r r testAtomss,     zGrammarTests.testAtomsc Cs|Gddd}Gddd}Gddd|}Gddd|}Gd d d |||}Gd d d }d d}|Gddd}dS)Nc@s eZdZdS)z$GrammarTests.testClassdef..BN)r,r-r.r r r r Bsrc@s eZdZdS)z%GrammarTests.testClassdef..B2N)r,r-r.r r r r B2src@s eZdZdS)z%GrammarTests.testClassdef..C1N)r,r-r.r r r r C1src@s eZdZdS)z%GrammarTests.testClassdef..C2N)r,r-r.r r r r C2src@s eZdZdS)z$GrammarTests.testClassdef..DN)r,r-r.r r r r Dsrc@s$eZdZddZddZddZdS)z$GrammarTests.testClassdef..CcSsdS)Nr )rr r r meth1r2z*GrammarTests.testClassdef..C.meth1cSsdS)Nr )rargr r r meth2r2z*GrammarTests.testClassdef..C.meth2cSsdS)Nr )rr8r:r r r meth3r2z*GrammarTests.testClassdef..C.meth3N)r,r-r.rrrr r r r CsrcSs|S)Nr )r r r r class_decoratorr2z2GrammarTests.testClassdef..class_decoratorc@s eZdZdS)z$GrammarTests.testClassdef..GN)r,r-r.r r r r Gsrr ) rrrrrrrrrr r r testClassdefszGrammarTests.testClassdefcCs,dddg}|dd|DdddddS)Nr!rrAcSsi|]}|d|qS)r!r )rxrfr r r sz.GrammarTests.testDictcomps..rB)r!rrA)r)rnumsr r r testDictcompss zGrammarTests.testDictcompscsdddddg}dddgd d d g}d d |Ddddgdd |Ddddddgdd |Ddddgfdd |Dddddddddddd d!d"d#d$gfd%d |Dddddddd d!d#d$g d&d tdDdgddgdddgdddd'gddd(d)d*ggd+d,}||d-d-d-gfd.d/}|td0td1d2d3d4g}d5d6d7gd8d9d:d;gfdd?d@gdS)ANr!rrArBrCAppleBananaCoconutz Applez Banana z Coco nut cSsg|] }|qSr )strip)rxrr r r rysz.GrammarTests.testListcomps..z Coco nutcSsg|] }d|qS)rAr )rxr r r r rysrDrricSsg|]}|dkr|qS)rr )rxr r r r ryscsg|]}D] }||fq qSr r )rxrfr)strsr r rys)r!r)r!r)r!r)rr)rr)rr)rAr)rAr)rAr)rBr)rBr)rBr)rCr)rCr)rCrcs(g|] }ddDD] }||fqqS)cSsg|]}d|kr|qS)rr )rxrbr r r rysz9GrammarTests.testListcomps...r )rxrfr)rr r ryscSsg|]}dd|qS)csfddtdDS)Ncsg|] }|qSr r )rxrf)r=r r ryszKGrammarTests.testListcomps.....r!)range)r=r )r=r rwr2z7GrammarTests.testListcomps...r )rxrgr r r rys@cSsdd|DS)NcSs,g|]$}|dkrd|ko"dknqS)rrrAr )rxr r r r ry!szDGrammarTests.testListcomps..test_in_func..r )lr r r test_in_func sz0GrammarTests.testListcomps..test_in_funcFcs,dddDddgddgdd ggdS) NcSs"g|]}dd||dgDqS)cSsg|]}|qSr r )rxr(r r r ry&szTGrammarTests.testListcomps..test_nested_front...r!r )rxr r r r ry&szIGrammarTests.testListcomps..test_nested_front..)r!rArCr!rrArBrCrD)rr )rr r test_nested_front%sz5GrammarTests.testListcomps..test_nested_frontz"[i, s for i in nums for s in strs]z[x if y])r!Boeing)rFord)rA Macdonalds)rAirliner)r|Engine) Cheeseburger)r!r)r!r|)rr|)rArcsDg|]<\}}D].\}}D] \}}||kr||kr||fqqqSr r )rxZsnoZsnameZpnoZpnameZsp_snoZsp_pno)partssuppartr r ry?s  )rr)rr)rr)rr)rrr)rrZspcsrrZ suppliersr r )rrrrr testListcomps sF     .      zGrammarTests.testListcompscsddtdD}|t|ddtdDyt||dWntk rZYnXdy(fddD}t||d Wntk rYnX|td dd Dd dd D|td ddDdddDddtdDddddDD}|t|tddtdD|tddtdDtddtdD|tddtdDtddtdD|tddddtdDDtddtdD|tddddddtdDDDtddtdD|tddd dd!dtdDDDtd"dtdD|td#dd$dd%dtdDDDtd&dtdD|td'dd(dd)dtdDDDd*t|d+t|d,dS)-Ncss |]}ddtdDVqdS)cSsg|]}|qSr r )rxr r r r ryKsz6GrammarTests.testGenexps...rN)r)rxr r r r Ksz+GrammarTests.testGenexps..r!cSsg|]}|qSr r )rxr r r r ryLsz,GrammarTests.testGenexps..rz&should produce StopIteration exceptionc3s|] }VqdS)Nr )rxrM)r=r r rUszshould produce TypeErrorcss |]}dD]}||fVq qdS)abcdNr )rxr r(r r r r[srcSsg|]}dD] }||fq qS)rr )rxr r(r r r ry[scss |]}dD]}||fVq qdS)xyNr )rxr r(r r r r\sZabcSsg|]}dD] }||fq qS)rr )rxr r(r r r ry\scSsg|]}|qSr r )rxr r r r ry^scss|] }|VqdS)Nr )rxr r r r r_scss|] }|VqdS)Nr )rxr(r r r r_scSsg|]}|qSr r )rxr r r r ry`scss|]}|dVqdS)rNr )rxr r r r rbscSsg|] }|dqS)rr )rxr r r r rybscss|]}|dr||VqdS)rNr )rxr r r r rcscSsg|]}|dr||qS)rr )rxr r r r rycscss|] }|VqdS)Nr )rxr r r r rdscss|] }|VqdS)Nr )rxr(r r r rdscSsg|]}|qSr r )rxr r r r rydscss|] }|VqdS)Nr )rxr r r r rescss|] }|VqdS)Nr )rxr(r r r rescss|] }|VqdS)Nr )rxr{r r r rescSsg|]}|qSr r )rxr r r r ryescss|] }|VqdS)Nr )rxr r r r rfscSsg|]}|qSr r )rxr(r r r ryfscss|] }|VqdS)Nr )rxr{r r r rfscSsg|]}|qSr r )rxr r r r ryfscss|] }|VqdS)TNr )rxr r r r rgscss|] }|VqdS)Nr )rxr(r r r rgscss|] }|VqdS)TNr )rxr{r r r rgscSsg|]}|qSr r )rxr r r r rygscss|] }|VqdS)TNr )rxr r r r rhscss|]}dr|VqdS)FNr )rxr(r r r rhscss|] }|VqdS)TNr )rxr{r r r rhsrzfoo(x for x in range(10), 100)zfoo(100, x for x in range(10))) rrnextr StopIterationrqrrsumr)rrer?r )r=r testGenexpsIs8$$"00:DDD2 zGrammarTests.testGenexpscsdddtD}d|tt|dddfddtD}dd|dd tdDt||d d tdDd dd g|td dtdDd dd g|dd dDdddg|tdddDd ddgdS)Nrcss|] }|VqdS)Nr )rxrfr r r rnsz9GrammarTests.testComprehensionSpecials..rCFc3s(|] }rtD]}||fVqqdS)N)r)rxrfrg)tr r r rrsTcSs"g|]}tdD] }||fqqS)rC)r)rxrfrgr r r rytsz:GrammarTests.testComprehensionSpecials..cSs g|]}|dr|dr|qS)rrAr )rxr r r r ryxsr!rEcss"|]}|dr|dr|VqdS)rrANr )rxr r r r ryscSsg|] \}|qSr r )rxr r r r ry|s))rB)rC)rDrBrDcss|] \}|VqdS)Nr )rxr r r r r}s))rE)rF)rrFr)rrr&rr)rrer )rr r testComprehensionSpecialsls $z&GrammarTests.testComprehensionSpecialsc CsGdddt}|WdQRX|}WdQRX| \}}WdQRX||WdQRXWdQRX|}|}WdQRXWdQRX|}|WdQRXWdQRXdS)Nc@seZdZddZddZdS)z1GrammarTests.test_with_statement..managercSsdS)N)r!rr )rr r r __enter__sz;GrammarTests.test_with_statement..manager.__enter__cWsdS)Nr )rr9r r r __exit__sz:GrammarTests.test_with_statement..manager.__exit__N)r,r-r.rrr r r r managersr)object)rrr r(r r r test_with_statements    z GrammarTests.test_with_statementcCsdd}|ddddddfDdg|d dd dd dfDdg|d n|ddd |drx|ddnd d |drd odnd d |drd odnd d |d odnd d|drdp|ddndd|d p|ddn|ddd |dpd n|ddd |dnd d|dr>dnd d |dndd|d ndd |dndd|dndd|drddkndddS)NcSs tt|S)N)printr )rZretr r r _checkevalsz/GrammarTests.testIfElseExpr.._checkevalcSsg|]}|r|qSr r )rxr r r r rysz/GrammarTests.testIfElseExpr..cSsdS)NTr r r r r rwr2z-GrammarTests.testIfElseExpr..cSsdS)NFr r r r r rwr2TcSsg|]}|dr|dqS)Fr )rxr r r r ryscSs |rdSdS)NFTr )r r r r rwr2cSs |rdSdS)NTFr )r r r r rwr2r!rCzcheck 1rzcheck 2rDzcheck 3rrAzcheck 4zcheck 5zcheck 6FrErirBg@)r)rrr r r testIfElseExprs$$$"zGrammarTests.testIfElseExprN))r,r-r.r0rvrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r r/sN 9      #?#r/cCstttdS)N)rrr/r r r r test_mainsr__main__) Z test.supportrrZunittestrZTestCaserr/rr,r r r r  s