python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_wsgiref.cpython-312.pyc

ΑeKuddlmZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZdd	lmZdd
lmZddlmZmZddlmZdd
lmZddlmZmZmZddlm Z ddl!m"Z"ddl#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddlZGddeZ(GddeZ)dZ*dZ+e*dfdZ,dZ-GddeZ.GddeZ/Gdd eZ0Gd!d"eZ1Gd#d$e1Z2Gd%d&eZ3e4d'k(rejjyy)()mock)support)
socket_helper)NoLogRequestHandler)TestCase)setup_testing_defaults)Headers)BaseHandlerBaseCGIHandler
SimpleHandler)util)	validator)
WSGIServerWSGIRequestHandler)make_server)HTTPConnection)StringIOBytesIOBufferedReader)
BaseServer)python_implementationNceZdZdZdZdZy)
MockServerzNon-socket HTTP servercRtj||||jyN)r__init__server_bind)selfserver_addressRequestHandlerClasss   E/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_wsgiref.pyrzMockServer.__init__s!D.2EFc^|j\}}||_||_|jyr)rserver_nameserver_port
setup_environ)rhostports   r!rzMockServer.server_bind!s-((
dr"N)__name__
__module____qualname____doc__rrr"r!rrs r"rceZdZdZdZdZy)MockHandlerzNon-socket HTTP handlercX|j|_|j\|_|_yr)request
connectionrfilewfilers r!setupzMockHandler.setup*s,,!%
DJr"cyrr-r5s r!finishzMockHandler.finish.sr"N)r)r*r+r,r6r8r-r"r!r/r/(s!1
r"r/c|dddgdgS)N200 OKContent-Typez
text/plainDatezMon, 05 Jun 2006 18:49:54 GMT
Hello, world!r-environstart_responses  r!	hello_apprC2s"8%0
r"cr|dddgdj|d|d|dgjdgS)	Nr:r;r=;HTTP_X_TEST_HEADERQUERY_STRING	PATH_INFO
iso-8859-1)joinencoder@s  r!
header_apprL:sX8&1
HH$%w~'>
vlr"sGET / HTTP/1.0

cVtdd|tt}tt	|}t	}t
j}tx}t
_	|j||fd|t
_|j|jfS#|t
_wxYw)NP)	127.0.0.1i")
rrr/rrsysstderrrfinish_requestgetvalue)appdataserverinpoutolderrerrs       r!	run_amockr\Es
Rj+
>F

'C
)C
ZZFz!C#*sCj*<=
<<>3<<>))
sB
B(c|}t||urt|D]}t||k(rt	t|td|#t$rYywxYw)zUtility to compare a generic iterator with an iterable

    This tests the iterator using iter()/next().
    'make_it' must be a function returning a fresh
    iterator to be tested (since this may test the iterator twice).zToo many items from .__next__()N)iterAssertionErrornext
StopIteration)make_itmatchititems    r!compare_generic_iterrfTsn
B8r>!Bx4  !DR>CC

sA	AAcPeZdZd
dZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
y)IntegrationTestsctdztjjdz}|j	|d|zdz|xrdxsdzdzjdy)	N/rz(HTTP/1.0 200 OK
Server: WSGIServer/0.2 zA
Content-Type: text/plain
Date: Mon, 05 Jun 2006 18:49:54 GMT
zContent-Length: 13
rNz
Hello, world!rI)rrQversionsplitassertEqualrK)rrY
has_lengthpyvers    r!check_hellozIntegrationTests.check_helloks{&(3.!!#A&'&(-.066
55
;	=

$VL1	
r"c@t\}}|j|yr)r\rprrYr[s   r!test_plain_helloz!IntegrationTests.test_plain_helloxs;Sr"ctd}tt|\}}|j|jddy)NsmGET /p%61th/?query=test HTTP/1.0
X-Test-Header: Python test 
X-Test-Header: Python test 2
Content-Length: 0

