ó {G_Tc@sÇddlZddlmZd„Zdefd„ƒYZdefd„ƒYZddd„Z d „Z d „Z d ej fd „ƒYZ d ej fd„ƒYZd„ZedkrÃeƒndS(iÿÿÿÿN(t test_supportc s‡fd†}|S(Ncs|jjˆƒ|S(N(t__dict__tupdate(tfunc(tkwds(s0/usr/local/lib/python2.7/test/test_decorators.pytdecorates((RR((Rs0/usr/local/lib/python2.7/test/test_decorators.pyt funcattrsstMiscDecoratorscBseZed„ƒZRS(cs‡fd†}|S(Ncsˆ|jd<|S(Ntauthor(R(R(tname(s0/usr/local/lib/python2.7/test/test_decorators.pyR s ((R R((R s0/usr/local/lib/python2.7/test/test_decorators.pyR s(t__name__t __module__t staticmethodR(((s0/usr/local/lib/python2.7/test/test_decorators.pyR st DbcheckErrorcBseZd„ZRS(cCs$tj|d||||fƒdS(Ns+dbcheck %r failed (func=%s args=%s kwds=%s)(t Exceptiont__init__(tselftexprstrRtargsR((s0/usr/local/lib/python2.7/test/test_decorators.pyRs (R R R(((s0/usr/local/lib/python2.7/test/test_decorators.pyR scs‡‡‡fd†}|S(s+Decorator to implement debugging assertionscs8tˆdˆjdƒ‰‡‡‡‡‡fd†}|S(Ns dbcheck-%stevalcs7tˆˆˆƒs*tˆˆ||ƒ‚nˆ||ŽS(N(RR (RR(texprRRtglobalstlocals(s0/usr/local/lib/python2.7/test/test_decorators.pytchecks(tcompilet func_name(RR(RRR(RRs0/usr/local/lib/python2.7/test/test_decorators.pyRs((RRRR((RRRs0/usr/local/lib/python2.7/test/test_decorators.pytdbcheckscs‡fd†}|S(s&Decorator to count calls to a functioncs5ˆj‰dˆˆ<‡‡‡fd†}ˆ|_|S(Nicsˆˆcd7<ˆ||ŽS(Ni((RR(tcountsRR(s0/usr/local/lib/python2.7/test/test_decorators.pytcall-s(R(RR(R(RRs0/usr/local/lib/python2.7/test/test_decorators.pyR*s    ((RR((Rs0/usr/local/lib/python2.7/test/test_decorators.pyt countcalls(scs(i‰‡‡fd†}ˆj|_|S(NcsRy ˆ|SWn?tk r6ˆ|Œ}|ˆ|<|Stk rMˆ|ŒSXdS(N(tKeyErrort TypeError(Rtres(Rtsaved(s0/usr/local/lib/python2.7/test/test_decorators.pyR8s     (R(RR((RR!s0/usr/local/lib/python2.7/test/test_decorators.pytmemoize6s tTestDecoratorscBsbeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( cCsIdtfd„ƒY}|j|jƒdƒ|j|ƒjƒdƒdS(NtCcBseZed„ƒZRS(cSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pytfooKs(R R R R%(((s0/usr/local/lib/python2.7/test/test_decorators.pyR$Jsi*(tobjectt assertEqualR%(RR$((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_singleIscCs&td„ƒ}|jt|dƒdS(NcSs|S(N((tx((s0/usr/local/lib/python2.7/test/test_decorators.pyt notamethodQsi(R t assertRaisesR(RR*((s0/usr/local/lib/python2.7/test/test_decorators.pyttest_staticmethod_functionPscCsKtƒ}|jdƒd„ƒ}|j|ƒdƒ|j|jdƒdS(NtCleesecSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pyR%Xsi*(RRR'(Rt decoratorsR%((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_dottedVs cCsüd„}d}tdddd ƒ}|||Žd „ƒ}|j|ƒd ƒ|j|j||fƒ|d d ddddƒd„ƒ}|j|ƒdƒ|j|jdtddddƒfƒ|dd ƒd„ƒ}|j|jdifƒdS(Ncs‡‡fd†}|S(Ncst|dˆˆfƒ|S(Ntdbval(tsetattr(R(RR(s0/usr/local/lib/python2.7/test/test_decorators.pyRbs((RRR((RRs0/usr/local/lib/python2.7/test/test_decorators.pytnoteargsastNowtistthettimetoneittwoicSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pytf1isi*tterrytgilliamterictidletjohntcleesecSsdS(NiT((((s0/usr/local/lib/python2.7/test/test_decorators.pytf2nsiTcSsdS(N((((s0/usr/local/lib/python2.7/test/test_decorators.pytf3ts(R3R4R5R6(R:R;(ii(tdictR'R0(RR2RRR9R@RA((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_argforms]s $cCsHtdƒd„ƒ}|j|ddƒdƒ|jt|ddƒdS(Nsargs[1] is not NonecSs||S(N((tatb((s0/usr/local/lib/python2.7/test/test_decorators.pytfysiii(RR'R+R tNone(RRF((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_dbcheckxscCs5i}tt|ƒd„ƒƒ}|j|jdƒ|j|tddƒƒ|j|dƒdƒ|j|ddƒ|j|dƒdƒ|j|ddƒ|j|dƒdƒ|j|ddƒ|j|d gƒd d gƒ|j|ddƒ|j|d gƒd d gƒ|j|ddƒdS( NcSs|dS(Ni((R)((s0/usr/local/lib/python2.7/test/test_decorators.pytdouble‚sRIiiiiiii (R"RR'RRB(RRRI((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_memoizescCsõxJdddgD]9}t|ddƒd|}|jtt|ddƒqW|jttdddƒd „}td dd |ƒ}xjd tfd tfd tfd tfgD]>\}}d|}t|ddƒ}|j|t ||ƒq¯WdS(Ns1+2sx[3]s(1, 2)ttestexprtexecs@%s def f(): passttests@f1 @f2 def f(): passcSs t‚dS(N(tNotImplementedError(R((s0/usr/local/lib/python2.7/test/test_decorators.pytunimp«stnullvalROtundefs nullval.attrs$@%s def f(): pass assert f() is None( RR+t SyntaxErrorRBRGt NameErrorRtAttributeErrorRNR(RRtcodestrROtcontexttexctcode((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_errorsšs        cCsudtfd„ƒY}|j|ƒjƒdƒ|j|jjdƒ|j|jjdƒ|j|jjdƒdS(NR$cBs5eZeddddƒeddƒd„ƒƒZRS(tabcitxyzthahatboohi*cSsdS(Ni*((R((s0/usr/local/lib/python2.7/test/test_decorators.pyR%¹s(R R RR%(((s0/usr/local/lib/python2.7/test/test_decorators.pyR$¸si*iR\(R&R'R%RZR[R](RR$((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_double·s cCsDd„}|dƒ|dƒd„ƒƒ}|j|ƒddƒdS(Ncs‡fd†}|S(s„Decorator factory that returns a decorator that replaces the passed-in function with one that returns the value of 'num'cs ‡fd†S(NcsˆS(N(((tnum(s0/usr/local/lib/python2.7/test/test_decorators.pytÈs((R(R_(s0/usr/local/lib/python2.7/test/test_decorators.pytdecoÇs((R_Ra((R_s0/usr/local/lib/python2.7/test/test_decorators.pytcallnumÄsiicSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pyR%Êss,Application order of decorators is incorrect(R'(RRbR%((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_orderÁs   c sYg‰‡fd†‰dtf‡‡fd†ƒY}t|dddgƒ\}}}ddd d d d d dddddg }g‰|j|jƒ|j|jƒ|j|jƒd„ƒƒƒ}|j|ƒdƒ|jˆ|ƒg‰d„}|j|jƒ|j|jƒ|j|jƒ|ƒƒƒ}|j|ƒdƒ|jˆ|ƒdS(Ncs'ˆjdˆƒ‡‡fd†}|S(Ntmakedeccsˆjdˆƒ|S(Ntcalldec(tappend(R(tactionsttag(s0/usr/local/lib/python2.7/test/test_decorators.pyRâs(Rf(RhR(Rg(Rhs0/usr/local/lib/python2.7/test/test_decorators.pytmake_decoratoràstNameLookupTracercs#eZd„Z‡‡fd†ZRS(cSs ||_dS(N(tindex(RRk((s0/usr/local/lib/python2.7/test/test_decorators.pyRèscs_|dkrdˆ}}n%|dkrAdt|jƒ}}nˆjd||jfƒ|S(NRitevalnametargtevalargss%s%d(tstrRkRf(RtfnametopnameR (RgRi(s0/usr/local/lib/python2.7/test/test_decorators.pyt __getattr__ës   (R R RRr((RgRi(s0/usr/local/lib/python2.7/test/test_decorators.pyRjçs iiit evalname1t evalargs1tmakedec1t evalname2t evalargs2tmakedec2t evalname3t evalargs3tmakedec3tcalldec3tcalldec2tcalldec1cSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pyR%ýsi*cSsdS(Ni*((((s0/usr/local/lib/python2.7/test/test_decorators.pytbars(R&tmapRiRmR'(RRjtc1tc2tc3texpected_actionsR%R((RgRis0/usr/local/lib/python2.7/test/test_decorators.pyttest_eval_orderÐs&!   ! <( R R R(R,R/RCRHRJRYR^RcR…(((s0/usr/local/lib/python2.7/test/test_decorators.pyR#Gs        tTestClassDecoratorscBs#eZd„Zd„Zd„ZRS(cCs<d„}|dtfd„ƒYƒ}|j|jdƒdS(NcSs d|_|S(NtHello(textra(R)((s0/usr/local/lib/python2.7/test/test_decorators.pytplains R$cBseZRS((R R (((s0/usr/local/lib/python2.7/test/test_decorators.pyR$sR‡(R&R'Rˆ(RR‰R$((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_simples cCsKd„}d„}||dtfd„ƒYƒƒ}|j|jdƒdS(NcSs d|_|S(Ni (Rˆ(R)((s0/usr/local/lib/python2.7/test/test_decorators.pyttens cSs|jd7_|S(Ni(Rˆ(R)((s0/usr/local/lib/python2.7/test/test_decorators.pytadd_fivesR$cBseZRS((R R (((s0/usr/local/lib/python2.7/test/test_decorators.pyR$si(R&R'Rˆ(RR‹RŒR$((s0/usr/local/lib/python2.7/test/test_decorators.pyR^s   cCsKd„}d„}||dtfd„ƒYƒƒ}|j|jdƒdS(NcSs d|_|S(Ntfirst(Rˆ(R)((s0/usr/local/lib/python2.7/test/test_decorators.pyt applied_first%s cSs d|_|S(Ntsecond(Rˆ(R)((s0/usr/local/lib/python2.7/test/test_decorators.pytapplied_second(s R$cBseZRS((R R (((s0/usr/local/lib/python2.7/test/test_decorators.pyR$+sR(R&R'Rˆ(RRŽRR$((s0/usr/local/lib/python2.7/test/test_decorators.pyRc$s   (R R RŠR^Rc(((s0/usr/local/lib/python2.7/test/test_decorators.pyR† s  cCstjtƒtjtƒdS(N(Rt run_unittestR#R†(((s0/usr/local/lib/python2.7/test/test_decorators.pyt test_main0s t__main__(tunittestRMRRR&RRR RGRRR"tTestCaseR#R†R’R (((s0/usr/local/lib/python2.7/test/test_decorators.pyts     Æ#