mς %U²Ic@sΓdkZdkZdkZdkZdklZlZlZdZdei fd„ƒYZ d„Z d„Z de fd„ƒYZd eifd „ƒYZd „Zd „Zd „ZeƒdS(N(sverifys TestFailedsverboseit_TriggerThreadcBstZd„Zd„ZRS(NcCs5||_||_tiƒ|_tii|ƒdS(N(tfntselftargst threadingtEventt startedEventtThreadt__init__(RRR((t,/data/zmath/lib/python2.4/test/test_queue.pyRs  cCs.tidƒ|iiƒ|i|iŒdS(Nf0.10000000000000001(ttimetsleepRRtsetRR(R((R truns  (t__name__t __module__RR (((R R s cCs{t||ƒ}|iƒ||Œ}|ii ƒpt d|ƒ‚n|i dƒ|i ƒot d|ƒ‚n|S(Ns,blocking function '%r' appeared not to blocki s,trigger function '%r' appeared to not return( Rt trigger_funct trigger_argstttstartt block_funct block_argstresultRtisSett TestFailedtjointisAlive(RRRRRR((R t_doBlockingTest+s    cCsͺt||ƒ}|iƒz;y||ŒWn|j o ‚nXtd|ƒ‚Wd|i dƒ|i ƒotd|ƒ‚n|i i ƒptdƒ‚nXdS(Nsexpected exception of kind %ri s,trigger function '%r' appeared to not returns(trigger thread ended but event never set( RRRRRRRtexpected_exception_classRRRRR(RRRRRR((R t_doExceptionalBlockingTest:s   tFailingQueueExceptioncBstZRS(N(RR(((R ROst FailingQueuecBs#tZd„Zd„Zd„ZRS(NcGs)t|_t|_tii||ŒdS(N(tFalseRt fail_next_putt fail_next_gettQueueRR(RR((R RSs  cCs3|iot|_td‚ntii||ƒS(NsYou Lose(RR!R RR#t_puttitem(RR%((R R$Ws   cCs0|iot|_td‚ntii|ƒS(NsYou Lose(RR"R RR#t_get(R((R R&\s   (RRRR$R&(((R RRs  cCs„|iƒp td‚nx%ttdƒD]}|i|ƒq+Wt|_y#|idddƒt dƒ‚Wnt j onXt|_y#|idddƒt dƒ‚Wnt j onX|id ƒt |i ƒd ƒt|_y)t |id|ifƒt dƒ‚Wnt j onX|id ƒt|_y5t|id td f|ift ƒt dƒ‚Wnt j onX|id ƒt |i ƒd ƒ|iƒt |i ƒ d ƒ|id ƒt |i ƒd ƒt |id|ifƒxttƒD]}|iƒqWt |iƒdƒ|idƒt|_y|iƒt dƒ‚Wnt j onXt |iƒ dƒt|_y |iddƒt dƒ‚Wnt j onXt |iƒ dƒ|iƒt |iƒdƒt|_y,t|if|idt ƒt dƒ‚Wnt j onXt |iƒ dƒ|iƒt |iƒdƒdS(Ns&Call this function with an empty queueitoopstblockis)The queue didn't fail when it should havettimeoutf0.10000000000000001tlastsQueue should be fulltfulli sQueue should not be fullsQueue should be emptytfirstsQueue should not be emptytempty(sfull(sfull(sempty(tqR-t RuntimeErrortranget QUEUE_SIZEtitputtTrueR!RRtverifyR+RtgetRR"(R.R2((R tFailingQueueTestbsŽ                   cCse|iƒp td‚n|idƒ|idƒt|iƒdjo|iƒdjdƒx9ttdƒD]'}|i|ƒt|iƒ dƒqqWt|i ƒ dƒ|idƒt|i ƒd ƒy#|id d d ƒt d ƒ‚Wnt i j onXy#|id ddƒt dƒ‚Wnt i j onXt |id|ifƒt |id tdf|ifƒxttƒD]}|iƒqWt|iƒdƒy |id d ƒt dƒ‚Wnt ij onXy |iddƒt dƒ‚Wnt ij onXt |if|idƒt |itdf|idƒdS(Ns&Call this function with an empty queueioiήs&Didn't seem to queue the correct data!isQueue should not be emptysQueue should not be fullR*sQueue should be fullR+R(is(Didn't appear to block with a full queueR)f0.01s+Didn't appear to time-out with a full queuei sQueue should be emptys*Didn't appear to block with an empty queues-Didn't appear to time-out with an empty queueR-(sfull(sempty(sempty(R.R-R/R3R5R6R0R1R2R+RR#tFullRR4tEmpty(R.R2((R tSimpleQueueTest³sR    %  " cCsgtitƒ}t|ƒt|ƒto dGHnttƒ}t|ƒt|ƒto dGHndS(Ns!Simple Queue tests seemed to works"Failing Queue tests seemed to work(R#R1R.R:tverboseRR7(R.((R ttestΰs      (R#tsysRR ttest.test_supportR5RR;R1RRRRt ExceptionRRR7R:R<(R=R;R1R5RR:RR#RRR R<RRR7R((R t?s       Q -