s+Python test,Python test 2;query=test;/path/)r\rLrm
splitlines)rr1rYr[s    r!test_environzIntegrationTests.test_environ|s>
%	Z1SNNR :	
r"cztdddzzdz\}}|j|jddy)NsGET xis HTTP/1.0

rVrs!HTTP/1.0 414 Request-URI Too Long)r\rmrvrrs   r!test_request_lengthz$IntegrationTests.test_request_lengths>'TE\":=M"MNS)!,=	?r"c`ttt\}}|j|dy)NF)rn)r\rrCrprrs   r!test_validated_helloz%IntegrationTests.test_validated_hellos(Yy12S/r"cd}tt|\}}|j|jd|j	|jddy)Nc|dddgS)Nr:r;z
Hello, world!r-r@s  r!bad_appz>IntegrationTests.test_simple_validation_error.<locals>.bad_apps8%BC#$$r";A server error occurred.  Please contact the administrator.z^AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: <class 'tuple'>r\r
assertTrueendswithrmrvrrrYr[s    r!test_simple_validation_errorz-IntegrationTests.test_simple_validation_errorsZ	%Yw/0SJ
		
NNR 
0	
r"c"d}gd}|D]w\}}|j|5t||\}}|j|jd|j	|jd|dddyy#1swYxYw)Ncfd}|S)Nc|dgdgS)Nr<ztext/plain; charset=utf-8r?r-)rArBstatuss  r!rzWIntegrationTests.test_status_validation_errors.<locals>.create_bad_app.<locals>.bad_appsv(U'VW())r"r-)rrs` r!create_bad_appzFIntegrationTests.test_status_validation_errors.<locals>.create_bad_apps
*Nr"))200z4AssertionError: Status must be at least 4 characters)z20X OKz8AssertionError: Status message must begin w/3-digit code)200OKz;AssertionError: Status message must have a space after code)rrr)subTestr\rrrmrv)rrtestsrexc_messagerYr[s       r!test_status_validation_errorsz.IntegrationTests.test_status_validation_errorss	
$)	DFKV,
D$^F%;<SR!  !1"!5{C
D
D	D
D
DsABB	cd}tt|\}}|j|jd|j	|jddy)NcB|dj|ddgdgS)N
wsgi.inputr:rdata)readess  r!rz1IntegrationTests.test_wsgi_input.<locals>.bad_apps(
lO  "
hFGH9r"rrr_rrs    r!test_wsgi_inputz IntegrationTests.test_wsgi_inputsX	Yw/0SJ
		
NNR "2	
r"cJd}tt|\}}|j|jdtj
j
djd}tjd}|dz|z}|jd|zdz|y)Nc|dddgdgS)Nr:rr>zWed, 24 Dec 2008 13:29:32 GMTrr-rs  r!rUz3IntegrationTests.test_bytes_validation.<locals>.apps!
h=9
9r"z"GET / HTTP/1.0" 200 4
rascii/s(HTTP/1.0 200 OK
Server: WSGIServer/0.2 sV
Content-Type: text/plain; charset=utf-8
Date: Wed, 24 Dec 2008 13:29:32 GMT

data)
r\rrrrQrkrlrKrrm)rrUrYr[verpyros       r!test_bytes_validationz&IntegrationTests.test_bytes_validations	Ys^,S%?@Akk!!$++G4#%,,W5T	C+,125	r"cd}tt|d\}}|jdtjddddg|jy)	NcB|dddg|djdgS)Nr:r;rrHlatin1rKrs  r!rUz-IntegrationTests.test_cp1252_url.<locals>.apps1
h.9
kN))(344r"sGET /%80 HTTP/1.0rzsHTTP/1.0 200 OKsContent-Type: text/plains#Date: Wed, 24 Dec 2008 13:29:32 GMTr"s/)r\rrmrANYrv)rrUrYr[s    r!test_cp1252_urlz IntegrationTests.test_cp1252_urlsV	5cN!9;S"+6


NN		r"c	
tjtd	d}Gddtt}ttjd|||jjtjfd}tjtj|}|jtjtj|d
tj	
fd}tj|	}|jj!|j#|j%
tj&d
z
y)Npthread_killc<|dgdtjzgS)Nr:)r
SOCK_MAX_SIZEr@s  r!rUz4IntegrationTests.test_interrupted_write.<locals>.apps 8R(G11122r"ceZdZy)<IntegrationTests.test_interrupted_write.<locals>.WsgiHandlerNr)r*r+r-r"r!WsgiHandlerrr"rr)
handler_classc&jyr)set)signumframeinterrupteds  r!signal_handlerz?IntegrationTests.test_interrupted_write.<locals>.signal_handlers
OOr"cvtj}|jdd|j5}|j	d	t
jjtdrn4t|j	ddd|jy#1swYxYw)NGETrjd)timeout)rrr1getresponsersignalSIGUSR1waitfloatlenclose)httpresponsermain_threadrreceivedrWs  r!
run_clientz;IntegrationTests.test_interrupted_write.<locals>.run_clients!6#8#89DLL$!!#
0x

