mò %U²Ic@sîdkZdkZdkZdklZdfd„ƒYZdefd„ƒYZdeifd„ƒYZdefd „ƒYZ d efd „ƒYZ d „Z d „Z e e ƒZ dd„Zd„Zd„Zedjo eƒndS(N(s test_supportt HookWatchercBs/tZd„Zd„Zdd„Zd„ZRS(NcCsg|_g|_dS(N(tselftframestevents(R((t3/data/zmath/lib/python2.4/test/test_profilehooks.pyt__init__ s cCs?|djp|djp |djo|i||ƒndS(Ntcalltreturnt exception(teventRt add_eventtframe(RR R targ((Rtcallback s'cCsŽ|djotidƒ}ny|ii|ƒ}Wn2tj o&t |iƒ}|ii |ƒnX|i i ||t |ƒfƒdS(sAdd an event to the log.iN(R tNonetsyst _getframeRRtindextframenot ValueErrortlentappendRR tident(RR R R((RR s cCs^t|iiƒttƒg}d|_g}|iD]"}|d|jo ||q5q5~S(sRemove calls to add_event().iN( RRR tim_funct disallowedRRt_[1]Rtitem(RRRR((Rt get_events s (t__name__t __module__RR RR R(((RRs   tProfileSimulatorcBsztZd„Zd„Zd„Zd„Zd„Zd„Zhde<de<d e<d e<d e<d esRRRtc_calltc_returnt c_exception( RRRR R"R$R&R'R!(((RR(s      t TestCaseBasecBstZd„ZRS(NcCsSt||iƒƒ}||jo-|idti|ƒti|ƒfƒndS(Ns'Expected events: %s Received events: %s( tcapture_eventstcallableRt new_watcherRtexpectedR%tpprinttpformat(RR-R/R((Rt check_eventsLs (RRR2(((RR+KstProfileHookTestCasecBs†tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„ZRS(NcCstƒS(N(R(R((RR.TscCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsdS(N((tp((RtfXsiRR(R5Rtf_identRR2(RR6R5((Rt test_simpleWs  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCs dddS(Nii((R4((RR5`siRR(R5RR6RR2(RR6R5((Rttest_exception_s  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsy ddWnnXdS(Nii((R4((RR5hs iRR(R5RR6RR2(RR6R5((Rttest_caught_exceptiongs  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsy ddWnnXdS(Nii((R4((RR5qs iRR(R5RR6RR2(RR6R5((Rttest_caught_nested_exceptionps  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCs dddS(Nii((R4((RR5zsiRR(R5RR6RR2(RR6R5((Rttest_nested_exceptionys  c s‰d„‰‡d†}tˆƒ}t|ƒ}|i|dd|fdd|fdd|fdd|fdd|fdd|fgƒdS(NcCs dddS(Nii((R4((RR5…scs4yˆ|ƒWnyˆ|ƒWq0q0XnXdS(N(R5R4(R4(R5(Rtg‡siRiRi(R5R<RR6tg_identRR2(RR<R=R5R6((R5Rttest_exception_in_except_clause„s     c s}d„‰‡d†}tˆƒ}t|ƒ}|i|dd|fdd|fdd|fdd|fdd|fgƒdS(NcCs dddS(Nii((R4((RR5˜scs#zˆ|ƒWd|idƒXdS(Nsfalling through(R5R4R (R4(R5(RR<šsiRiRsfalling through(R5R<RR6R=RR2(RR<R=R5R6((R5Rttest_exception_propogation—s     cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCs"y ddWnddnXdS(Nii((R4((RR5§s iRR(R5RR6RR2(RR6R5((Rttest_raise_twice¦s  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsy ddWn ‚nXdS(Nii((R4((RR5°s iRR(R5RR6RR2(RR6R5((Rttest_raise_reraise¯s  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCs tƒ‚dS(N(t Exception(R4((RR5¹siRR(R5RR6RR2(RR6R5((Rt test_raise¸s  c sd„‰‡d†‰‡d†‰‡d†‰‡d†}tˆƒ} tˆƒ}tˆƒ}tˆƒ}t|ƒ} |i |dd| fdd|fd d|fd d|fd d| fd d | fd d |fd d |fdd |fdd | fg ƒdS( NcCs dddS(Nii((((RR5Áscs ˆƒdS(N(R5((R5(RR<Ãscs ˆƒdS(N(R<((R<(RthÅscs ˆƒdS(N(RD((RD(RtiÇscs ˆƒdS(N(RE(R4(RE(RtjÉsiRiiiiR( R5R<RDRERFRR6R=th_identti_identtj_identRR2( RR=RGR<R5RERDRFRHR6RI((R<R5RERDRttest_distant_exceptionÀs          c s¡d„‰‡d†}tˆƒ}t|ƒ}|i|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgƒdS(NccsxtdƒD] }|Vq WdS(Ni(trangeRE(RE((RR5Ýs csxˆƒD]}q WdS(N(R5RE(R4RE(R5(RR<às iRiR(R5R<RR6R=RR2(RR<R=R5R6((R5Rttest_generatorÜs     c s¡d„‰‡d†}tˆƒ}t|ƒ}|i|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgƒdS(Nccs%xtdƒD] }|Vq Wt‚dS(Ni(RKREt StopIteration(RE((RR5ós csxˆƒD]}q WdS(N(R5RE(R4RE(R5(RR<÷s iRiR(R5R<RR6R=RR2(RR<R=R5R6((R5Rttest_stop_iterationòs     (RRR.R7R8R9R:R;R>R?R@RARCRJRLRN(((RR3Ss        tProfileSimulatorTestCasecBs5tZd„Zd„Zd„Zd„Zd„ZRS(NcCs t|ƒS(N(RR(R((RR. scCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsdS(N((R4((RR5siRR(R5RR6RR2(RR6R5((RR7 s  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCs dddS(Nii((R4((RR5siRR(R5RR6RR2(RR6R5((Rttest_basic_exceptions  cCsAd„}t|ƒ}|i|dd|fdd|fgƒdS(NcCsy ddWnnXdS(Nii((R4((RR5s iRR(R5RR6RR2(RR6R5((RR9s  c sd„‰‡d†‰‡d†‰‡d†‰‡d†}tˆƒ} tˆƒ}tˆƒ}tˆƒ}t|ƒ} |i |dd| fdd|fd d|fd d|fd d| fd d | fd d |fd d |fdd |fdd | fg ƒdS( NcCs dddS(Nii((((RR5'scs ˆƒdS(N(R5((R5(RR<)scs ˆƒdS(N(R<((R<(RRD+scs ˆƒdS(N(RD((RD(RRE-scs ˆƒdS(N(RE(R4(RE(RRF/siRiiiiR( R5R<RDRERFRR6R=RGRHRIRR2( RR=RGR<R5RERDRFRHR6RI((R<R5RERDRRJ&s          (RRR.R7RPR9RJ(((RRO s     cCs6t|dƒo |i}n |i}|i|ifS(Ntf_code(thasattrtfunctionRQtcodet func_codetco_firstlinenotco_name(RSRT((RRCs  cCsy||ƒWnnXdS(N(R5R4(R5R4((RtprotectKscCsˆytiƒWntj onXtidƒ‚|djo tƒ}nti|iƒt ||ƒtidƒ|i ƒdd!S(Ns(sys.setprofile() did not raise TypeErroriiÿÿÿÿ( Rt setprofilet TypeErrort test_supportt TestFailedR4RRR RXR-R(R-R4((RR,Rs    cCs dk}|it|ƒƒdS(N(R0R,R-(R-R0((Rt show_eventscs cCstittƒdS(N(R[t run_unittestR3RO(((Rt test_mainhs t__main__(R0RtunittestttestR[RRtTestCaseR+R3RORRXt protect_identRR,R]R_R(R[RRXR+R]R3R,RaR0RRR_RORdR((Rt?s     #¶: