Ë
    êmxiN  ã                   ó”   — d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
 d dlmZ  G d„ d«      Z G d„ d	ee	«      Z G d
„ dee	«      Zy)é    N)Ú	validator)Ú
RuleRouter)ÚAsyncHTTPTestCaseÚgen_test)ÚWSGIContainerc                   ó0   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚWSGIAppMixinc                 ó   — t        «       ‚©N)ÚNotImplementedError©Úselfs    úM/home/htdocs/ttos/venv/lib/python3.12/site-packages/tornado/test/wsgi_test.pyÚget_executorzWSGIAppMixin.get_executor   s   € Ü!Ó#Ð#ó    c                 óî   ‡— | j                  «       Št        j                  dd¬«      | _        ˆfd„}t	        d || j
                  «      fd || j                  «      fd || j                  «      fg«      S )Né   g333333Ó?)Útimeoutc                 ó0   •— t        t        | «      ‰¬«      S )N)Úexecutor)r   r   )Úappr   s    €r   Úmake_containerz,WSGIAppMixin.get_app.<locals>.make_container   s   ø€ Ü ¤¨3£¸(ÔCÐCr   ú/simpleú/barrierú/streaming_barrier)r   Ú	threadingÚBarrierÚbarrierr   Úsimple_wsgi_appÚbarrier_wsgi_appÚstreaming_barrier_wsgi_app)r   r   r   s     @r   Úget_appzWSGIAppMixin.get_app   sz   ø€ Ø×$Ñ$Ó&ˆô !×(Ñ(¨°CÔ8ˆŒô	Dô à™N¨4×+?Ñ+?Ó@ÐAØ™^¨D×,AÑ,AÓBÐCØ%¡~°d×6UÑ6UÓ'VÐWðó
ð 	
r   c                 ó    — d}dg} |||«       y )Nz200 OK)zContent-Typez
text/plain© )r   Ústart_responseÚstatusÚresponse_headerss       r   Úrespond_plainzWSGIAppMixin.respond_plain"   s   € ØˆØ:Ð;ÐÙ�vÐ/Õ0r   c                 ó*   — | j                  |«       dgS )Nó   Hello world!)r(   )r   Úenvironr%   s      r   r   zWSGIAppMixin.simple_wsgi_app'   s   € Ø×Ñ˜>Ô*ØÐ Ð r   c                 óž   — | j                  |«       	 | j                  j                  «       }d|z  gS # t        j                  $ r dgcY S w xY w)Ns   ok %dó   broken barrier©r(   r   Úwaitr   ÚBrokenBarrierError©r   r+   r%   Úns       r   r    zWSGIAppMixin.barrier_wsgi_app+   sU   € Ø×Ñ˜>Ô*ð	"Ø—‘×!Ñ!Ó#ˆAð ˜q‘L�>Ð!øô ×+Ñ+ò 	'Ø%Ð&Ò&ð	'ús   “3 ³AÁAc              #   ó´   K  — | j                  |«       d–— 	 | j                  j                  «       }d|z  –— y # t        j                  $ r d–— Y y w xY w­w)Ns   ok s   %dr-   r.   r1   s       r   r!   z'WSGIAppMixin.streaming_barrier_wsgi_app4   sW   è ø€ Ø×Ñ˜>Ô*ØŠð	Ø—‘×!Ñ!Ó#ˆAð ˜!‘)‹Oøô ×+Ñ+ò 	$Ø#Ô#ð	$üs%   ‚A™; ³A»AÁAÁAÁAN)	Ú__name__Ú
__module__Ú__qualname__r   r"   r(   r   r    r!   r$   r   r   r	   r	      s    „ ò$ò
ò"1ò
!ò"ór   r	   c                   ó8   — e Zd Zd„ Zd„ Zed„ «       Zed„ «       Zy)ÚWSGIContainerDummyExecutorTestc                  ó   — y r   r$   r   s    r   r   z+WSGIContainerDummyExecutorTest.get_executor@   s   € Ør   c                 ó^   — | j                  d«      }| j                  |j                  d«       y ©Nr   r*   ©ÚfetchÚassertEqualÚbody©r   Úresponses     r   Útest_simplez*WSGIContainerDummyExecutorTest.test_simpleC   ó$   € Ø—:‘:˜iÓ(ˆØ×Ñ˜Ÿ™¨Õ8r   c              ƒ   óf  K  — | j                   j                  «        t        j                  | j                  j                  | j                  d«      «      | j                  j                  | j                  d«      «      «      ƒ d {  –—† }|D ]  }| j                  |j                  d«       Œ  y 7 Œ(­w)Nr   r-   ©	r   ÚresetÚasyncioÚgatherÚhttp_clientr=   Úget_urlr>   r?   ©r   ÚrespsÚresps      r   Útest_concurrent_barrierz6WSGIContainerDummyExecutorTest.test_concurrent_barrierG   sŽ   è ø€ à�‰×ÑÔÜ—n‘nØ×Ñ×"Ñ" 4§<¡<°
Ó#;Ó<Ø×Ñ×"Ñ" 4§<¡<°
Ó#;Ó<ó
÷ 
ˆð ò 	;ˆDØ×Ñ˜TŸY™YÐ(9Õ:ñ	;ð	
úó   ‚BB1ÂB/Â)B1c              ƒ   óf  K  — | j                   j                  «        t        j                  | j                  j                  | j                  d«      «      | j                  j                  | j                  d«      «      «      ƒ d {  –—† }|D ]  }| j                  |j                  d«       Œ  y 7 Œ(­w)Nr   s   ok broken barrierrE   rK   s      r   Ú!test_concurrent_streaming_barrierz@WSGIContainerDummyExecutorTest.test_concurrent_streaming_barrierQ   s�   è ø€ à�‰×ÑÔÜ—n‘nØ×Ñ×"Ñ" 4§<¡<Ð0DÓ#EÓFØ×Ñ×"Ñ" 4§<¡<Ð0DÓ#EÓFó
÷ 
ˆð ò 	>ˆDØ×Ñ˜TŸY™YÐ(<Õ=ñ	>ð	
úrO   N©r4   r5   r6   r   rB   r   rN   rQ   r$   r   r   r8   r8   ?   s4   „ òò9ð ñ;ó ð;ð ñ>ó ñ>r   r8   c                   ó8   — e Zd Zd„ Zd„ Zed„ «       Zed„ «       Zy)ÚWSGIContainerThreadPoolTestc                 ó>   — t         j                  j                  «       S r   )Ú
concurrentÚfuturesÚThreadPoolExecutorr   s    r   r   z(WSGIContainerThreadPoolTest.get_executor]   s   € Ü×!Ñ!×4Ñ4Ó6Ð6r   c                 ó^   — | j                  d«      }| j                  |j                  d«       y r;   r<   r@   s     r   rB   z'WSGIContainerThreadPoolTest.test_simple`   rC   r   c           	   ƒ   ó”  K  — | j                   j                  «        t        j                  | j                  j                  | j                  d«      «      | j                  j                  | j                  d«      «      «      ƒ d {  –—† }| j                  ddgt        |D �cg c]  }|j                  ‘Œ c}«      «       y 7 Œ:c c}w ­w)Nr   ó   ok 0ó   ok 1©
r   rF   rG   rH   rI   r=   rJ   r>   Úsortedr?   rK   s      r   rN   z3WSGIContainerThreadPoolTest.test_concurrent_barrierd   s™   è ø€ à�‰×ÑÔÜ—n‘nØ×Ñ×"Ñ" 4§<¡<°
Ó#;Ó<Ø×Ñ×"Ñ" 4§<¡<°
Ó#;Ó<ó
÷ 
ˆð 	×Ñ˜' 7Ð+¬VÈ5Ö4QÀ4°T·Y³YÒ4QÓ-RÕSð	
úò 5Rùó$   ‚BCÂCÂCÂ"CÂ5CÃCc           	   ƒ   ó”  K  — | j                   j                  «        t        j                  | j                  j                  | j                  d«      «      | j                  j                  | j                  d«      «      «      ƒ d {  –—† }| j                  ddgt        |D �cg c]  }|j                  ‘Œ c}«      «       y 7 Œ:c c}w ­w)Nr   r[   r\   r]   rK   s      r   rQ   z=WSGIContainerThreadPoolTest.test_concurrent_streaming_barrierm   s›   è ø€ à�‰×ÑÔÜ—n‘nØ×Ñ×"Ñ" 4§<¡<Ð0DÓ#EÓFØ×Ñ×"Ñ" 4§<¡<Ð0DÓ#EÓFó
÷ 
ˆð 	×Ñ˜' 7Ð+¬VÈ5Ö4QÀ4°T·Y³YÒ4QÓ-RÕSð	
úò 5Rùr_   NrR   r$   r   r   rT   rT   \   s8   „ ò7ò9ð ñTó ðTð ñTó ñTr   rT   )rG   Úconcurrent.futuresrV   r   Úwsgiref.validater   Útornado.routingr   Útornado.testingr   r   Útornado.wsgir   r	   r8   rT   r$   r   r   ú<module>rf      sE   ðÛ Û Û å &å &ß 7Ý &÷0ñ 0ôf> \Ð3Dô >ô:T ,Ð0Aõ Tr   