c" fnn="''a'9
x}}/
0
JJL
0
0sA B//B8)targetr)r
get_attributerrrrrHOST
addCleanupserver_close	threadingEventr	get_identThreadstarthandle_requestrJrmr)rrUrroriginalr
backgroundrrrrrWs       @@@@@r!test_interrupted_writez'IntegrationTests.test_interrupted_writes,,V^D	3	-/A	]//C{S++,oo'	==@

v~~x@))+		$%%Z8
7#8#83#>?r"N)T)r)r*r+rprsrwr{r}rrrrrrr-r"r!rhrhis;

?
0

D*
*./@r"rhcjeZdZdZddZdZdZddZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZy)UtilityTestsc||d}tj||jtj|||j|d||j|d||S)NSCRIPT_NAMErHrHr)r
rrmshift_path_info)rsn_inpi_inpartsn_outpi_outenvs       r!
checkShiftzUtilityTests.checkShift#sd"u5##C(--c248[)&1]+F3
r"Nc`i}tj|t|tr|j	||tn?t|t
r|j	||t
n|j
|||||i}tj||j|||yr)r
r
isinstancerassertIsInstancerrmassertIs)rkeyvaluealtrs     r!checkDefaultzUtilityTests.checkDefault+s##C(eX&!!#c(H5
g
&!!#c(73SXu-3i##C(

c#h$r"cXtj||j|||yr)r
rrm)rrrkws    r!checkCrossDefaultzUtilityTests.checkCrossDefault;s$##B'C'r"cxtj||jtj||yr)r
rrmapplication_uri)rurirs   r!checkAppURIzUtilityTests.checkAppURI?s+##B'--b1#6r"cztj||jtj|||yr)r
rrmrequest_uri)rrqueryrs    r!checkReqURIzUtilityTests.checkReqURICs-##B'))"U3C8r"cB||fd}t|||}|j|jj|D]}|j|jj|j	|j|jjy)Nc@tjt||Sr)r
FileWrapperr)textsizes  r!rbz%UtilityTests.checkFW.<locals>.make_itIs##HTN488r")rfassertFalsefilelikeclosedrr)rrrrcrbrdres       r!checkFWzUtilityTests.checkFWGs4	9	WU+
Y++,	D		
++,

**+r"c|jddddd|jddddd|jddddd|jddddd|jdd	dddy)
NrNrjz/xx/az/x/yz/a/x/yz/x/rr5s r!testSimpleShiftszUtilityTests.testSimpleShiftsYsf3C,4dB/Bc2.VS&$7US&#6r"c|jddddd|jddddd|jdddd	d|jdd
dd	d|jdddd	d|jdd
dd	d|jddddd|jddddd|jddddd|jddddd|jdddddy)Nz/a/bz/../yz..rrrNz//yyz/a/b/yz//y/rjz/./yz/./y/z///./..//y/.//z/y/z///z/a/b/z/.//z/x//rz/a/b/xz/.rr5s r!testNormalizedShiftsz!UtilityTests.testNormalizedShifts`stT:GT2t4sHb9Xs;Xr:h< 0$eDr7B7GR8Xs;dFB7r"cddddddddd	d
ddtfd
tfdfD]\}}|j||y)N)SERVER_NAMErP)SERVER_PORT80)SERVER_PROTOCOLHTTP/1.0)	HTTP_HOSTrP)REQUEST_METHODr)rrN)rHrj)wsgi.versionrr)
wsgi.run_oncer)wsgi.multithreadr)wsgi.multiprocessrrwsgi.errors)wsgi.url_schemer)rrr)rrrs   r!testDefaultszUtilityTests.testDefaultsmsa'!*%$# #$
79%
HJ'&
	)JC 
