K iȏddlZddlZddlmZddlZddlZddlZddlZddlm Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZmZmZddlmZddlmZmZmZmZmZddlmZddlmZdd l m!Z!dd l"m#Z#m$Z$dd lm%Z%dd l&m'Z'm(Z(m)Z)m*Z*dd l+m,Z,ddl-m.Z.m/Z/m0Z0ddl1m2Z2m3Z3Gdde/Z4Gdde/Z5Gdde/Z6Gdde/Z7Gdde/Z8Gdde/Z9Gdde/Z:Gdde/Z;Gd d!e/Z<Gd"d#e/Z=Gd$d%e/Z>Gd&d'e/Z?Gd(d)e/Z@Gd*d+e/ZAGd,d-e/ZBGd.d/e/ZCGd0d1e'ZDGd2d3ejZFGd4d5ejZGGd6d7ejZHGd8d9ejZIGd:d;ejZJGd<d=ejZKy)>N)closing)BytesIO)utf8 native_str to_unicode)gen) HTTPRequest HTTPResponse _RequestProxy HTTPError HTTPClient) HTTPServer)IOLoop)IOStream)gen_logapp_log)netutil)AsyncHTTPTestCasebind_unused_portgen_test ExpectLog)ignore_deprecation) ApplicationRequestHandlerurl)format_timestamp HTTPHeadersceZdZdZy)HelloWorldHandlerct|jdd}|jdd|jd|zy)Nnameworld Content-Type text/plainz Hello %s!) get_argument set_headerfinish)selfr!s b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/tornado/test/httpclient_test.pygetzHelloWorldHandler.get%s3  1  5 K$&'N__name__ __module__ __qualname__r*r+r)rr$s(r+rceZdZdZy) PostHandlercn|jd|jdd|jdy)Nz Post arg1: arg1z, arg2: arg2)r'r%r(s r)postzPostHandler.post,s/   ($*;*;F*C E r+Nr-r.r/r7r0r+r)r2r2+ r+r2ceZdZdZy) PutHandlercp|jd|j|jjy)Nz Put body: writerequestbodyr6s r)putzPutHandler.put4s$ <  4<<$$%r+N)r-r.r/rAr0r+r)r;r;3&r+r;ceZdZdZy)RedirectHandlerc |jd|j|jdt|jddy)Nzredirects can have bodies toorstatus302)rF)r>redirectr%intr6s r)preparezRedirectHandler.prepare:sB 23   e $S1B1B8U1S-T  r+Nr-r.r/rJr0r+r)rDrD9r9r+rDceZdZdZy)RedirectWithoutLocationHandlercF|jd|jy)N-) set_statusr'r6s r)rJz&RedirectWithoutLocationHandler.prepareBs  r+NrKr0r+r)rMrMAsr+rMc0eZdZejdZy) ChunkHandlerc#K|jd|jtjd|jdyw)Nasdf{Gz?qwer)r>flushrsleepr6s r)r*zChunkHandler.getIs5 6 iio 6sA A N)r-r.r/r coroutiner*r0r+r)rRrRHs]]r+rRceZdZdZy) AuthHandlercT|j|jjdy)N Authorization)r'r?headersr6s r)r*zAuthHandler.getSs DLL((9:r+Nr,r0r+r)r[r[Rs;r+r[ceZdZdZy)CountdownHandlerct|}|dkDr%|j|jd|dz y|jdy)Nr countdownZero)rIrH reverse_urlr>)r(counts r)r*zCountdownHandler.getXs;E  19 MM$**; B C JJv r+Nr,r0r+r)r`r`Wsr+r`ceZdZdZy)EchoPostHandlercN|j|jjyNr=r6s r)r7zEchoPostHandler.postas 4<<$$%r+Nr8r0r+r)rhrh`s&r+rhceZdZdZy)UserAgentHandlercn|j|jjjddy)N User-AgentzUser agent not set)r>r?r^r*r6s r)r*zUserAgentHandler.getfs& 4<<''++L:NOPr+Nr,r0r+r)rlrlesQr+rlceZdZdZdZy)ContentLength304HandlercJ|jd|jddy)N0Content-Length*)rPr&r6s r)r*zContentLength304Handler.getks  ("-r+cyrjr0r6s r)_clear_representation_headersz5ContentLength304Handler._clear_representation_headersos r+N)r-r.r/r*rvr0r+r)rprpjs . r+rpceZdZdZy) PatchHandlercN|j|jjy)z=Return the request payload - so we can check it is being keptNr=r6s r)patchzPatchHandler.patchvs 4<<$$%r+N)r-r.r/rzr0r+r)rxrxurBr+rxcPeZdZejdzZdZexZxZxZxZ xZ xZ xZ Z y)AllMethodsHandler)OTHERc~|jjJ|j|jjyrj)r?methodr>r6s r)rzAllMethodsHandler.method~s.||""... 4<<&&'r+N)r-r.r/rSUPPORTED_METHODSrr*headr7rAdeleteoptionsrzotherr0r+r)r|r|{sD&88:E(BHGCG$GGGfGwGr+r|ceZdZdZy)SetHeaderHandlerct|jd|jjdD]\}}|j ||y)Nkv)zip get_argumentsr? argumentsr&)r(rrs r)r*zSetHeaderHandler.getsF**3/1G1G1LM "DAq OOAq ! "r+Nr,r0r+r)rrs"r+rceZdZddZy)InvalidGzipHandlerNc|jdd|jdddjdtdDdd}tj|j d d z}|j |y) Nr#r$Content-Encodinggzipc3(K|] }d|d yw)z Hello World  Nr0).0is r) z)InvalidGzipHandler.get..sAaS+Asi(#i;F) compresslevel)r&joinrangercompressencoder>)r(textr@s r)r*zInvalidGzipHandler.getsg  5 *F3wwAU4[AA'6J}}T[[]!! $'  r+cd}|jdd|}|j|jd|j|j|y)Nssome patch datarPATCHrr@fetch assertEqualcoder@)r(r@responses r)test_patch_receives_payloadz4HTTPClientCommonTestCase.test_patch_receives_payloadsC!::hwT:B , -r+c|jd}|j|jd|j|jdd|j|jd|j J|jt |j d|jd}|j|jdy) Nrrr#r$ Hello world!rz/hello?name=Bens Hello Ben!)rrrr^r@ request_timerIr(rs r)test_hello_worldz)HTTPClientCommonTestCase.test_hello_worlds::h' , )).9<H 8$$000 X223Q7::/0  6r+cg}|jd|j}|j|dg|j|jy)Nrstreaming_callbackr)rappendr assertFalser@)r(chunksrs r)test_streaming_callbackz0HTTPClientCommonTestCase.test_streaming_callbacksB::h6==:I /!23 'r+c|jddd}|j|jd|j|jdy)NrPOSTzarg1=foo&arg2=barrrsPost arg1: foo, arg2: barrrs r) test_postz"HTTPClientCommonTestCase.test_posts@::gf;N:O , (DEr+c|jd}|j|jdg}|jd|j}|j|ddg|j |jy)Nrasdfqwerrasdfqwer)rrr@rr)r(rrs r) test_chunkedz%HTTPClientCommonTestCase.test_chunkedsf::h'  4::h6==:I '7!34 'r+ct\}}t|5tjfd}t j ||j d|z}|jj|jdjj|jdddy#1swYyxYw)Nc3Kt|}|jd}d|vrjd|jdj dd|j yw)N HTTP/1.requires HTTP/1.xs7HTTP/1.1 200 OK Transfer-Encoding: chunked 1 1 1 2 0   r read_untilskipTestr>replacecloseconnaddressstream request_datar(s r)accept_callbackzDHTTPClientCommonTestCase.test_chunked_close..accept_callbacksl"$%+%6%6{%CC \1MM"56ll  Gw A(A+http://127.0.0.1:%d/s12) rrrrYradd_accept_handlerrrethrowrr@io_loopremove_handlerfilenor(sockportrresps` r)test_chunked_closez+HTTPClientCommonTestCase.test_chunked_closes&' d T] 7 ]]  0  & &t_ =::4t; Ezz#fPTzUZ'$$T&\499=MM$))d6lF-CD  E::c&:1D   S$)) ,   S$)) ,! -&! -F9CE @zz#fPTzU  DII)>? @::c&:1D   S$)) ,   S$)) , -r+c|jdjdd}|j|}|jdt j dz|j y)Nrzhttp://zhttp://me:secret@sBasic s me:secret)get_urlrrrbase64 b64encoder@)r(rrs r)test_credentials_in_urlz0HTTPClientCommonTestCase.test_credentials_in_urlxsOll7#++I7JK::c? V%5%5l%CCX]]Sr+c2d}tjd}|jdd|ddi}|j|jdd |j|j t ||jdd|ddi}|j|jdd |j|j ||jdd|ddid }|j|jdd |j|j |y) Nése9rrr#zapplication/blah)rr@r^rs21foo)rr@r^ user_agent)binasciia2b_hexrrr^r@r)r( unicode_body byte_bodyrs r)test_body_encodingz+HTTPClientCommonTestCase.test_body_encoding}s* $$U+ :: #%78   ))*:;SA \(:;:: #%78   ))*:;SA  2:: #%78   ))*:;SA  2r+ct|jd}|jt|jt|jt|j dt |jt|jt|jt|jt y)Nrr#) rrtyper@bytesr^strrrIrrs r) test_typesz#HTTPClientCommonTestCase.test_typess}::h' hmm,e4 h..~>?E hmm,c2 h445s;r+cr|jddddi}|j|jdd|j|jd|jt |jdt jd |j }|j|jdy) NrFzAccept-Encodingr)decompress_responser^rr"r)modefileobj) rrr^assertNotEqualr@lenrGzipFilebufferread)r(rfs r) test_gzipz"HTTPClientCommonTestCase.test_gzips :: %:KV9T  ))*<=vF HMM;7 X]]+R0 MMsHOO < ;/r+c ttdd5 |jd}|j|jd|j|j ddddddy#t $rYwxYw#1swYyxYw)Nz..*Malformed HTTP message.*unconsumed gzip dataFrrrsHello World 0 )rrrrrr@r rs r)test_invalid_gzipz*HTTPClientCommonTestCase.test_invalid_gzips EPU   ::o6  4  s!35GH       s)A9A A** A63A95A66A99Bcgigfd}fd}jd||jtdjddjdd gy) Nc|jdry|jdrj|y|dk7r7|jdd\}}|j|j <yy)Nz HTTP/1.1 101HTTP/z :rc) startswithrsplitstriplower) header_linerr first_liner^s r)header_callbackzFHTTPClientCommonTestCase.test_header_callback..header_callbacksi%%n5''0!!+.&"((a01%&WWY "'r+cRjddj|y)Nz content-typeztext/html; charset=UTF-8)rr)chunkrr^r(s r)rzIHTTPClientCommonTestCase.test_header_callback..streaming_callbacks'   W^46P Q MM% r+r)r[rrcrzHTTP/[0-9]\.[0-9] 200.* rr)rrrH assertRegex)r(r[rrrZr^s` @@@r)test_header_callbackz-HTTPClientCommonTestCase.test_header_callbacksz  / ! +1  Z!Z8 A(FG '7!34r+ctfd}|jd|jD]*\}}|j||j k(||f,y)NcL|jdryj|y)NrS)rU parse_line)liner^s r)r[zTHTTPClientCommonTestCase.test_header_callback_to_parse_line..header_callbacks w'   t $r+r)r[)rrget_allrrW)r(r[rrr^s @r)"test_header_callback_to_parse_linez;HTTPClientCommonTestCase.test_header_callback_to_parse_linesY - % 8_ =OO% 4DAq OOANQF 3 4r+c#(Ktdd}|jjd|} |j|j d}|j |j d|jy#|jwxYww)NTestDefaultUserAgentF)r6 allow_ipv6T)force_instancedefaultsrsTestDefaultUserAgent)dict http_client __class__rr-rr@r)r(rjclientrs r)test_configure_defaultsz0HTTPClientCommonTestCase.test_configure_defaultsst#9eL!!++4(+S #\\$,,}*EFFH   X]],C D LLNFLLNs+B>A=,B=BBc dD]b}ttfD]Q}|}||d<|jd|}|j|jdd|jd|d|Sdy) N) MyUserAgent MyUserAgentrnrr^rrz response=z, value=z , container=)rkrrrr@)r(value containerr^rs r)test_header_typesz*HTTPClientCommonTestCase.test_header_typessr 5 E"K0  #+(- %zz-zA  II"yy%4  r+ct\}}t|5tjfd}t j || j d|z}|jj|jddjj|j dddy#jj|jwxYw#1swYyxYw)Nc3Kt|}|jd}d|vrjd|jdj dd|j yw)Nrrrs2HTTP/1.1 200 OK X-XSS-Protection: 1; mode=block rrrrs r)rzIHTTPClientCommonTestCase.test_multi_line_headers..accept_callbacksj!$%+%6%6{%CC \1MM"56ll  Gw   rrzX-XSS-Protectionz 1; mode=block) rrrrYrrrrrr^rrrrs` r)test_multi_line_headersz0HTTPClientCommonTestCase.test_multi_line_headerss&' d T] ; ]]  "  & &t_ = ;zz"84"?@   .@!A?S ++DKKM:5 ; ;4 ++DKKM:5 ; ;s$/C. AC )C.+C++C..C7c#K|jj|jdddi}|j|jdj dyw)Nrrubärrsr)rlrr-rr@rrs r)test_header_encodingz-HTTPClientCommonTestCase.test_header_encoding2s\))// LL+ ,x0    (DEsAAc|jd}|j|jd|j|jddy)Nrrrrs42)rrrr^rs r)test_304_with_content_lengthz5HTTPClientCommonTestCase.test_304_with_content_length<sC ::89 , ))*:;TBr+c#K|jj|jd}|j|jdywNrrrlrr-rr@rs r)test_future_interfacez.HTTPClientCommonTestCase.test_future_interfaceEs<))// X0FGG 8sA A c#K|jt5}|jj|j ddddj J|j j J|j|j jd|j|j j jdy#1swYxYwwN /notfound) r r rlrr- exceptionrrr)r(contexts r)test_future_http_errorz/HTTPClientCommonTestCase.test_future_http_errorJs   y ) DW""((k)BC C D  ,,,  ))555 **//5 **3388#>  D DsC-C BC CCc#K|jj|jdd}|j|jdyw)NrF)r r)rlrr-rrrs r)test_future_http_error_no_raisez8HTTPClientCommonTestCase.test_future_http_error_no_raiseSsJ))// LL %50   ,sA Ac#K|jd}|jj|}|j|jj ||j t|jt|jj|j}|j|jdywr) r-rlrrr?rr isinstancer r@)r(rr response2s r) test_reuse_request_from_responsez9HTTPClientCommonTestCase.test_reuse_request_from_responseZs ll8$))//44 ))--s3  8#3#3[AB**001A1ABB  9sCCc#K|jd}t|d}|jj|}|j |j d|j ttf5}t|d}|jj|ddd|jdtjy#1swY/xYww)Nrz 127.0.0.1network_interfacerznot-interface-or-ip) r-r rlrrrr r r r*r?r)r(rr?rrs r)test_bind_source_ipz,HTTPClientCommonTestCase.test_bind_source_ipgsll8$c[A))//88 ,    I6 7 27!#9NOG""((1 1 2 +S1B1B-CD 2 2sA3C5+C .CCCcdD]:}|jd|}|j|jt|<dD];}|jd|d}|j|jt|=|jdd}|j|jd|jddd }|j|jd y) Nr%r'r&rr)rrrr+rr(r}Tr!sOTHER)rrr@r)r(rrs r)test_all_methodsz)HTTPClientCommonTestCase.test_all_methodsss2 :Fzz.z@H   X]]DL 9 :/ :Fzz.czJH   X]]DL 9 :::nV:< ,:: 7d  1r+c~dD]}|jt5}|jd|dddd|jdt j |jd|d}|j |jddD]}|jt5}|jd|d d ddd|jd t j |d k7sa|jd|d dd |j jdy#1swYxYw#1swYuxYw)NrrT)rr zmust not be Noner!rrr)rr@r z must be Noner%)rr@r"r )r r rr*r?rrr)r(rrrs r)test_body_sanity_checksz0HTTPClientCommonTestCase.test_body_sanity_checkss@. -F"":. L' >&d K L MM,c'2C2C.D E::vD   TYY , -3 1F"":. ' "6T  MM.#g.?.?*@ A "! .2 $   C0# 1 L L  sD')D3'D0 3D< c|jddd}|j|j|jdy)Nz/redirect?status=307&url=/putrshellorr)rrrr@rs r) test_put_307z%HTTPClientCommonTestCase.test_put_307s?:: +E   (:;r+c|jd}|j|j|jdt dy)Nz/set_header?k=foo&v=%E9rr2)rrrr^rrs r)test_non_ascii_headerz.HTTPClientCommonTestCase.test_non_ascii_headers=::78 ))%0*X2FGr+cbtj}|jd}|j|j|j|jJ|j |jd|j |jd|j|j|jJ|j t|j|z d|jjD]+\}}|jd|cxkxrdkncd|d|-y)Nrrg?z time_info[z] out of bounds: ) timerrassertIsNotNonerassertGreaterEqual assertLess start_timeabs time_infoitemsr)r(rrrrs r)test_response_timesz,HTTPClientCommonTestCase.test_response_timessYY[ ::h' X223$$000  5 5q9 --s3 X001""... H//*<=sC&&,,. PDAq OOALSLJqc9J1#*N O Pr+c |jdd}|j|jd|jdd}|j|jd|jddd}|j|jdy)Nrr)connect_timeoutr)request_timeout)rrrrs r)test_zero_timeoutz*HTTPClientCommonTestCase.test_zero_timeoutsv::h:: ,::h:: ,::h1:M ,r+c#RK|jj|jd}|j|j t t d5}tdD]'}tjd|js'ndddy#1swYyxYww)Nz/404z$Exception after Future was cancelleddrU) rlrr-rcancelrrrrrX logged_stack)r(futelrs r)test_error_after_cancelz0HTTPClientCommonTestCase.test_error_after_cancels$$T\\&%9:  % w F G 2 3Z iio%??     s$AB'2BB B'B$ B'cdD]\}}|j|d5|jt5|jdd|idddddd|j|d5|jt5|jd|diddddddy#1swYcxYw#1swYgxYw#1swY,xYw#1swYxYw)N))zfoo bar:cr)zfoo bar:lf)z foo bar:crlfrt)r!positionrr5rskey)subTestr r r)r(headerr!s r)test_header_crlfz)HTTPClientCommonTestCase.test_header_crlfs BLFD 4': B&&z2BJJx%JAB B4%8 B&&z2BJJx&%JAB B B B BB B BBB B BsFB6B*B6+CCC*B3 /B66B? C CC N)-r-r.r/rrrrrrrrrrr rrrr#r+r0r;r@rMrPr_rerrorvryr{r~rrrrrrrrrrrrrr0r+r)rrsU .. 7(F (#7J      1-< 7-<T "3H<0" 5>4"";@FFC99??--  : : E E 21`<H P(-  Br+rc0eZdZdZdZdZdZdZdZy)RequestProxyTestczttddt}|j|jdy)Nhttp://example.com/r5)r6)r r rkrr6r(proxys r)test_request_setz!RequestProxyTest.test_request_sets3 -% @$&  ))51r+czttdtd}|j|jdy)Nrr5r)r r rkrrrs r)test_default_setz!RequestProxyTest.test_default_sets4 - .u0M  00%8r+c~ttddtd}|j|jdy)Nrr5) proxy_hostbar)r r rkrrrs r) test_both_setzRequestProxyTest.test_both_sets7 -% @$RWBX  ))51r+ctttdt}|j|jyNr)r r rk assertIsNonerrs r)test_neither_setz!RequestProxyTest.test_neither_sets*k*?@$&I %--.r+cttdt}|jt5|j dddy#1swYyxYwr)r r rkr AttributeErrorr5rs r)test_bad_attributez#RequestProxyTest.test_bad_attributes@k*?@$&I   ~ .  II   s A  Acdttdd}|j|jyr)r r rrrs r)test_defaults_nonez#RequestProxyTest.test_defaults_nones(k*?@$G %--.r+N) r-r.r/rrrrrrr0r+r)rrs 2 9 2 / /r+rceZdZdZy)HTTPResponseTestCasecttddt}t|}|j |j d|j d|y)Nhttp://example.comr)rJz HTTPResponse(zcode=200)r r rr?rrUr*)r(rss r)test_strzHTTPResponseTestCase.test_strsI , -s79  M  _56 j!$r+N)r-r.r/rr0r+r)rrs%r+rc*eZdZdZdZdZdZdZy)SyncHTTPClientTestc:td_tjtj fdfd}tj |_jjjt_ y)NF) make_currentct\}_tdtfg}t |_j j |jy)N/)rrrrrserver add_socketset)rappeventr(s r) init_serverz-SyncHTTPClientTest.setUp..init_server+sJ.0OD$)%6789C$S/DK KK " "4 ( IIKr+cpjjjjyrj) server_iolooprun_syncstart)rr(sr)rz'SyncHTTPClientTest.setUp..start3s)    ' ' 4    $ $ &r+)target) rr threadingEventrrYThread server_threadrwaitr rl)r(rrrs` @@r)setUpzSyncHTTPClientTest.setUp'sq#7!     ''--U;   " %<r+cfd}jj|jjjj jj dy)Ncjjtjfd}jj |y)Nc3KjjtdD]}djj yw)N)rclose_all_connectionsrrstop)rr(s r) slow_stopzCSyncHTTPClientTest.tearDown..stop_server..slow_stopFsDkk7799qA""'')sA A)rrrrYr add_callback)rr(s r) stop_serverz0SyncHTTPClientTest.tearDown..stop_server>sA KK   ]] * *    + +I 6r+T)all_fds)rrrrrlr)r(rs` r)tearDownzSyncHTTPClientTest.tearDown=sY 7& '' 4 !      .r+c$d|j|fzS)Nzhttp://127.0.0.1:%d%s)r)r(paths r)r-zSyncHTTPClientTest.get_urlVs&$))T):::r+c|jj|jd}|jd|jy)Nrrrrs r)test_sync_clientz#SyncHTTPClientTest.test_sync_clientYs5##))$,,s*;< (--8r+c|jt5}|jj|j dddd|j j jdy#1swY0xYwr)r r rlrr-rrr)r( assertions r)test_sync_client_errorz)SyncHTTPClientTest.test_sync_client_error]sb  y ) >Y    " "4<< #< = > ,,1137 > >s +A00A9N)r-r.r/rrr-rrr0r+r)rr&s(,/2;98r+rceZdZdZy)SyncHTTPClientSubprocessTestc8tjtjddgtjtj dd}|j r)tdtt|j |j r|jdyy)Nz-czMfrom tornado.httpclient import HTTPClient; f = lambda: None; c = HTTPClient()T)stdoutstderrchecktimeoutzSTDOUT:z%subprocess produced unexpected output) subprocessrunsys executablePIPESTDOUTrprintrfail)r(procs r)test_destructor_logz0SyncHTTPClientSubprocessTest.test_destructor_logfsw~~_  ??$$   ;; )  *T[[) * ;; II= > r+N)r-r.r/rr0r+r)rres?r+rc6eZdZdZdZdZdZdZdZdZ y) HTTPRequestTestCasec^tdddi}|j|jddiy)Nrr5rrs)r rr^r(r?s r) test_headersz HTTPRequestTestCase.test_headerss+2UENK 5%.9r+chtd}ddi|_|j|jddiy)Nrrbazr r^rrs r)test_headers_setterz'HTTPRequestTestCase.test_headers_setters023 %. 5%.9r+c`td}d|_|j|jiy)Nrrrs r)test_null_headers_setterz,HTTPRequestTestCase.test_null_headers_setters(23 "-r+chtdd}|j|jtdy)Nrr5)r@)r rr@rrs r) test_bodyzHTTPRequestTestCase.test_bodys'2? tE{3r+crtd}d|_|j|jtdy)Nrr5)r r@rrrs r)test_body_setterz$HTTPRequestTestCase.test_body_setters,23  tE{3r+ctjjtjj}t d|}|j |j dt|iyNr)if_modified_sincezIf-Modified-Since)datetimenowtimezoneutcr rr^rr( http_dater?s r)test_if_modified_sincez*HTTPRequestTestCase.test_if_modified_sincesT%%))(*;*;*?*?@ 2iP  OO13CI3NO r+ct5tjj}dddtd}|j |j dt |iy#1swY>xYwr#)rr%utcnowr rr^rr)s r)'test_if_modified_since_naive_deprecatedz;HTTPRequestTestCase.test_if_modified_since_naive_deprecatedsa  ! 3 ))002I 32iP  OO13CI3NO  3 3s A''A0N) r-r.r/rrrrr!r+r.r0r+r)rrs%:: . 44   r+rceZdZdZdZdZy)HTTPErrorTestCasectd}tj|}|j|||j|j|jy)N)r copy assertIsNotrr)r(ee2s r) test_copyzHTTPErrorTestCase.test_copys@ cN YYq\ B )r+ctd}|jt|d|jt|dy)Nr2HTTP 403: Forbidden)r rr?repr)r(r5s r)test_plain_errorz"HTTPErrorTestCase.test_plain_errors5 cN Q!67 a"78r+c&ttdd}|jt5}|j dddj }|j t|d|j t|dy#1swYLxYw)Nrr2r9) r r r r rrrr?r:)r(rcmr5s r)test_error_with_responsez*HTTPErrorTestCase.test_error_with_responsesuK(=>D   y ) R LLN  LL Q!67 a"78   s BBN)r-r.r/r7r;r>r0r+r)r0r0s* 9 9r+r0)Lr.r7 contextlibrr3rrr%iorr r rtypingrunittesttornado.escaperrrtornadortornado.httpclientr r r r r tornado.httpserverrtornado.iolooprtornado.iostreamr tornado.logrrrtornado.testingrrrrtornado.test.utilr tornado.webrrrtornado.httputilrrrr2r;rDrMrRr[r`rhrlrprxr|rrrrTestCaserrrrrr0r0r+r)rOs   77*!%(TT088:(( . &&  n ^>;.; ~&n& Q~Q  n &>& HH"~"  ENET B0T Bn/x((/B%8,,%<8**<8~?8#4#4?<% (++% P9))9r+