%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_asyncore.pyo


Nac@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZddlmZyddlZWnek
rdZnXdd,dYZdd-dYZd	d.d
YZdd/dYZd
ZdejfdYZdejfdYZdejfdYZdejfdYZdefdYZ ej!e"edddejfdYZ#dej$fdYZ%dej$fdYZ&d e%fd!YZ'd"ejfd#YZ(d$e(fd%YZ)ej!e"ed&d'd(e(fd)YZ*d*Z+e,d+kre+ndS(0iN(ttest_support(tTESTFNtrun_unittesttunlinktHOST(tStringIOtdummysocketcBs#eZdZdZdZRS(cCs
t|_dS(N(tFalsetclosed(tself((s./usr/local/lib/python2.7/test/test_asyncore.pyt__init__scCs
t|_dS(N(tTrueR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pytclosescCsdS(Ni*((R	((s./usr/local/lib/python2.7/test/test_asyncore.pytfilenos(t__name__t
__module__R
RR
(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs		tdummychannelcBseZdZdZRS(cCst|_dS(N(Rtsocket(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR
!scCs|jjdS(N(RR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR$s(RRR
R(((s./usr/local/lib/python2.7/test/test_asyncore.pyR s	texitingdummycBs,eZdZdZeZeZeZRS(cCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR
(scCstjdS(N(tasyncoretExitNow(R	((s./usr/local/lib/python2.7/test/test_asyncore.pythandle_read_event+s(RRR
Rthandle_write_eventthandle_closethandle_expt_event(((s./usr/local/lib/python2.7/test/test_asyncore.pyR's
		t
crashingdummycBs5eZdZdZeZeZeZdZRS(cCs
t|_dS(N(Rt
error_handled(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR
3scCs
tdS(N(t	Exception(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR6scCs
t|_dS(N(RR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pythandle_error=s(RRR
RRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyR2s		c
Cszy#|jd|j\}}Wntjk
r<nXd}x|dkrtj|ggg\}}}|r|jd}	|j|	jddd|	krPqn|d8}tj	dqFW|j
Wd|j
|jXdS(	Niiii
s
tig{Gz?(tlistentacceptRttimeouttselecttrecvtwritetreplacettimetsleepRtset(
tevttbuftservtconntaddrtntrtwtetdata((s./usr/local/lib/python2.7/test/test_asyncore.pytcapture_serverAs&
!

tHelperFunctionTestscBsYeZdZejeedddZdZdZ	dZ
dZRS(cCst}|jtjtj||jtjtj||jtjtj|t}tj||j|j	t
t}tj||j|j	t
t}tj||j|j	t
dS(N(RtassertRaisesRRtreadR#t
_exceptionRtassertEqualRR(R	ttr1ttr2((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_readwriteexc[s		
	
	
tpollsselect.poll requiredc
CsHd}tjdftjdftjdftjdftjdftjdff}dd	dY}x|D]\}}|}|jt||t	t
j||x-|D]%}|jt||||kqWt}|j
t
jt
j||t}	|j|	jt	t
j|	||j|	jtqnWdS(
NR5texptR#RRttestobjcBs>eZdZdZdZdZdZdZRS(cSs1t|_t|_t|_t|_t|_dS(N(RR5R#RR<R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR
s
				cSs
t|_dS(N(RR5(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscSs
t|_dS(N(RR#(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscSs
t|_dS(N(RR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscSs
t|_dS(N(RR<(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscSs
t|_dS(N(RR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRs(RRR
RRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyR=s					(R5R<R#RR((R!tPOLLINtPOLLPRItPOLLOUTtPOLLERRtPOLLHUPtPOLLNVALR7tgetattrRRt	readwriteRR4RRRR(
R	t
attributestexpectedR=tflagtexpectedattrttobjtattrR8R9((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_readwritexs(	
#		cCs|jtdS(N(tcloseall_checkR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyt
test_closeallscCs|jtdS(N(RMR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_closeall_defaultscCsg}i}xJtdD]<}t}|j||j|jjt|||<qW|rtj}z|t_tj	Wdtj|}t_Xn
tj	||jt
|dx$|D]}|j|jjtqWdS(Ni
i(trangeRtappendR7RRRRt
socket_mapt	close_alltlenR(R	t
usedefaulttlttestmaptitct	socketmap((s./usr/local/lib/python2.7/test/test_asyncore.pyRMs"	
		

cCsytdWn(tj\}}}tj}nX|jd|\\}}}}}	}
|jtjj	|dd|j|d|j|||j|	||j|
d|||fdS(NsI don't like spam!sExpected exceptionistest_asyncore.pyttest_compact_tracebacks
[%s|%s|%s](
Rtsystexc_infoRtcompact_tracebacktfailR7tostpathtsplit(R	treal_ttreal_vtreal_tbR.tftfunctiontlinetttvtinfo((s./usr/local/lib/python2.7/test/test_asyncore.pyR[s
 (RRR:tunittestt
skipUnlessthasattrR!RLRNRORMR[(((s./usr/local/lib/python2.7/test/test_asyncore.pyR3Zs	$<			tDispatcherTestscBsYeZdZdZdZdZdZdZdZdZ	dZ
RS(	cCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pytsetUpscCstjdS(N(RRS(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyttearDownscCs<tj}|j|jt|j|jtdS(N(Rt
dispatcherR7treadableRtwritable(R	td((s./usr/local/lib/python2.7/test/test_asyncore.pyt
test_basicscCs0tj}|jt|dt|dS(Ns<asyncore.dispatcher at %#x>(RRrR7treprtid(R	Ru((s./usr/local/lib/python2.7/test/test_asyncore.pyt	test_reprscCstj}t}tj}d}d}z'|t_|j||j|Wd|t_X|jj}|j|d|d|gdS(NsLovely spam! Wonderful spam!sI don't like spam!slog: %s(	RRrRR\tstderrtlogtgetvaluet
splitlinesR7(R	RutfpRztl1tl2tlines((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_logs			

c	Cstj}t}tj}d}d}d}z:|t_|j|d|j||j|dWd|t_X|jj}d|d|d|g}|j||dS(	Ns#Have you got anything without spam?s.Why can't she have egg bacon spam and sausage?sTHAT'S got spam in it!tEGGStSPAMsEGGS: %ssinfo: %ssSPAM: %s(	RRrRR\tstdouttlog_infoR|R}R7(	R	RuR~RRRtl3RRG((s./usr/local/lib/python2.7/test/test_asyncore.pyt
test_log_infos			

cCstj}d|_t}tj}z?|t_|j|j|j|j	|j
Wd|t_X|jj}dddddg}|j
||dS(Ns*warning: unhandled incoming priority eventswarning: unhandled read eventswarning: unhandled write events warning: unhandled connect eventswarning: unhandled accept event((RRrtignore_log_typesRR\Rthandle_exptthandle_readthandle_writethandle_connectt
handle_acceptR|R}R7(R	RuR~RRRG((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_unhandleds&				




	cCstjtj}|jtdt|dtjdtc}tj	d|j
}|j|tj|jt
|d|jt|djtWdQXdS(Nsdispatcher instancetfootrecordtalwaysii(RRrRtassertRaisesRegexptAttributeErrorRDtwarningstcatch_warningsRtsimplefiltertfamilyR7tAF_INETRTt
assertTruet
issubclasstcategorytDeprecationWarning(R	RuR/R((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_issue_85946s

	cCsftjtj}ttdr@|j|tjtjntjd}|j|dkdS(NtstrerroriR(	Rt	_strerrorterrnotEPERMRnR`R7RR(R	terr((s./usr/local/lib/python2.7/test/test_asyncore.pyt
test_strerrorGs
(RRRpRqRvRyRRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRos								tdispatcherwithsend_noreadcBseZdZdZRS(cCstS(N(R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRsQscCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRTs(RRRsR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRPs	tDispatcherWithSendTestscBsDeZeZdZdZejede	j
dZRS(cCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRpZscCstjdS(N(RRS(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRq]ss!Threading required for this test.c
Csctj}tjtjtj}|jdtj|}t}|||f}tj	dt
d|}|jztj
dd}t}|jtjtj|jt|ftj
d|j||j||jdd}	x-|jr+|	d	kr+tj|	d
8}	qW|j|j|j|dWd|jXdS(Nittargettargsg?s$Suppose there isn't a 16-ton weight?g?s
iiii(t	threadingtEventRRtSOCK_STREAMt
settimeoutRt	bind_portRtThreadR2tstartR%R&Rt
create_sockettconnectRtsendt
out_bufferRR;twaitR7R|tjoin(
R	R(tsocktporttcapRRiR1RuR-((s./usr/local/lib/python2.7/test/test_asyncore.pyt	test_send`s2
	

	





(RRRtusepollRpRqRlRmRRtreap_threadsR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRWs
		tDispatcherWithSendTests_UsePollcBseZeZRS((RRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRstfile_wrappersasyncore.file_wrapper requiredtFileWrapperTestcBsYeZdZdZdZdZejee	dddZ
dZRS(cCs5d|_ttd}|j|jWdQXdS(NsIt's not dead, it's sleeping!R/(RutfileRR#(R	th((s./usr/local/lib/python2.7/test/test_asyncore.pyRps	cCsttdS(N(RR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRqscCstjttj}tj|}tj||j|j||j|j	||j
|jdd|j
|jdd|j|j
t|jddS(Ni
s
It's not deadis, it'si(R`topenRtO_RDONLYRRRtassertNotEqualtfdR
R7R"R5R4tOSError(R	RR/((s./usr/local/lib/python2.7/test/test_asyncore.pyt	test_recvs

cCsd}d}tjttjtjB}tj|}tj||j||j	||j|j
ttj|j
||dS(NsCome again?sI want to buy some cheese.(R`RRtO_WRONLYtO_APPENDRRRR#RR7RR5Ru(R	td1td2RR/((s./usr/local/lib/python2.7/test/test_asyncore.pyRs



tfile_dispatchers!asyncore.file_dispatcher requiredcstjttj}gdtjffdY}||}tj|tjdddtdd|j	dj
|jdS(	NtFileDispatchercseZfdZRS(csj|jddS(Ni(RQR"(R	(R1(s./usr/local/lib/python2.7/test/test_asyncore.pyRs(RRR((R1(s./usr/local/lib/python2.7/test/test_asyncore.pyRsR g{Gz?tuse_polltcountiR(R`RRRRRRtloopRR7RRu(R	RRts((R1s./usr/local/lib/python2.7/test/test_asyncore.pyttest_dispatchers
cCstjttj}tj|}tj|tj|j|jt	|jWdQX|j
|jd|jdS(Ni(R`RRRRRRRR4RR7(R	RRf((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_close_twices
(RRRpRqRRRlRmRnRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs			
	tBaseTestHandlercBsAeZddZdZdZdZdZdZRS(cCs tjj||t|_dS(N(RRrR
RRH(R	R((s./usr/local/lib/python2.7/test/test_asyncore.pyR
scCstddS(Ns'handle_accept not supposed to be called(R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCstddS(Ns(handle_connect not supposed to be called(R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCstddS(Ns%handle_expt not supposed to be called(R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCstddS(Ns&handle_close not supposed to be called(R(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRsN(	RRtNoneR
RRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs				t	TCPServercBsAeZdZeeddZedZdZdZ	RS(sYA server which listens on an address and dispatches the
    connection to a handler.
    icCs]tjj||jtjtj|j|j||f|j	d||_
dS(Ni(RRrR
RRRRtset_reuse_addrtbindRthandler(R	RthostR((s./usr/local/lib/python2.7/test/test_asyncore.pyR
s

cCs|jjd S(Ni(Rtgetsockname(R	((s./usr/local/lib/python2.7/test/test_asyncore.pytaddressscCs0|j}|dk	r,|j|dndS(Ni(RRR(R	tpair((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRs(
RRt__doc__RRR
tpropertyRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs
	t
BaseClientcBseZdZdZRS(cCs4tj||jtjtj|j|dS(N(RR
RRRRR(R	R((s./usr/local/lib/python2.7/test/test_asyncore.pyR
s
cCsdS(N((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRs(RRR
R(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs	tBaseTestAPIcBseZdZddZdZdZdZdZdZe	j
ejj
dd	d
ZdZdZd
ZdZdZe	jedejdZRS(cCstjdS(N(RRS(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRqsicCst|d}d}x\tjrt|dkrttjddddd|j|jrZdS|d8}tj|qW|jddS(	NidiR g{Gz?RiRsflag not set(	tfloatRRRRRRHR%R&R_(R	tinstanceR R((s./usr/local/lib/python2.7/test/test_asyncore.pytloop_waiting_for_flags	
cCs?dtfdY}t}||j}|j|dS(Nt
TestClientcBseZdZRS(cSs
t|_dS(N(RRH(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRs(RRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs(RRRR(R	Rtservertclient((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_connects	cCs?dtfdY}|}t|j}|j|dS(NtTestListenercBseZdZdZRS(cSs]tj||jtjtj|jtdf|jd|jj	d |_
dS(Niii(RR
RRRRRRRRR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR
&s


cSs
t|_dS(N(RRH(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR-s(RRR
R(((s./usr/local/lib/python2.7/test/test_asyncore.pyR$s	(RRRR(R	RRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_accept!s	cCsXdtfdY}dtfdY}t|}||j}|j|dS(NRcBseZdZRS(cSs
t|_dS(N(RRH(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyR8s(RRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyR7stTestHandlercBseZdZRS(cSs%tj|||jdddS(Ntxi(RR
R(R	R+((s./usr/local/lib/python2.7/test/test_asyncore.pyR
<s(RRR
(((s./usr/local/lib/python2.7/test/test_asyncore.pyR;s(RRRRR(R	RRRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_read4s
cCs?dtfdY}t}||j}|j|dS(NRcBseZdZRS(cSs
t|_dS(N(RRH(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRHs(RRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRGs(RRRR(R	RRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_writeDs	cCsXdtfdY}dtfdY}t|}||j}|j|dS(NRcBseZdZdZRS(cSs|jddS(Ni(R"(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRUscSst|_|jdS(N(RRHR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRZs	(RRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRSs	RcBseZdZRS(cSstj|||jdS(N(RR
R(R	R+((s./usr/local/lib/python2.7/test/test_asyncore.pyR
_s(RRR
(((s./usr/local/lib/python2.7/test/test_asyncore.pyR^s(RRRRR(R	RRRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_closeOs
tsunoss OOB support is broken on SolariscCstjdkr(|jr(|jdndtfdY}dtfdY}t|}||j}|j|dS(Ntdarwins(poll may fail on macOS; see issue #28087RcBseZdZRS(cSs
t|_dS(N(RRH(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRrs(RRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRqsRcBseZdZRS(cSs0tj|||jjtdtjdS(Ni(RR
RRtchrtMSG_OOB(R	R+((s./usr/local/lib/python2.7/test/test_asyncore.pyR
vs(RRR
(((s./usr/local/lib/python2.7/test/test_asyncore.pyRus(	R\tplatformRtskipTestRRRRR(R	RRRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_exptgscCs?dtfdY}t}||j}|j|dS(NRcBseZdZdZRS(cSsdddS(Ng?i((R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRscSs4t|_yWntk
r#n
XtddS(Nsexception not raised(RRHtZeroDivisionErrorR(R	((s./usr/local/lib/python2.7/test/test_asyncore.pyRs	
(RRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs	(RRRR(R	RRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_handle_error~s	cCst}t|j}|j|j|j|j|j|jtjddd|j	dd|j|j|j|j|j|j|j|j|j
|j|j|j|j|j|j|j|j|j
|j|j|j|jdS(NR g{Gz?RRid(RRRtassertFalset	connectedRt	acceptingRRRR(R	RR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_connection_attributess$	

cCsXtj}|jtjtj|j|jjtj|j|jjtjdS(N(	RRrRRRRR7Rttype(R	R((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_create_socketscCstj}|jtjtj|jtdf|jd|jj	d}tj}|jtjtj|j
tj|jt|fdS(Niii(RRrRRRRRRRRR4terror(R	ts1Rts2((s./usr/local/lib/python2.7/test/test_asyncore.pyt	test_binds
cCstj}zy|jtjtjdWn!tjk
rOtjdnzXtjtj}|j	|jj
tjtj|jtjtj
|j|j|jj
tjtjWd|jXdS(Nis+SO_REUSEADDR not supported on this platform(Rt
setsockoptt
SOL_SOCKETtSO_REUSEADDRRRltskipRRrRt
getsockoptRRRRRR(R	RR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_set_reuse_addrs

s!Threading required for this test.cCst}tjdd}|jzxtdD]}tjtjtj}|jd|j	tj
tjtj
dddz/y|j|jWntjk
rnXWd|jXq8WWd|jXdS(NRcSstjddddS(NR g?Ri(RR(((s./usr/local/lib/python2.7/test/test_asyncore.pyt<lambda>Rig?tiiii(RRRRtxrangeRRRRRRt	SO_LINGERtstructtpackRRRRR(R	RRiRR((s./usr/local/lib/python2.7/test/test_asyncore.pyttest_quick_connects 	

(RRRqRRRRRRRltskipIfR\Rt
startswithRRRRRRRmRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRs 											tTestAPI_UseSelectcBseZeZRS((RRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRsR;sselect.poll requiredtTestAPI_UsePollcBseZeZRS((RRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyRscCs)tttttttg}t|dS(N(R3RoRRRRRR(ttests((s./usr/local/lib/python2.7/test/test_asyncore.pyt	test_mains	t__main__(((((-RRlR!R`RR\R%RRRttestRttest.test_supportRRRRRRtImportErrorRRRRRR2tTestCaseR3Rotdispatcher_with_sendRRRRmRnRRrRRRRRRRR(((s./usr/local/lib/python2.7/test/test_asyncore.pyt<module>sN"


	k2	=	

Zerion Mini Shell 1.0