c%(!	)r"c|jddd|jddd|jddd|jddd	|jdd
d|jdd
d|jdddy)Nrzfoo.barrrhttpsonHTTPS1yesrfoorr443)rr5s r!testCrossDefaultszUtilityTests.testCrossDefaultss{9K0tD0sC0uE0eD}T>}U>r"c|jtjid|jtjddid|jtjddid|jtjddid|jtjddidy)Nrr"r%r rr$r#)rmr
guess_schemer5s r!testGuessSchemezUtilityTests.testGuessSchemes**2.7**GE?;VD**GD>:GD**GE?;WE**GC=97Cr"c6|jd|jdd|jdd|jddd	
|jdd
|jddd|jdd|jdddy)Nhttp://127.0.0.1/http://127.0.0.1/spam/spamrhttp://127.0.0.1/sp%E4m/spämzhttp://spam.example.com:2071/zspam.example.com:20712071)rrzhttp://spam.example.com/zspam.example.comrrP)rrzhttps://127.0.0.1/r r!zhttp://127.0.0.1:8000/8000)rr)rr5s r!testAppURIszUtilityTests.testAppURIss,-0gF2
K8-6		C3*		,,!/A		C-T:1v		r"c|jd|jdd|jdd|jddd	|jd
dd	|jddd	|jd
dd	|jdddd|jdddd|jdddddy)Nr,r-r.r/r0r1zhttp://127.0.0.1/spammity/spamz	/spammityrz http://127.0.0.1/spammity/sp%E4mz"http://127.0.0.1/spammity/spam;hamz	/spam;hamz/http://127.0.0.1/spammity/spam;cookie=1234,5678z/spam;cookie=1234,5678z%http://127.0.0.1/spammity/spam?say=nizsay=ni)rrHrGz'http://127.0.0.1/spammity/spam?s%E4y=nizs%E4y=nir)rr5s r!testReqURIszUtilityTests.testReqURIss,-0gF2
K9#w		8;#z		;=#{		<J#/G		I@#wH		NB#wJ		P91#wH		Nr"c.|jddddgy)Nږxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxxxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz)rr5s r!testFileWrapperzUtilityTests.testFileWrappersXsXh$78r"cdjD][}||j|j|jfD]&}|j	tj|(]djD][}||j|j|jfD]&}|jtj|(]y)NzbConnection Keep-Alive Proxy-Authenticate Proxy-Authorization TE Trailers Transfer-Encoding Upgradez4Accept Cache-Control Date Pragma Trailer Via Warning)rltitleupperlowerrr

