%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_dummy_thread.pyo

ó
Nêáac@sÉdZddladdlZddlZddlZddlZddlmZda	dej
fd„ƒYZdej
fd„ƒYZd	ej
fd
„ƒYZ
dd„ZedkrÅeƒndS(
sÕGeneric thread tests.

Meant to be used by dummy_thread and thread.  To allow for different modules
to be used, test_main() can be called with the module to use as the thread
implementation as its sole argument.

iÿÿÿÿN(ttest_supportit	LockTestscBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„ZRS(
sTest lock objects.cCstjƒ|_dS(N(t_threadt
allocate_locktlock(tself((s2/usr/local/lib/python2.7/test/test_dummy_thread.pytsetUpscCs|j|jjƒdƒdS(Ns(Lock object is not initialized unlocked.(tassertFalseRtlocked(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt
test_initlockscCs7|jjƒ|jjƒ|j|jjƒdƒdS(Ns%Lock object did not release properly.(RtacquiretreleaseRR(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_releases

cCs|jtj|jjƒdS(N(tassertRaisesRterrorRR(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_improper_release%scCs |j|jjdƒdƒdS(Nis)Conditional acquiring of the lock failed.(t
assertTrueRR
(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_cond_acquire_success)scCs0|jjdƒ|j|jjdƒdƒdS(Nis=Conditional acquiring of a locked lock incorrectly succeeded.(RR
R(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_cond_acquire_fail.scCs*|jjƒ|j|jjƒdƒdS(NsUncondional locking failed.(RR
RR(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_uncond_acquire_success5s
cCs<|j|jjdƒtdƒ|j|jjƒtƒdS(Nis*Unconditional locking did not return True.(tassertIsRR
tTrue(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_uncond_acquire_return_val;scCs¢d„}|jjƒttjƒƒ}tj||jtfƒtjrWHdtGHn|jjƒttjƒƒ}tjr‡dGHn|j	||tdƒdS(NcSstj|ƒ|jƒdS(s:Hold on to lock for a set amount of time before unlocking.N(ttimetsleepR(t	to_unlocktdelay((s2/usr/local/lib/python2.7/test/test_dummy_thread.pytdelay_unlockCs
s@*** Waiting for thread to release the lock (approx. %s sec.) ***tdones+Blocking by unconditional acquiring failed.(
RR
tintRRtstart_new_threadtDELAYRtverbosetassertGreaterEqual(RRt
start_timetend_time((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_uncond_acquire_blockingAs	
		
	(t__name__t
__module__t__doc__RR	RRRRRRR$(((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyRs								t	MiscTestscBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sMiscellaneous tests.cCs|jttjƒdS(N(R
t
SystemExitRtexit(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt	test_exitYscCs6|jtjƒtdƒ|jtjƒddƒdS(Ns*_thread.get_ident() returned a non-integeris_thread.get_ident() returned 0(tassertIsInstanceRt	get_identRtassertNotEqual(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt
test_ident]scCs |jtjƒtjdƒdS(NsR_thread.LockType is not an instance of what is returned by _thread.allocate_lock()(R,RRtLockType(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt
test_LockTypedscCs)d„}|jttj|tƒƒdS(NcSstjƒdS(N(Rtinterrupt_main(((s2/usr/local/lib/python2.7/test/test_dummy_thread.pytcall_interruptms(R
tKeyboardInterruptRRttuple(RR3((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_interrupt_mainjs	cCs|jttjƒdS(N(R
R4RR2(R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_interrupt_in_mainrs(R%R&R'R+R/R1R6R7(((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyR(Vs				tThreadTestscBs eZdZd„Zd„ZRS(sTest thread creation.cCsttd„}tjdƒ}tj||ttfƒ|jƒ}|j|doZ|ddƒtj|tƒi|d6td6td6ƒ|jƒ}|j|do¯|ddƒtj||tfitd6ƒ|jƒ}|j|doù|dd	ƒdS(
NcSs|j||fƒdS(s<Use to test _thread.start_new_thread() passes args properly.N(tput(tqueuetarg1targ2((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt
arg_tester|siis7Argument passing for thread creation using tuple failedR:R;R<s8Argument passing for thread creation using kwargs failedsGArgument passing for thread creation using both tuple and kwargs failed(tFalsetQueueRRRtgetRR5(RR=t
testing_queuetresult((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_arg_passingzs cCsÐd„}d}tj|ƒ}tjr:Hdt|fGHnxNt|ƒD]@}trkttjƒdƒ}nd}tj|||fƒqGWt	j
tƒtjr©dGHn|j|jƒ|d|tfƒdS(NcSs$tj|ƒ|jtjƒƒdS(s@Wait for ``delay`` seconds and then put something into ``queue``N(RRR9RR-(R:R((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt
queue_mark’s
isJ*** Testing multiple thread creation (will take approx. %s to %s sec.) ***iiRs2Not all %s threads executed properly after %s sec.(
R?RR RtxrangetroundtrandomRRRRtassertEqualtqsize(RRDtthread_countRAtcounttlocal_delay((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyttest_multi_creations&			
	(R%R&R'RCRM(((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyR8ws	cCsB|r|adantjr+HdtGHntjtttƒdS(Nis"*** Using %s as _thread module ***(RRRR trun_unittestRR(R8(timported_module((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt	test_main«s		t__main__(R'tdummy_threadRRR?RGtunittestttestRRtTestCaseRR(R8tNoneRPR%(((s2/usr/local/lib/python2.7/test/test_dummy_thread.pyt<module>sD!4


Zerion Mini Shell 1.0