is_hop_by_hopr)rhoprs   r!testHopByHopzUtilityTests.testHopByHops
4
%'	9CCIIKciikA
9 2 23 78
9		9
C
%'	:CCIIKciikA
:  !3!3C!89
:	:r"r)r)r)r*r+rrrrrrr	rrr'r*r4r6r<rCr-r"r!rr!sO% (79,$78)&?DN&9
:r"rceZdZdZdZdZy)HeaderTestsc	dg}|jttd|jttgd|jtt|ddd|jt|ddjdg|jt|ddj	dg|jt|ddj||j
t|j|t}|d=d|d<|j|j|j|jfD]^}|j|d|j|d|j|d	|j|d`|j|ddd
|d<|j|d	d
|j|jdd
g|j|jddd
|j|jddd|j|jddd
|j|jddd|j|dd
|j|ddy)
N)rrrrrrr%barFooFOObazwheezoo)rmrr	keysvaluesitemsassertIsNot__contains__getget_all__getitem__rr
setdefault)rtesthms    r!testMappingInterfacez HeaderTests.testMappingInterfaces@{WY+WR[)!,WT!W-.q1a)..03%8a)002SE:a)//148,,.5I
eH%		1==@	'AOOAeH%OOAeH%OOAeH%QuX&		'	
5%(%5%(5)5'2uV,e4uV,f5eF3U;eF3V<5%(5&)r"c:|jttdy)Nr%)assertRaises	TypeErrorr	r5s r!testRequireListzHeaderTests.testRequireLists)We4r"czt}|jt|d|jddd|j|dd|jt|d|jddd	|j|j	ddd
g|jt|dy)Nz
r%rGspam)rJzbar; baz="spam"zfoo: bar; baz="spam"

rH)cheesezbar; cheesez*foo: bar; baz="spam"
Foo: bar; cheese

)r	rmstr
add_headerrSrrWs  r!
testExtraszHeaderTests.testExtrassIQ'	U5V,5#45Q >?	U5-5)

.	0	
Q
	
r"N)r)r*r+rYr]rdr-r"r!rErEs*@5
r"rEcVeZdZdZeejjZdZ	y)ErrorHandlerz/Simple handler subclass for testing BaseHandlerc	t|tj|ttt	|ddy)NT)multithreadmultiprocess)rrrrr)rrs  r!rzErrorHandler.__init__s.r"')WY
B4	
r"N)
r)r*r+r,dictosrArO
os_environrr-r"r!rfrfs#9
bjj&&()J
r"rfceZdZdZdZy)TestHandlerzASimple handler subclass for testing BaseHandler, w/error passthrucrr-r5s r!handle_errorzTestHandler.handle_errors
r"N)r)r*r+r,rpr-r"r!rnrn	s
Kr"rnc^eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZy)HandlerTestsic@dddddd}tjtd|5tdd	
}|jddddD]1}|j	td|z|jd
|z3i}t||jD]\}}||vs|||<|jdd	ddj|jdddddtjd|j|j|y#1swYxYw)Nz/my/homez/my/pathzfr_FR.UTF-8test_script_nametest_server_name)HOMEPATHLANGrrrlYz/override/home)Xrv)rkrhrirun_oncefile_wrapperwsgi_zwsgi.rNrPrFrT)rzrvrrrrrrrrrzwsgi.file_wrapper)r	swap_attrrnr&rmgetattrrArrOupdate	get_stdin
get_stderrr
rassertDictEqual)rrlhandlerattrexpectedrrs       r!testEnvironzHandlerTests.testEnvironsB!.-	



{L*
E	$!C.>?G!!#	$%	>DWWgn=$__Wt^<
>	>x(%**,	&JC(" %
	&	$&"++-"--/""% $!%!%!1!1%
	(	
W__h7Q	$	$sDDctdddi}|jdD]}|j||j y)N)rrr)rr&assertInrA)rrWrs   r!testCGIEnvironzHandlerTests.testCGIEnvironJs=4T"-	A	*CMM#qyy)	*r"ctd}|j|j|jddt}|j|j|jddy)Nr r!rrr)rnr&rmrArcs  r!
testSchemezHandlerTests.testSchemePsY
D
!1??#4#45g>
-*#45f=r"ct}dD]"}|jtt||$|jt|jdy)N)_flushrradd_cgi_varsrV)r
r[NotImplementedErrorr_write)rrWnames   r!testAbstractMethodsz HandlerTests.testAbstractMethodsVsNM
	DD
171T?C	D	
-qxx@r"cd}d}d}d}t}|j||j|jj	djdt}|j||j|jj	djdt}|j||j|jj	dt}|j||j|jj	d	y)
Nc>|dg|djdgSNr:rrIrrs  r!trivial_app1z4HandlerTests.testContentLength.<locals>.trivial_app1as%
hrN'(//=>>r"cH|dg|djdgSrrrs  r!trivial_app2z4HandlerTests.testContentLength.<locals>.trivial_app2es(AhrN1./66|DEIr"c8|dgdjdgS)Nr:uтестzutf-8rrs  r!trivial_app3z4HandlerTests.testContentLength.<locals>.trivial_app3is
hrN.55g>??r"c|ddggS)Nr:)zContent-Length12345r-rs  r!trivial_app4z4HandlerTests.testContentLength.<locals>.trivial_app4ms
h345Ir"z)Status: 200 OK
Content-Length: 4

httprIzStatus: 200 OK

https-Status: 200 OK
Content-Length: 8

тестs)Status: 200 OK
Content-Length: 12345

)rnrunrmstdoutrTrK)rrrrrrWs      r!testContentLengthzHandlerTests.testContentLength^s		?		@	

M	l**,F<(		*
M	l**,F<(	*

M	l**,
0	1
M	l**,
	r"cfd}d}t}|j||j|jj	djd|j|jj	dt}|j||j|jj	d|jt|jfzjd|jz|jd|jj	y)Nc|dggSNr:r-rs  r!
non_error_appz8HandlerTests.testBasicErrorOutput.<locals>.non_error_app
hrNIr"ctd)N This should be caught by handlerr_rs  r!	error_appz4HandlerTests.testBasicErrorOutput.<locals>.error_apps !CDDr"%Status: 200 OK
Content-Length: 0

rIrNz<Status: %s
Content-Type: text/plain
Content-Length: %d

r_)rfrrmrrTrKrRerror_statusr
error_bodyr)rrrrWs    r!testBasicErrorOutputz!HandlerTests.testBasicErrorOutputs		E
N	m**,F<(	*	
**,R0N	i**,nnS%678:@9Mll	
		


&(9(9(;<r"cdfd}t}|j||j|jj	djdz|j
d|jj	y)NSome output has been sentc8|dgtd)Nr:rr)rrMSGs  r!rz4HandlerTests.testErrorAfterOutput.<locals>.error_appsAhrN3 !CDDr"zStatus: 200 OK

rIr_)rfrrmrrTrKrrR)rrrWrs   @r!testErrorAfterOutputz!HandlerTests.testErrorAfterOutputst*	E
N	i**,6,',	.	


&(9(9(;<r"c
d}d}djd}dD]`}|xrd|zxsd}dD]J}d	D]A}t|
}d|_||_||_|j||j
||jjt|
}d|_||_||_|j||d
k(r+|j
|jjd|jtj|||fzjd|jj|||fzjd|jjfDMcy)Nc|dggSrr-rs  r!rz5HandlerTests.testHeaderFormats.<locals>.non_error_apprr"zfHTTP/%s 200 OK\r\nDate: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n%sContent-Length: 0\r\n\r\nrrI)z
FooBar/1.0NzServer: %s
rN)z1.0z1.1)HTTP/0.9rzHTTP/1.1)rFTrr")rKrn
origin_serverhttp_versionserver_softwarerrmrrTrrerc)	rrstdpatshortpatsswswrkprotorWs	         r!testHeaderFormatszHandlerTests.testHeaderFormatssn	

3	
@
&
	&	C/)C/52B'
?E#E:A&+AO%,AN(+A%EE-($$Xahh.?.?.AB#E:A&*AO%,AN(+A%EE-(j((():):)<SAHHfgb\&9%A%A,%O ! 1 1 35$gb\199,G ! 1 1 35#
	r"cd}t}|j||jd|jj	y)Nc|ddgdgS)Nr:rrr-rs  r!rUz'HandlerTests.testBytesData.<locals>.apps
h=
9r"sRStatus: 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 4

data)rnrrmrrT)rrUrWs   r!
testBytesDatazHandlerTests.testBytesDatas@	
M	c


HH	!r"cddidfd}t}|j||jddy)Nclose_calledFrcR|dgGfddt}|S)Nr:ceZdZdZfdZy)HHandlerTests.testCloseOnError.<locals>.error_app.<locals>.CrashyIterablec3*K	dtdw)Nsblahrrr5s r!__iter__zQHandlerTests.testCloseOnError.<locals>.error_app.<locals>.CrashyIterable.__iter__s%
,-OPPscdd<y)NTrr-)rside_effectss r!rzNHandlerTests.testCloseOnError.<locals>.error_app.<locals>.CrashyIterable.closes
37L0r"N)r)r*r+rr)rsr!CrashyIterablersQ8r"r)object)rrrrrs   r!rz0HandlerTests.testCloseOnError.<locals>.error_apps*AhrN3
8
8"##r"T)rfrrm)rrrWrrs   @@r!testCloseOnErrorzHandlerTests.testCloseOnErrorsA&.*		$
N	in5t<r"c4tGfdd}ddi}tt|tj|}d}|jt|5|jtddd|jdy#1swYxYw)NceZdZfdZdZy)4HandlerTests.testPartialWrite.<locals>.PartialWritercF|dd}j|t|S)N)extendr)rbpartialwrittens   r!writez:HandlerTests.testPartialWrite.<locals>.PartialWriter.write
s$BQ%w'7|#r"cyrr-r5s r!flushz:HandlerTests.testPartialWrite.<locals>.PartialWriter.flushsr"N)r)r*r+rr)rsr!
PartialWriterr	s

$

r"rrrzshould not do partial writesssHTTP/1.0 200 OK
Content-Type: text/plain
Date: Mon, 05 Jun 2006 18:49:54 GMT
Content-Length: 13

Hello, world!)
	bytearrayrrrQrRassertWarnsRegexDeprecationWarningrrCrm)rrrArWmsgrs     @r!testPartialWritezHandlerTests.testPartialWrites+		%j1')]_cjj'J,

"
"#5s
;	
EE)	

			sBBcRddi}tttfD]|j5Gfdd}t	}tt
|||}|jt|j|jdddy#1swYxYw)Nrr	exceptionceZdZfdZy)EHandlerTests.testClientConnectionTerminations.<locals>.AbortingWritercrr-)rrrs  r!rzKHandlerTests.testClientConnectionTerminations.<locals>.AbortingWriter.write(s'r"Nr)r*r+rrsr!AbortingWriterr's(r"r)ConnectionAbortedErrorBrokenPipeErrorConnectionResetErrorrrrrrrCrrT)rrArrRrWrs     @r! testClientConnectionTerminationsz-HandlerTests.testClientConnectionTerminationss$j1" 
	4I
	2	
4(("!')^-=vwOi   !23	
4	
4	4
	
4	
4sA&BB&	cGddtGfdd}t}ddi}tt|||}|j	t
|j
d|j|j|j|j|j|j|j|j|jy)NceZdZy)KHandlerTests.testDontResetInternalStateOnException.<locals>.CustomExceptionNrr-r"r!CustomExceptionr2rr"rceZdZfdZy)JHandlerTests.testDontResetInternalStateOnException.<locals>.AbortingWritercrr-)rrrs  r!rzPHandlerTests.testDontResetInternalStateOnException.<locals>.AbortingWriter.write:s	%%r"Nr)rsr!rr9s
&r"rrr)
ValueErrorrrrrrCrrTassertIsNotNoneresultheadersrrA)rrrRrArWrs     @r!%testDontResetInternalStateOnExceptionz2HandlerTests.testDontResetInternalStateOnException1s	j		&	&$j1')^%5vwG	i

'):;	
QXX&QYY'QXX&QYY'r"N)r)r*r+maxDiffrrrrrrrrrrrrrr-r"r!rrrrsLG48l*>A0d=8=)V! =$24$(r"rr__main__)6unittestrrVrtest.supportrtest.test_httpserversrrwsgiref.utilrwsgiref.headersr	wsgiref.handlersr
rrwsgirefr
wsgiref.validaterwsgiref.simple_serverrrrhttp.clientriorrrsocketserverrplatformrrkrrrQrrr/rCrLr\rfrhrrErfrnrrr)mainr-r"r!<module>r
s&5/#GG&@-&00#*		


$
"7*D*u@xu@p`:8`:D5
(5
n

>

,x(8x(v	zHMMOr"