
    ;en                     |   d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZ  ed          Z	 ed            e
            Z G d de          Zej        d	d
d            Zd Zd ZefdZ G d dej                  Z G d dej                  Z G d dej                  Zedk    r ej                     dS dS )    N)import_module)
gc_collectrequires_working_socketasyncioT)modulec                       e Zd ZdS )AwaitExceptionN__name__
__module____qualname__     )/usr/lib/python3.11/test/test_asyncgen.pyr	   r	      s        Dr   r	   Fthrowc              #   "   K   | rdV  d S dV  d S )Nr   resultr   r   s    r   	awaitabler      s2       r   c                     d}	 	 |rd}|                      t                    }n|                     d           }n$# t          $ r}|j        d         cY d }~S d }~ww xY w|dk    rd}c)NFTr   r   )r   r	   sendStopIterationargs)coroexcfutexs       r   run_until_completer      s    
C	 &jj00iioo 	 	 	71:	 *Cs   4: 
AAAAc                 <      fd}t           |                      S )Nc                  P   K   g } 2 3 d {V }|                      |           6 | S Nappend)resigens     r   iteratezto_list.<locals>.iterate-   sO       	 	 	 	 	 	 	!JJqMMMM 
s   %)r   )r'   r(   s   ` r   to_listr)   ,   s2         ggii(((r   c                      	 t                     j        n # t          $ r t           d          w xY wt          u r            S  fd} |            S )a0  Pure-Python implementation of anext() for testing purposes.

    Closely matches the builtin anext() C implementation.
    Can be used to compare the built-in implementation of the inner
    coroutines machinery to C-implementation of __anext__() and send()
    or throw() on the returned generator.
    z is not an async iteratorc                  P   K   	              d {V S # t           $ r cY S w xY wr"   StopAsyncIteration)	__anext__defaultiterators   r   
anext_implzpy_anext.<locals>.anext_implG   sT      	 #8,,,,,,,,,! 	 	 	NNN	s    %%)typer.   AttributeError	TypeError_no_default)r0   r/   r1   r.   s   `` @r   py_anextr6   6   s    BNN,		 B B B8@@@AAAB +y"""	 	 	 	 	 	 	 :<<s    7c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )AsyncGenSyntaxTestc                     d}|                      t          d          5  t          |i i            d d d            d S # 1 swxY w Y   d S )NzJasync def foo():
            await abc
            yield from 123
        yield from.*inside asyncassertRaisesRegexSyntaxErrorexecselfcodes     r   test_async_gen_syntax_01z+AsyncGenSyntaxTest.test_async_gen_syntax_01W       
 ##K1KLL 	 	r2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   =AAc                     d}|                      t          d          5  t          |i i            d d d            d S # 1 swxY w Y   d S )Nz4async def foo():
            yield from 123
        r:   r;   r?   s     r   test_async_gen_syntax_02z+AsyncGenSyntaxTest.test_async_gen_syntax_02`   s     ##K1KLL 	 	r2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rD   c                     d}|                      t          d          5  t          |i i            d d d            d S # 1 swxY w Y   d S )NzXasync def foo():
            await abc
            yield
            return 123
        return.*value.*async genr;   r?   s     r   test_async_gen_syntax_03z+AsyncGenSyntaxTest.test_async_gen_syntax_03h        ##K1KLL 	 	r2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rD   c                     d}|                      t          d          5  t          |i i            d d d            d S # 1 swxY w Y   d S )NzBasync def foo():
            yield
            return 123
        rH   r;   r?   s     r   test_async_gen_syntax_04z+AsyncGenSyntaxTest.test_async_gen_syntax_04r   rC   rD   c                     d}|                      t          d          5  t          |i i            d d d            d S # 1 swxY w Y   d S )NzWasync def foo():
            if 0:
                yield
            return 12
        rH   r;   r?   s     r   test_async_gen_syntax_05z+AsyncGenSyntaxTest.test_async_gen_syntax_05{   rJ   rD   N)r   r   r   rB   rF   rI   rL   rN   r   r   r   r8   r8   U   s_                    r   r8   c                   \    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd ZdS )AsyncGenTestc                 j    d }d } ||          } ||          }|                      ||           |S )Nc                 ,   g }	 	 |                     |                                            nf# t          $ r |                     d           Y nFt          $ r9}|                     t	          t          |                               Y d }~nd }~ww xY w|S )NTSTOP)r$   __next__r   	Exceptionstrr2   )gr%   r   s      r   sync_iteratez5AsyncGenTest.compare_generators.<locals>.sync_iterate   s    C..JJqzz||,,,,$   JJv&&&E  . . .JJs488}}--------.. Js   '- B	B/BBc                    g }	 |                                  }	 	 	 |                                 n# t          $ rK}|j        r%|                    |j        d                    Y d }~nn|                    d           Y d }~nTd }~wt
          $ r  t          $ r9}|                    t          t          |                               Y d }~n	d }~ww xY wn%# t
          $ r |                    d           Y nw xY w|S )NTr   zEMPTY StopIterationrS   )	r.   rT   r   r   r$   r-   rU   rV   r2   )rW   r%   anr   s       r   async_iteratez6AsyncGenTest.compare_generators.<locals>.async_iterate   s;   C[[]]""KKMMMM, & & &!w & #

271: 6 6 6 % #

+@ A A A %1 " " "!( " " "JJs488}}555!EEEE"" *   JJv&&&E%* JsT   C 0 C 
C'B !C &B ;C  C/CC CC C76C7)assertEqual)r@   sync_gen	async_genrX   r[   sync_gen_resultasync_gen_results          r   compare_generatorszAsyncGenTest.compare_generators   s^    
	 
	 
		 	 	2 ',x00(=33*:;;;r   c                 l      fd}                      t           |                      g d           d S )Nc                    K   t                       d {V  dW V }                     | d            t                       d {V  dW V  t                       d {V  dW V  d S )N{       )r   assertIs)ar@   s    r   r'   z5AsyncGenTest.test_async_gen_iteration_01.<locals>.gen   s      ++			AMM!T"""++IIII++IIIIIIr   )rd   re   rf   )r\   r)   r@   r'   s   ` r   test_async_gen_iteration_01z(AsyncGenTest.test_async_gen_iteration_01   sJ    	 	 	 	 	 	99999r   c                    d } |            }|                                 }|                                }|                     |                                d           	 |                                 |                     d           n8# t
          $ r+}|                     |j        d         d           Y d }~nd }~ww xY w|                                }|                     |                                d           	 |                                 |                     d           d S # t          $ r%}|                     |j                   Y d }~d S d }~ww xY w)Nc                 d   K   t                       d {V  dW V  t                       d {V  d S Nrd   r   r   r   r   r'   z5AsyncGenTest.test_async_gen_iteration_02.<locals>.gen   sO      ++IIII++r   r   StopIteration was not raisedr   rd   z!StopAsyncIteration was not raised)		__aiter__r.   r\   rT   failr   r   r-   assertFalser@   r'   rW   airZ   r   s         r   test_async_gen_iteration_02z(AsyncGenTest.test_async_gen_iteration_02   so   	 	 	
 CEE[[]]\\^^444	6KKMMM II45555  	. 	. 	.RWQZ--------	.
 \\^^444	;KKMMM II9::::: " 	& 	& 	&RW%%%%%%%%%	&s0   B	 	
B>!B99B>>D) )
E3EEc                     d }|                      t                    5  t           |                       d d d            d S # 1 swxY w Y   d S )Nc                 r   K   t                       d {V  dW V  t          d           d {V  dW V  d S )Nrd   Tr   re   rn   r   r   r   r'   z5AsyncGenTest.test_async_gen_exception_03.<locals>.gen   s_      ++IIII$''''''''''IIIIIIr   )assertRaisesr	   r)   ri   s     r   test_async_gen_exception_03z(AsyncGenTest.test_async_gen_exception_03   s    	 	 	 ~.. 	 	CCEENNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AA
Ac                 8   d } |            }|                                 }|                                }|                     |                                d           	 |                                 |                     d           n8# t
          $ r+}|                     |j        d         d           Y d }~nd }~ww xY w|                     t                    5  |                                                                 d d d            d S # 1 swxY w Y   d S )Nc                 F   K   t                       d {V  dW V  ddz   d S )Nrd      r   rn   r   r   r   r'   z5AsyncGenTest.test_async_gen_exception_04.<locals>.gen   s:      ++IIIIEEEEr   r   ro   r   rd   )	rp   r.   r\   rT   rq   r   r   rx   ZeroDivisionErrorrs   s         r   test_async_gen_exception_04z(AsyncGenTest.test_async_gen_exception_04   sa   	 	 	
 CEE[[]]\\^^444	6KKMMM II45555  	. 	. 	.RWQZ--------	.
 011 	& 	&LLNN##%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s*   B	 	
B>!B99B>'DDDc                     d }|                      t          d          5  t           |                       d d d            d S # 1 swxY w Y   d S )Nc                    K   dW V  t           rm   r,   r   r   r   r'   z5AsyncGenTest.test_async_gen_exception_05.<locals>.gen   s      IIII$$r   z#async generator.*StopAsyncIterationr<   RuntimeErrorr)   ri   s     r   test_async_gen_exception_05z(AsyncGenTest.test_async_gen_exception_05   s    	% 	% 	% ##L$IK K 	 	CCEENNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   AAAc                     d }|                      t          d          5  t           |                       d d d            d S # 1 swxY w Y   d S )Nc                    K   dW V  t           rm   )r   r   r   r   r'   z5AsyncGenTest.test_async_gen_exception_06.<locals>.gen  s      IIIIr   zasync generator.*StopIterationr   ri   s     r   test_async_gen_exception_06z(AsyncGenTest.test_async_gen_exception_06  s    	  	  	  ##L$DF F 	 	CCEENNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                 ^    d }d }|                       |             |                       d S )Nc               3   R   K   	 dV  ddz   dV  dV  n# dV  dV  w xY wdV  d S Nr|   r         d   r   r   r   r   r]   z:AsyncGenTest.test_async_gen_exception_07.<locals>.sync_gen  X      A IIIII   	 
 c                 ^   K   	 dW V  ddz   dW V  dW V  n# dW V  dW V  w xY wdW V  d S r   r   r   r   r   r^   z;AsyncGenTest.test_async_gen_exception_07.<locals>.async_gen  sd      A IIIIIIs   
 %ra   r@   r]   r^   s      r   test_async_gen_exception_07z(AsyncGenTest.test_async_gen_exception_07  sJ    	 	 		 	 	 	

IIKK88888r   c                 ^    d }d }|                       |             |                       d S )Nc               3   \   K   	 dV  dV  ddz   dV  n# dV  ddz   dV  w xY wdV  d S Nr|   r   r   r   r   r   r   r   r   r]   z:AsyncGenTest.test_async_gen_exception_08.<locals>.sync_gen%  sa      A AIIIIIs    %c                    K   	 dW V  t                       d {V  t                       d {V  dW V  ddz   dW V  n(# t                       d {V  dW V  ddz   dW V  w xY wdW V  d S r   rn   r   r   r   r^   z;AsyncGenTest.test_async_gen_exception_08.<locals>.async_gen/  s      kk!!!!!!!kk!!!!!!!A  kk!!!!!!!AIIIIIIs   A %A&r   r   s      r   test_async_gen_exception_08z(AsyncGenTest.test_async_gen_exception_08$  J    	 	 	
	 
	 
	 	

IIKK88888r   c                 ^    d }d }|                       |             |                       d S )Nc               3   R   K   	 dV  ddz   dV  dV  n# dV  dV  w xY wdV  d S r   r   r   r   r   r]   z:AsyncGenTest.test_async_gen_exception_09.<locals>.sync_gen>  r   r   c                    K   	 t                       d {V  dW V  ddz   dW V  t                       d {V  dW V  n## dW V  t                       d {V  dW V  w xY wdW V  d S r   rn   r   r   r   r^   z;AsyncGenTest.test_async_gen_exception_09.<locals>.async_genH  s      kk!!!!!!!Akk!!!!!!! kk!!!!!!!IIIIIIs   A  A!r   r   s      r   test_async_gen_exception_09z(AsyncGenTest.test_async_gen_exception_09=  r   r   c                     d }|                      t          d          5   |                                                                d           d d d            d S # 1 swxY w Y   d S )Nc                    K   dW V  d S rm   r   r   r   r   r'   z5AsyncGenTest.test_async_gen_exception_10.<locals>.genW        IIIIIIr   z!non-None value .* async generatorr   )r<   r4   r.   r   ri   s     r   test_async_gen_exception_10z(AsyncGenTest.test_async_gen_exception_10V  s    	 	 	##I$GI I 	( 	(CEEOO""3'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   0AA #A c                 v    d fd}d fd}|                       |             |                       d S )Nc               3      K   dV  dV  d S N
      r   r   r   r   r]   z:AsyncGenTest.test_async_gen_exception_11.<locals>.sync_gen^  s      HHHHHHHHr   c               3      K   dV               } |                      d            	 |                     t                                 n# t          $ r dV  Y nw xY wdV  d S Nr|   r   r   )r   r   GeneratorExit)sgr]   s    r   sync_gen_wrapperzBAsyncGenTest.test_async_gen_exception_11.<locals>.sync_gen_wrapperb  s}      GGGBGGDMMM))))    GGGGGs   !A
 
AAc                    K   dW V  dW V  d S r   r   r   r   r   r^   z;AsyncGenTest.test_async_gen_exception_11.<locals>.async_genl  s       HHHHHHHHHHr   c                    K   dW V               } |                      d            d {V  	 |                     t                                 d {V  n# t          $ r dW V  Y nw xY wdW V  d S r   )asendathrowr   )asgr^   s    r   async_gen_wrapperzCAsyncGenTest.test_async_gen_exception_11.<locals>.async_gen_wrapperp  s      GGGG)++C))D//!!!!!!!jj1111111111    GGGGGGs   'A A)(A)r   )r@   r   r   r^   r]   s      @@r   test_async_gen_exception_11z(AsyncGenTest.test_async_gen_exception_11]  s    	 	 		 	 	 	 		 	 		 	 	 	 	 	 0 0 2 24E4E4G4GHHHHHr   c                    d } |            }|                      |j        d           d|_        |                      |j        d           |                     d|j                   d|_        |                      |j        d           |                     |j                   |                     |j        t          j	                   | 
                    |j                   |                     |j        t          j                   |                     t          j        |                                                     d S )Nc                    K   dW V  d S rm   r   r   r   r   r'   z/AsyncGenTest.test_async_gen_api_01.<locals>.gen}  r   r   r'   123z.gen)r\   r   assertInr   assertIsNoneag_awaitassertIsInstanceag_frametypes	FrameTyperr   
ag_runningag_codeCodeType
assertTrueinspectisawaitableaclose)r@   r'   rW   s      r   test_async_gen_api_01z"AsyncGenTest.test_async_gen_api_01|  s   	 	 	 CEEU+++
U+++fan---///!*%%%aj%/:::&&&ai888+AHHJJ7788888r   N)r   r   r   ra   rj   ru   ry   r~   r   r   r   r   r   r   r   r   r   r   r   rP   rP      s        )  )  ) V
: 
: 
:; ; ;:  & & &*    9 9 9.9 9 929 9 92( ( (I I I>9 9 9 9 9r   rP   c                   R   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%d$ Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7S )8AsyncGenAsyncioTestc                 v    t                                           | _        t                               d            d S r"   )r   new_event_looploopset_event_loopr@   s    r   setUpzAsyncGenAsyncioTest.setUp  s/    **,,	t$$$$$r   c                 z    | j                                          d | _         t                              d            d S r"   )r   closer   set_event_loop_policyr   s    r   tearDownzAsyncGenAsyncioTest.tearDown  s5    		%%d+++++r   c                 ,   |                      d          5  |                     |t                     d d d            n# 1 swxY w Y   |                      d          5  |                     |t                     d d d            d S # 1 swxY w Y   d S )Nzpure-Pythonanextbuiltin)subTest_check_async_iterator_anextr6   r   )r@   	ait_classs     r   check_async_iterator_anextz.AsyncGenAsyncioTest.check_async_iterator_anext  s    \\\.. 	B 	B,,YAAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B\\	\** 	? 	?,,Y>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s!   ?AA B		BBc                 h   	              		fd} j                              |                      }                     |g d                                t                    5   j                              |                       d d d            n# 1 swxY w Y    fd} j                              |                      }                     |d            fd} |              fd} j                              |                      }                     |d           d S )Nc                     K   g } |                                  d {V            |                                  d {V            |                       d           d {V            | S )Nbuckle my shoer#   )resultsr   rW   s    r   consumez@AsyncGenAsyncioTest._check_async_iterator_anext.<locals>.consume  s      GNNq>>>>>>***NNq>>>>>>***NNq*:!;!;;;;;;;<<<Nr   )r|   r   r   c                    K                }                       |            d {V d                                 |            d {V d                               t                    5   |            d {V  d d d            n# 1 swxY w Y                       t                    5   |            d {V  d d d            n# 1 swxY w Y                }                      |d           d {V d                                 |d           d {V d                                 |d           d {V d                                 |d           d {V d           dS )Nr|   r   r/   	completed)r\   rx   r-   )g1g2r   r   r@   s     r   test_2z?AsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_2  sN     B5599______a0005599______a000""#566    eBii                             ""#566    eBii                              B55Y#7#7777777;;;55Y#7#7777777;;;55Y#7#7777777CCC55Y#7#7777777CCC;s$   2BBB5CCCr   c                  @                }  | d          }                     t                    5  t          j        |                                          5 }|                    d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S Nr   )rx   r   
contextlibclosing	__await__r   )pobjrW   r   r   r@   s      r   	test_sendzBAsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_send  s   	A%;''C""=11 ! !'88 !AFF4LLL! ! ! ! ! ! ! ! ! ! ! ! ! ! !! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !s5   'BA;/B;A?	?BA?	BBBc                     K                }  | d          }                     t          |j        t                     dS r   )rx   r=   r   )r   r   r   r   r@   s     r   
test_throwzCAsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_throw  sB      	A%;''Ck39kBBB;r   )r   r   r\   rx   r-   )
r@   r   r   r   r%   r   r   r   r   rW   s
   ```      @r   r   z/AsyncGenAsyncioTest._check_async_iterator_anext  s   IKK	 	 	 	 	 	 i**779955666777122 	4 	4I((333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4	 	 	 	 	 	 	" --ffhh77---	! 	! 	! 	! 	! 	! 	! 			 	 	 	 	 	 	 --jjll;;-----s   )#BBBc                 6    d }|                      |           d S )Nc                    K   dW V  dW V  d S Nr|   r   r   r   r   r   agenz<AsyncGenAsyncioTest.test_async_generator_anext.<locals>.agen         GGGGGGGGGGr   r   )r@   r   s     r   test_async_generator_anextz.AsyncGenAsyncioTest.test_async_generator_anext  s-    	 	 	 	''-----r   c                 J     G d d          }|                      |           d S )Nc                   $    e Zd ZdZd Zd Zd ZdS )IAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIterAsynchronously yield 1, then 2.c                     d| _         d S Nr   yieldedr   s    r   __init__zRAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__init__       r   c                     | S r"   r   r   s    r   rp   zSAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__aiter__      r   c                 f   K   | j         dk    rt                      | xj         dz  c_         | j         S )Nr   r|   r   r-   r   s    r   r.   zSAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__anext__  s7      <1$$,...LLA%LL<'r   N)r   r   r   __doc__r   rp   r.   r   r   r   MyAsyncIterr     sG        11! ! !  ( ( ( ( (r   r  r   )r@   r  s     r    test_python_async_iterator_anextz4AsyncGenAsyncioTest.test_python_async_iterator_anext  sF    	( 	( 	( 	( 	( 	( 	( 	( 	''44444r   c                 X    dd l  G fdd          }|                     |           d S )Nr   c                   @    e Zd ZdZd Zd Z j        d             ZdS )fAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoror   c                     d| _         d S r   r   r   s    r   r   zoAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__init__  r   r   c                     | S r"   r   r   s    r   rp   zpAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__aiter__  r   r   c              3   h   K   	 | j         dk    rt                      | xj         dz  c_         | j         S )NFz#this is a generator-based coroutiner   r|   r  r   s    r   r.   zpAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__anext__  s=      @<1$$,...LLA%LL<'r   N)r   r   r   r  r   rp   	coroutiner.   )r   s   r   MyAsyncIterWithTypesCoror    sT        11! ! !  _( ( _( ( (r   r  )r   r   )r@   r  r   s     @r   0test_python_async_iterator_types_coroutine_anextzDAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext  s[    	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	''(@AAAAAr   c                     d } |            fd}| j                              |                      }|                     |ddg           d S )Nc                    K   dW V  dW V  d S r   r   r   r   r   r'   z5AsyncGenAsyncioTest.test_async_gen_aiter.<locals>.gen  r   r   c                  F   K   d t                     2              d {V S )Nc                 "   K   g | 3 d {V }|
6 S r"   r   .0r&   s     r   
<listcomp>zMAsyncGenAsyncioTest.test_async_gen_aiter.<locals>.consume.<locals>.<listcomp>  s.      ........A....   aiter)rW   s   r   r   z9AsyncGenAsyncioTest.test_async_gen_aiter.<locals>.consume  s3      ..U1XX..........r   r|   r   r   r   r\   )r@   r'   r   r%   rW   s       @r   test_async_gen_aiterz(AsyncGenAsyncioTest.test_async_gen_aiter  ss    	 	 	 CEE	/ 	/ 	/ 	/ 	/i**779955q!f%%%%%r   c                     g  G d d          } |            fd}| j                              |                       |                     ddg           d S )Nc                       e Zd Zd ZdS );AsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.Genc                   K   dW V  dW V  d S r   r   r   s    r   rp   zEAsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.Gen.__aiter__  s       r   Nr   r   r   rp   r   r   r   Genr  
  s#            r   r  c                     K   t                    } 	 	                     t          |            d {V            n# t          $ r Y d S w xY w<r"   )r  r$   r   r-   )aitrW   r   s    r   r   z?AsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.consume  sp      ((CNNs#3#3#3#3#3#34444)   EEs   (> 
AAr|   r   r  )r@   r  r   rW   r   s      @@r   test_async_gen_aiter_classz.AsyncGenAsyncioTest.test_async_gen_aiter_class  s    	 	 	 	 	 	 	 	 CEE	 	 	 	 	 	 		$$WWYY///1a&)))))r   c                     d }t           |                      }t          |          }|                     ||           d S )Nc                    K   dW V  d S Nr|   r   r   r   r   r'   z6AsyncGenAsyncioTest.test_aiter_idempotent.<locals>.gen        GGGGGGr   )r  rg   )r@   r'   applied_onceapplied_twices       r   test_aiter_idempotentz)AsyncGenAsyncioTest.test_aiter_idempotent  sI    	 	 	SSUU||l++lM22222r   c                    d d }fd}fd}fd}|                      t                    5  | j                             |                       d d d            n# 1 swxY w Y   |                      t                    5  | j                             |                       d d d            n# 1 swxY w Y   |                      t                    5  | j                             |                       d d d            n# 1 swxY w Y   |                      t                    5  | j                             |                       d d d            d S # 1 swxY w Y   d S )Nc                    K   dW V  d S r%  r   r   r   r   r'   z4AsyncGenAsyncioTest.test_anext_bad_args.<locals>.gen!  r&  r   c                  2   K   t                       d {V  d S r"   r   r   r   r   call_with_too_few_argszGAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_too_few_args#        ''MMMMMMMMMr   c                  J   K   t                        dd           d {V  d S Nr|   r   r   r'   s   r   call_with_too_many_argszHAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_too_many_args%  s7      q!$$$$$$$$$$$r   c                  H   K   t          d                         d {V  d S r%  r   r1  s   r   call_with_wrong_type_argszJAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_wrong_type_args'  s3      3355//!!!!!!!!!r   c                  H   K   t                                   d {V  d S )N)	aiteratorr   r1  s   r   call_with_kwargz@AsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_kwarg)  s6      ##%%((((((((((((r   rx   r4   r   r   )r@   r-  r2  r4  r7  r'   s        @r   test_anext_bad_argsz'AsyncGenAsyncioTest.test_anext_bad_args   s   	 	 		 	 		% 	% 	% 	% 	%	" 	" 	" 	" 	"	) 	) 	) 	) 	)y)) 	C 	CI(()?)?)A)ABBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cy)) 	D 	DI(()@)@)B)BCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Dy)) 	F 	FI(()B)B)D)DEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fy)) 	< 	<I(():):;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<sG   #A  A$'A$#B44B8;B8#DDD-#EE!$E!c                       fd} j                              |                      }                     |d           d S )Nc                    K    G d d           G fdd          } d}t           |             d          }                    t          |          5  | d {V  d d d            n# 1 swxY w Y   t           |                       }                    t          |          5  | d {V  d d d            n# 1 swxY w Y   dS )Nc                       e Zd Zd ZdS )UAsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.BadAwaitablec                     dS )N*   r   r   s    r   r   z_AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.BadAwaitable.__await__7  s    2r   Nr   r   r   r   r   r   r   BadAwaitabler=  6  s#            r   rA  c                        e Zd Zd Z fdZdS )TAsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncIterc                     | S r"   r   r   s    r   rp   z^AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncIter.__aiter__:  s    Kr   c                                  S r"   r   )r@   rA  s    r   r.   z^AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncIter.__anext__<  s    '<>>)r   Nr   r   r   rp   r.   )rA  s   r   r  rC  9  s=             * * * * * * *r   r  z__await__.*iteratorr/   r   )r   r<   r4   )r  regexr   rA  r@   s      @r   bad_awaitablez?AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable5  s            * * * * * * * * * *
 +EkkmmY77I''	599                                 kkmm,,I''	599                                 ;s$   	A++A/2A/(	B==CCr   r  )r@   rH  r   s   `  r   test_anext_bad_awaitz(AsyncGenAsyncioTest.test_anext_bad_await4  sU    	 	 	 	 	" --mmoo>>-----r   c                 P  K   t           |            d          }|                     t                    5  | d {V  d d d            n# 1 swxY w Y   t           |                      }|                     t                    5  | d {V  d d d            n# 1 swxY w Y   dS Nr/   r   )r   rx   r4   )r@   aiter_classr   s      r   check_anext_returning_iteratorz2AsyncGenAsyncioTest.check_anext_returning_iteratorI  s'     ++--33	y)) 	 	OOOOOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	++--((	y)) 	 	OOOOOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	{s#   	A

AA	BB"Bc                      G d d          }| j                             |                     |                    }|                     |d           d S )Nc                       e Zd Zd Zd ZdS )EAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnextc                     | S r"   r   r   s    r   rp   zOAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnext.__aiter__T  r   r   c                      t          d          S )Nabc)iterr   s    r   r.   zOAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnext.__anext__V  s    E{{"r   NrF  r   r   r   WithIterAnextrP  S  s2          # # # # #r   rU  r   r   r   rM  r\   )r@   rU  r   s      r   test_anext_return_iteratorz.AsyncGenAsyncioTest.test_anext_return_iteratorR  sl    	# 	# 	# 	# 	# 	# 	# 	#
 --d.Q.QR_.`.`aa-----r   c                      G d d          }| j                             |                     |                    }|                     |d           d S )Nc                       e Zd Zd Zd ZdS )EAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnextc                     | S r"   r   r   s    r   rp   zOAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnext.__aiter__]  r   r   c              3      K   d V  d S r"   r   r   s    r   r.   zOAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnext.__anext___  s      r   NrF  r   r   r   WithGenAnextrZ  \  s2              r   r]  r   rV  )r@   r]  r   s      r   test_anext_return_generatorz/AsyncGenAsyncioTest.test_anext_return_generator[  sl    	 	 	 	 	 	 	 	
 --d.Q.QR^._._``-----r   c                       G d d           G fdd           fd} j                              |                      }                     |d           d S )Nc                       e Zd Zd ZdS )EAsyncGenAsyncioTest.test_anext_await_raises.<locals>.RaisingAwaitablec              3   "   K   t                      r"   r}   r   s    r   r   zOAsyncGenAsyncioTest.test_anext_await_raises.<locals>.RaisingAwaitable.__await__f  s      ')))r   Nr@  r   r   r   RaisingAwaitablera  e  s#            r   rd  c                        e Zd Zd Z fdZdS )NAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnextc                     | S r"   r   r   s    r   rp   zXAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnext.__aiter__j  r   r   c                                  S r"   r   )r@   rd  s    r   r.   zXAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnext.__anext__l  s    '')))r   NrF  )rd  s   r   WithRaisingAwaitableAnextrf  i  s=          * * * * * * *r   ri  c                  R  K   t                                 }                     t                    5  |  d {V  d d d            n# 1 swxY w Y   t                       d          }                     t                    5  |  d {V  d d d            n# 1 swxY w Y   dS rK  )r   rx   r}   )r   ri  r@   s    r   do_testz<AsyncGenAsyncioTest.test_anext_await_raises.<locals>.do_testn  s2     7799::I""#455                                 77999EEI""#455                                 ;s#   	A

AA	BB #B r   r  )r@   rk  r   rd  ri  s   `  @@r   test_anext_await_raisesz+AsyncGenAsyncioTest.test_anext_await_raisesd  s    	 	 	 	 	 	 	 		* 	* 	* 	* 	* 	* 	* 	* 	* 	*
	 	 	 	 	 	 --ggii88-----r   c                 D   	
 t           j        d             	 G d dt                    	fd

 fd}
 fd}
 fd} fd} fd	} fd
} fd} ||            ||            ||            ||            ||            ||           d S )Nc              3      K   | V S r"   r   vs    r   _async_yieldz9AsyncGenAsyncioTest.test_anext_iter.<locals>._async_yieldz  s      GGr   c                       e Zd ZdS )4AsyncGenAsyncioTest.test_anext_iter.<locals>.MyErrorNr
   r   r   r   MyErrorrs  ~          Dr   rt  c                 j   K   	  d           d {V  n#  $ r  d           d {V  Y nw xY wd S r   r   rt  rq  s   r   agenfnz3AsyncGenAsyncioTest.test_anext_iter.<locals>.agenfn  su      &"l1oo%%%%%%%% & & &"l1oo%%%%%%%%%&F    00c                 &                }t          j         | |d                                                    5 }                    |                    d           d                               |                                 d           d           	 |                    d                                d           n# t          $ r}|}Y d }~nd }~ww xY w                    |j        d           d d d            d S # 1 swxY w Y   d S )Nr/   r|   r   ro   )	r   r   r   r\   r   r   rq   r   value)r   r   rW   eerrrt  rx  r@   s        r   test1z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test1  sZ   688D#EE$	$:$:$D$D$F$FGG 	71  q111  ''))T!B!BAFFF>FF4LLL II<==== %   CCCCCC   I666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s<   ADC/D
CCDCDD
D
c                                 }t          j         | |d                                                    5 }                    |                    d           d                               |                                 d           d                                         5  |                                 d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr/   r|   r   )r   r   r   r\   r   r   rx   )r   r   rW   rt  rx  r@   s      r   test2z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test2  si   688D#EE$	$:$:$D$D$F$FGG 61  q111  ''))T!B!BAFFF&&w// 6 6GGGWWYY5556 6 6 6 6 6 6 6 6 6 6 6 6 6 66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s6   A2C2. CC2C	C2!C	"C22C69C6c                                 }t          j         | |d                                                    5 }                    |                    d           d           |                                                     t          d          5                      |                    d           d           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr/   r|   zcannot reuse)r   r   r   r\   r   r   r<   r   )r   r   rW   rx  r@   s      r   test3z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test3  sP   688D#EE$	$:$:$D$D$F$FGG 61  q111			++L.II 6 6$$QVVD\\15556 6 6 6 6 6 6 6 6 6 6 6 6 6 66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s6   AC#*C?C#C	C#C	C##C'*C'c                 :   t           j        d             fd} |            }t          j         | |d                                                    5 }                    |                    d           d                               |                                 d           d                               d          5  |                     d          d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc              3   (   K   | dz  V  | dz  dz   V S Nr   r|   r   ro  s    r   rq  zHAsyncGenAsyncioTest.test_anext_iter.<locals>.test4.<locals>._async_yield  '      "f 2vz**+r   c                 j   K   	  d           d {V  n#  $ r  d           d {V  Y nw xY wd S r   r   rw  s   r   rx  zBAsyncGenAsyncioTest.test_anext_iter.<locals>.test4.<locals>.agenfn  su      *&,q//)))))))) * * *&,q//)))))))))*ry  r/   r   r   val)	r   r  r   r   r   r\   r   r   r<   r   rx  r   rW   rq  rt  r@   s       @r   test4z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test4  s   _, , _,      688D#EE$	$:$:$D$D$F$FGG ;1  r222  ''))T!B!BBGGG++GU;; ; ;GGGWWU^^T:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s7   A3D!C8,D8C<	<D?C<	 DDDc                    t           j        d             fd} |            }t          j         | |d                                                    5 }                    |                    d           d                               t          d          5  |	                                 d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc              3   (   K   | dz  V  | dz  dz   V S r  r   ro  s    r   rq  zHAsyncGenAsyncioTest.test_anext_iter.<locals>.test5.<locals>._async_yield  r  r   c                 T   K   	  d           d {V  n#  $ r Y d S w xY wdW V  d S Nr|   aaar   rw  s   r   rx  zBAsyncGenAsyncioTest.test_anext_iter.<locals>.test5.<locals>.agenfn  s`      &,q//))))))))   FFs      r/   r   )
r   r  r   r   r   r\   r   r<   r   r   r  s       @r   test5z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test5  s{   _, , _,      688D#EE$	$:$:$D$D$F$FGG 61  r222++M9EE 6 6GGGWWYY5556 6 6 6 6 6 6 6 6 6 6 6 6 6 66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s7   AC! C	=C!	C	C!C	C!!C%(C%c                 |   t           j        d             fd} |            }t          j         | |d                                                    5 }                              5  |                                 d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc              3   (   K   | dz  V  | dz  dz   V S r  r   ro  s    r   rq  zHAsyncGenAsyncioTest.test_anext_iter.<locals>.test6.<locals>._async_yield  r  r   c                 8   K     d           d {V  dW V  d S r  r   )rq  s   r   rx  zBAsyncGenAsyncioTest.test_anext_iter.<locals>.test6.<locals>.agenfn  s6      "l1oo%%%%%%%r   r/   )r   r  r   r   r   rx   r   r  s       @r   test6z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test6  sT   _, , _,     688D#EE$	$:$:$D$D$F$FGG 61&&w// 6 6GGGWWYY5556 6 6 6 6 6 6 6 6 6 6 6 6 6 66 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s6   B1- BB1B	B1 B	!B11B58B5c                                          d          5   | t                     d d d            n# 1 swxY w Y                        d          5   | t                     d d d            d S # 1 swxY w Y   d S )Nzpure-Python anext()zbuiltin anext())r   r6   r   )testr@   s    r   run_testz5AsyncGenAsyncioTest.test_anext_iter.<locals>.run_test  s    344  X              /00  U                 s   488A22A69A6)r   r  rU   )r@   r~  r  r  r  r  r  r  rt  rq  rx  s   `       @@@r   test_anext_iterz#AsyncGenAsyncioTest.test_anext_itery  s   		 	 
		 	 	 	 	i 	 	 		 	 	 	 	 		7 	7 	7 	7 	7 	7 	7	6 	6 	6 	6 	6 	6 	6	6 	6 	6 	6 	6 	6	; 	; 	; 	; 	; 	;*	6 	6 	6 	6 	6 	6&	6 	6 	6 	6 	6 	6	 	 	 	 	 	r   c                    d d }fd}d }|                      t                    5  | j                             |                       d d d            n# 1 swxY w Y   |                      t                    5  | j                             |                       d d d            n# 1 swxY w Y   |                      t                    5  | j                             |                       d d d            d S # 1 swxY w Y   d S )Nc                    K   dW V  d S r%  r   r   r   r   r'   z4AsyncGenAsyncioTest.test_aiter_bad_args.<locals>.gen  r&  r   c                  2   K   t                       d {V  d S r"   r  r   r   r   r-  zGAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_too_few_args  r.  r   c                  H   K   t                        d           d {V  d S r%  r  r1  s   r   r2  zHAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_too_many_args  s3      q//!!!!!!!!!r   c                  4   K   t          d           d {V  d S r%  r  r   r   r   call_with_wrong_type_argzIAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_wrong_type_arg  s!      ((NNNNNNNNNr   r8  )r@   r-  r2  r  r'   s       @r   test_aiter_bad_argsz'AsyncGenAsyncioTest.test_aiter_bad_args  s)   	 	 		 	 		" 	" 	" 	" 	"	 	 	y)) 	C 	CI(()?)?)A)ABBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cy)) 	D 	DI(()@)@)B)BCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Dy)) 	E 	EI(()A)A)C)CDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es5   #AA A>#B--B14B1#DD	Dc                 N   K   g }|2 3 d {V }|                     |           6 |S r"   r#   )r@   r'   r%   r&   s       r   r)   zAsyncGenAsyncioTest.to_list  sN       	 	 	 	 	 	 	!JJqMMMM 
s   $c                     d }| j                             |                      |                                }|                     |ddg           d S )Nc                    K   dW V  t                               d           d {V  dW V  t                               d           d {V  d S Nr|   {Gz?r   r   sleepr   r   r   r'   z:AsyncGenAsyncioTest.test_async_gen_asyncio_01.<locals>.gen  si      GGGG--%%%%%%%%%GGGG--%%%%%%%%%Fr   r|   r   r   r   r)   r\   )r@   r'   r%   s      r   test_async_gen_asyncio_01z-AsyncGenAsyncioTest.test_async_gen_asyncio_01   sZ    	 	 	 i**4<<+>+>??q!f%%%%%r   c                     d }|                      t                    5  | j                            |                      |                                 d d d            d S # 1 swxY w Y   d S )Nc                 r   K   dW V  t                               d           d {V  dW V  ddz   dW V  d S )Nr|   r  r   r   r   r  r   r   r   r'   z:AsyncGenAsyncioTest.test_async_gen_asyncio_02.<locals>.gen  sX      GGGG--%%%%%%%%%GGGGEEGGGGGGr   )rx   r}   r   r   r)   ri   s     r   test_async_gen_asyncio_02z-AsyncGenAsyncioTest.test_async_gen_asyncio_02  s    	 	 	 011 	> 	>I((ccee)<)<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   6A!!A%(A%c                     | j         } G d d          }|                    |                      |                                }|                     |ddg           d S )Nc                       e Zd Zd ZdS ):AsyncGenAsyncioTest.test_async_gen_asyncio_03.<locals>.Genc                ^   K   dW V  t                               d           d {V  dW V  d S r  r  r   s    r   rp   zDAsyncGenAsyncioTest.test_async_gen_asyncio_03.<locals>.Gen.__aiter__  sD      mmD)))))))))r   Nr  r   r   r   r  r    s#            r   r  r|   r   r  )r@   r   r  r%   s       r   test_async_gen_asyncio_03z-AsyncGenAsyncioTest.test_async_gen_asyncio_03  sx    y	 	 	 	 	 	 	 	 %%dll3355&9&9::q!f%%%%%r   c                      d  fd} fd} j                              |                        j                              |                       d S )Nc                    K   dW V  t                               d           d {V  	 dW V  dW V  n# t          $ r dW V  Y nw xY wt                               d           d {V  dW V  d S )Nr|   r  r   r        )r   r  r}   r   r   r   fooz@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.foo$  s      GGGG--%%%%%%%%%$   





--%%%%%%%%%GGGGGGs   
4 AAc                    K                                                 }                     |                                  d {V d                               |                                  d {V d                               |                                  d {V d                               |                                  d {V d                               t                    5  |                                  d {V  d d d            n# 1 swxY w Y                       t                    5  |                                  d {V  d d d            d S # 1 swxY w Y   d S )Nr|   r   r   r  )rp   r\   r.   rx   r-   )itr  r@   s    r   run1zAAsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.run1/  s     ""B2<<>>11111115552<<>>11111115552<<>>11111115552<<>>1111111555""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % %""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % % % % %s$   2DD D>E&&E*-E*c                    K                                                 }                     |                                  d {V d                               |                                  d {V d           	 |                                                     t                                         d           n8# t          $ r+}                    |j        d         d           Y d }~nd }~ww xY w                    |                                  d {V d                               t                    5  |                                  d {V  d d d            d S # 1 swxY w Y   d S )Nr|   r   ro   r   r  r  )
rp   r\   r.   r   r}   rq   r   r   rx   r-   r  r   r  r@   s     r   run2zAAsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.run2;  s     ""B2<<>>11111115552<<>>1111111555:$$%6777 		89999 ! 3 3 3  T222222223 2<<>>1111111555""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % % % % %s*   =,B? ?
C4	!C//C4?E''E+.E+r   r   )r@   r  r  r  s   `  @r   test_async_gen_asyncio_anext_04z3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_04#  s    		 		 		
	% 
	% 
	% 
	% 
	% 
	%	% 	% 	% 	% 	% 	% 		$$TTVV,,,	$$TTVV,,,,,r   c                 `     d  fd} j                              |                       d S )Nc                 .   K   dW V } | W V } | dz  W V  d S Nr|   r   r   ro  s    r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05.<locals>.fooN  s/      AAc'MMMMMMr   c                    K                                                 } 	 |                                                     d                                d           n8# t          $ r+}                    |j        d         d           Y d }~nd }~ww xY w	 |                                                     d                               d           n8# t          $ r+}                    |j        d         d           Y d }~nd }~ww xY w	 |                                                     d                               d           n8# t          $ r+}                    |j        d         d           Y d }~nd }~ww xY w                    t                    5  |                                  d {V  d d d            d S # 1 swxY w Y   d S )Nro   r   r|   r      i  )	rp   r.   r   rq   r   r\   r   rx   r-   r  s     r   runz@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05.<locals>.runS  sF     ""B:##D))) 		89999 ! 0 0 0  Q////////0
:##B''' 		89999 ! 1 1 1  R000000001
:##B''' 		89999 ! 3 3 3  T222222223
 ""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % % % % %sY   'A 
B(!BB'C 
D	!DD	'E
 

E?!E::E?GGGr  r@   r  r  s   ` @r   test_async_gen_asyncio_anext_05z3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05M  sU    	 	 	
	% 	% 	% 	% 	% 	%6 		$$SSUU+++++r   c                 j    dd } |            }|                     d                                 t                    5  |                     d            d d d            n# 1 swxY w Y   fd fd} j                             |                                            d           d S )Nr   c               3   $   K   	 d V  d S #  Y d S xY wr"   r   r   r   r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.foot  (         
 c                 ,   K   	 d W V  n#  Y nxY wd d S r%  r   DONEs   r   r'   z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.gen  0      DDD    c                     K                } |                      d            d {V                      t                    5  |                      d            d {V  d d d            n# 1 swxY w Y   dz  d S Nr   )r   rx   r-   rW   r  r'   r@   s    r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.run  s      A''$--""#566 $ $ggdmm#######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $BJDDDs   A++A/2A/   )r   rx   r   r   r   r\   r@   r  rW   r  r  r'   s   `   @@r   test_async_gen_asyncio_anext_06z3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06p  s#   	 	 	
 CEE	t}-- 	 	FF4LLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
	 	 	 	 		 	 	 	 	 	 	 		$$SSUU+++r"""""s   A$$A(+A(c                 `     d  fd} j                              |                       d S )Nc                 B   K   	 dW V  d S # t           $ r	 dW V  Y d S w xY w)Nr|   r   rc  r   r   r   r  zCAsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple.<locals>.foo  sF      





$   






    c                  B  K                                                 }                     |                                  d {V d                               t                    5 }|                                                     t                     d d d            n# 1 swxY w Y                       |j        j        d         d                               t                    5  |                                  d {V  d d d            d S # 1 swxY w Y   d S )Nr  r   r  )
rp   r\   r.   rx   r   r   r}   	exceptionr   r-   )r  cmr  r@   s     r   r  zCAsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple.<locals>.run  s     ""B2<<>>1111114888""=11 8R$$%67778 8 8 8 8 8 8 8 8 8 8 8 8 8 8R\.q14888""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % % % % %s$   (-B!!B%(B%,DDDr  r  s   ` @r   "test_async_gen_asyncio_anext_tuplez6AsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple  sU    	 	 		% 	% 	% 	% 	% 	% 		$$SSUU+++++r   c                 `     d  fd} j                              |                       d S )Nc                 v   K   	 t          d          W V  d S # t          $ r t          d          W V  Y d S w xY wr0  )r   r}   r   r   r   r  zKAsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration.<locals>.foo  sc      '#A&&&&&&&&$ ' ' '#A&&&&&&&&&'s    88c                    K                                                 } |                                  d {V }                    |t                                         |j        d                               t                    5 }|                                                     t                     d d d            n# 1 swxY w Y   |j	        j
        d         }                    |t                                         |j        d                               t                    5  |                                  d {V  d d d            d S # 1 swxY w Y   d S )Nr|   r   r   )rp   r.   r   r   r\   r{  rx   r   r}   r  r   r-   )r  rp  r  r  r@   s      r   r  zKAsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration.<locals>.run  s     ""Bllnn$$$$$$A!!!]333QWa(((""=11 8R$$%67778 8 8 8 8 8 8 8 8 8 8 8 8 8 8!!$A!!!]333QWa(((""#566 % %llnn$$$$$$$% % % % % % % % % % % % % % % % % %s$   
-CC
C0EEEr  r  s   ` @r   *test_async_gen_asyncio_anext_stopiterationz>AsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration  sU    	' 	' 	'	% 	% 	% 	% 	% 	% 		$$SSUU+++++r   c                     d fd}|                      t          d          5  | j                             |                       d d d            d S # 1 swxY w Y   d S )Nc                    K   	 dW V  ddz   t                               d           d {V  dW V  d S # t                               d           d {V  dW V  w xY w)Nr|   r   r  r  r  r   r   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06.<locals>.foo  s      AmmD))))))))) mmD)))))))))s	   
5 'Ac                     K                } |                                  }|                                 d {V  |                                  d {V  d S r"   rp   r.   r   r'   r  r  s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06.<locals>.run  e      #%%CB,,..       **,,r   z%async generator ignored GeneratorExit)r<   r   r   r   r  s     @r    test_async_gen_asyncio_aclose_06z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06  s    	 	 		 	 	 	 	 ##79 9 	0 	0 I((///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s   #AAAc                     dfdfd}| j                              |                       |                     d           d S )Nr   c                 L  K   	 dW V  ddz   t                               d           d {V  t                               d           d {V   dz   nJ# t                               d           d {V  t                               d           d {V   dz   w xY w dz   d S )Nr|   r   r  r  r  r  s   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07.<locals>.foo  s      AmmD)))))))))mmD)))))))))	 mmD)))))))))mmD)))))))))	DLDDDs   
A ABc                     K                } |                                  }|                                 d {V  |                                  d {V  d S r"   r  r  s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07.<locals>.run  r  r   r|   r  )r@   r  r  r  s     @@r    test_async_gen_asyncio_aclose_07z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07  su    		 		 		 		 			 	 	 	 	 		$$SSUU+++q!!!!!r   c                 f    dt                                j                  fd fd} j                             |                                            d                                             j                            t                               d                     d S )Nr   r   c                 f  K   	 dW V   d {V   dz   dW V  t                               d           d {V  t                               d           d {V   dz   nJ# t                               d           d {V  t                               d           d {V   dz   w xY w dz   d S )Nr|   r  r   r  r  )r  r   s   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08.<locals>.foo  s      							mmD)))))))))mmD)))))))))	 mmD)))))))))mmD)))))))))	DLDDDs   A" "AB)c                     K                } |                                  }                    |                                 d {V d           |                                  d {V  d S r%  )rp   r\   r.   r   )r'   r  r  r@   s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08.<locals>.run  su      #%%CB2<<>>1111111555**,,r   r|   r  )r   Futurer   r   r\   cancelr  )r@   r  r  r  r   s   ` @@@r    test_async_gen_asyncio_aclose_08z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08  s    nn$)n,,	 	 	 	 	 		 	 	 	 	 	 		$$SSUU+++q!!! 	

	$$W]]4%8%899999r   c                     dfdfd}| j                              |                       |                     d           d S )Nr   c                    K   	 	 dW V  # t                               d           d {V  t                               d           d {V  d w xY w)NTr|   r  r  r  s   r   r'   zDAsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09.<locals>.gen
  sy      GGGG mmD)))))))))mmD)))))))))s
    AAc                     K                } |                                   d {V  |                                   d {V  ~ t                       t                              d           d {V  d S )N皙?)r.   r   r   r  )rW   r'   s    r   r  zDAsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09.<locals>.run  s      A++--++--LLL--$$$$$$$$$$$r   r|   r  )r@   r  r  r'   s     @@r   #test_async_gen_asyncio_gc_aclose_09z7AsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09  su    	 	 	 	 		% 	% 	% 	% 	% 		$$SSUU+++q!!!!!r   c                     dd } |            }|                     d            |                                 fdfd}| j                             |                       |                     d           d S )Nr   c               3   $   K   	 d V  d S #  Y d S xY wr"   r   r   r   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.foo$  r  r  c                 ,   K   	 d W V  n#  Y nxY wd d S r%  r   r  s   r   r'   zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.gen/  r  r  c                     K                } |                      d            d {V  |                                  d {V  dz  d S r  )r   r   )rW   r  r'   s    r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.run7  sa      A''$--((**BJDDDr   r  )r   r   r   r   r\   r  s       @@r    test_async_gen_asyncio_aclose_10z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10   s    	 	 	
 CEE	t					 	 	 	 		 	 	 	 	 	 		$$SSUU+++r"""""r   c                 j    dd } |            }|                     d                                 t          d          5  |                                 d d d            n# 1 swxY w Y   fd fd} j                             |                                            d           d S )Nr   c               3   ,   K   	 d V  n#  Y nxY wd V  d S r"   r   r   r   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.fooE  s1      EEEEEs   	 ignored GeneratorExitc                 <   K   	 d W V  n#  Y nxY wd W V   dz   d S r%  r   r  s   r   r'   zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.genR  s?      EEEEAIDDDr  c                     K                } |                      d            d {V                      t          d          5  |                                  d {V  d d d            n# 1 swxY w Y   dz  d S )Nr   r   )r   r<   r   r   r  s    r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.run[  s      A''$--''6MNN ! !hhjj       ! ! ! ! ! ! ! ! ! ! ! ! ! ! !BJDDDs   A++A/2A/r   )r   r<   r   r   r   r   r\   r  s   `   @@r    test_async_gen_asyncio_aclose_11z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11A  s$   	 	 	 CEE	t##L2IJJ 	 	GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
	 	 	 	 		 	 	 	 	 	 	 		$$SSUU+++r"""""s   A$$A(+A(c                     dd fdfd}| j                              |                       |                     d           d S )Nr   c                  T   K   t                               d           d {V  ddz   d S )Nr  r|   r   r  r   r   r   targetzDAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.targeti  s7      --%%%%%%%%%EEEEr   c                    K   t                                                      } 	 dW V  	 |  d {V  d S # t          $ r dY d S w xY w# 	 |  d {V  w # t          $ r dY w w xY wxY wr%  )r   create_taskr}   )taskr  r  s    r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.foom  s      &&vvxx00DJJJJJJJJJ(   DDDDJJJJJJJJ(   DDDs>   A
 7 AA
A'AA'A$!A'#A$$A'c                     K                } |                                  }|                                 d {V  |                                  d {V  d S r"   r  r  s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.runx  r  r   r|   r  )r@   r  r  r  r  s     @@@r    test_async_gen_asyncio_aclose_12z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12f  s    	 	 			 		 		 		 		 			 	 	 	 	 		$$SSUU+++q!!!!!r   c                 \    dd } |            }|                     d           }                     |d           |                     d          }                     |d           fd fd} j                             |                                            d           d S )Nr   c               3       K   dV } | dz  V  d S r   r   ro  s    r   sgenzAAsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.sgen  s       Aa%KKKKKr   r|   r      c                   K   	 t                               d           d {V  dW V } t                               d           d {V  | dz  W V  t                               d           d {V  	 t                               d           d {V  t                               d           d {V  dd S # t                               d           d {V  t                               d           d {V  dw xY wNr  r|   r   r  )rp  r  s    r   r'   z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.gen  s>     
mmD)))))))))GGGmmD)))))))))!emmD)))))))))mmD)))))))))mmD))))))))) mmD)))))))))mmD)))))))))s   A-B7 7AC;c                    K                } |                      d            d {V }                    |d           |                      d           d {V }                    |d                               t                    5  |                      d            d {V  d d d            d S # 1 swxY w Y   d S )Nr|   r   r  )r   r\   rx   r-   rW   rp  r'   r@   s     r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.run  s     Aggdmm######AQ"""ggcll""""""AQ$$$""#566 $ $ggdmm#######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   
B33B7:B7)r   r\   r   r   )r@   r  r   rp  r  r  r'   s   `    @@r   test_async_gen_asyncio_asend_01z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01  s    	 	 	 TVVGGDMMAGGCLLC   	 	 	 	 	
	$ 
	$ 
	$ 
	$ 
	$ 
	$ 		$$SSUU+++q!!!!!r   c                     dd fd fd}                      t                    5   j                             |                       d d d            n# 1 swxY w Y                        d           d S )Nr   c                 T   K   t                               |            d {V  ddz   d S Nr|   r   r  )delays    r   sleep_n_crashzJAsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.sleep_n_crash  s7      --&&&&&&&&&EEEEr   c                   K   	 t                               d           d {V  dW V }  d           d {V  dz  | dz  W V  t                               d           d {V  t                               d           d {V  dd S # t                               d           d {V  t                               d           d {V  dw xY wNr  r|   r  r   r  rp  r  r  s    r   r'   z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.gen       	mmD)))))))))GGG#mD)))))))))!emmD)))))))))mmD))))))))) mmD)))))))))mmD)))))))))   AB ACc                     K                } |                      d            d {V }                    |d           |                      d           d {V  d S r  r   r\   r  s     r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.run  q      Aggdmm######AQ"""''#,,r   r|   )rx   r}   r   r   r\   r@   r  r  r'   r  s   ` @@@r   test_async_gen_asyncio_asend_02z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02  s    	 	 		 	 	 	 	 		 	 	 	 	 	 011 	0 	0I((///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0q!!!!!s   #AA#&A#c                     d fdfd fd}                      t          j                  5   j                             |                       d d d            n# 1 swxY w Y                        d           d S )Nr   c                    K   t                               t                               |           j                  j                            | dz  fd            d {V S )Nr  r   c                  ,                                      S r"   r  r   s   r   <lambda>z\AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.sleep_n_crash.<locals>.<lambda>      CJJLL r   r   ensure_futurer  r   
call_laterr  r   r@   s    @r   r  zJAsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.sleep_n_crash  m      ''e(<(<-1Y ( 8 8CI  ,@,@,@,@AAA999999r   c                   K   	 t                               d           d {V  dW V }  d           d {V  dz  | dz  W V  t                               d           d {V  t                               d           d {V  dd S # t                               d           d {V  t                               d           d {V  dw xY wr  r  r  s    r   r'   z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.gen  r  r  c                     K                } |                      d            d {V }                    |d           |                      d           d {V  d S r  r!  r  s     r   r  z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.run  r"  r   r|   )rx   r   CancelledErrorr   r   r\   r#  s   ` @@@r   test_async_gen_asyncio_asend_03z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03  s   	 	 	 	 		 	 	 	 	 		 	 	 	 	 	 w566 	0 	0I((///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0q!!!!!s   #A&&A*-A*c                     d G d dt                     fd} |            }|                    d           }                     |d           |                              }                     |d                                t
                    5  |                    d            d d d            n# 1 swxY w Y   fd fd} j                             |                                            d           d S )	Nr   c                       e Zd ZdS )CAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.FooErNr
   r   r   r   FooErr7    ru  r   r8  c               3   @   K   	 dV } n# $ r d} Y nw xY w| dz  V  d S )Nr|   r  r   r   )rp  r8  s    r   r  zBAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.sgen  sL      GG   a%KKKKKs   
 r|     c                   K   	 t                               d           d {V  	 dW V } n-# $ r% d} t                               d           d {V  Y nw xY w| dz  W V  t                               d           d {V  t                               d           d {V  t                               d           d {V  dd S # t                               d           d {V  t                               d           d {V  dw xY wr  r  )rp  r  r8  s    r   r'   zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.gen  sl     mmD))))))))).AA . . .A!-------------. !emmD))))))))) mmD)))))))))mmD))))))))) mmD)))))))))mmD)))))))))s,    C , C 'AC A+C AD	c                    K                } |                      d            d {V }                    |d           |                                d {V }                    |d                               t                    5  |                      d            d {V  d d d            d S # 1 swxY w Y   d S )Nr|   r:  )r   r\   r   rx   r-   )rW   rp  r8  r'   r@   s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.run  s     Aggdmm######AQ"""hhuoo%%%%%%AQ%%%""#566 $ $ggdmm#######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $r  )rU   r   r\   r   rx   r   r   r   )r@   r  r   rp  r  r  r8  r'   s   `    @@@r    test_async_gen_asyncio_athrow_01z4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01  s   	 	 	 	 	I 	 	 		 	 	 	 	 TVVGGDMMAHHUOOD!!!}-- 	 	GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 		 	 	 	 	 	"
	$ 
	$ 
	$ 
	$ 
	$ 
	$ 
	$ 		$$SSUU+++q!!!!!s   B;;B?B?c                 @    d G d dt                      fdfd fd}                     t          j                  5   j                             |                       d d d            n# 1 swxY w Y                        d           d S )Nr   c                       e Zd ZdS )CAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.FooErNr
   r   r   r   r8  r@  %  ru  r   r8  c                    K   t                               t                               |           j                  j                            | dz  fd            d {V S )Nr  r   c                  ,                                      S r"   r(  r)  s   r   r*  z]AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.sleep_n_crash.<locals>.<lambda>+  r+  r   r,  r/  s    @r   r  zKAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.sleep_n_crash(  r0  r   c                   K   	 t                               d           d {V  	 dW V } n# $ r  d           d {V  Y nw xY w| dz  W V  t                               d           d {V  t                               d           d {V  t                               d           d {V  dd S # t                               d           d {V  t                               d           d {V  dw xY wr  r  )rp  r  r8  r  s    r   r'   zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.gen.  sc     mmD))))))))).AA . . .'------------.!emmD))))))))) mmD)))))))))mmD))))))))) mmD)))))))))mmD)))))))))s,    B4 , B4 AB4 A+B4 4AC8c                  8  K                } |                      d            d {V }                    |d           	 |                                d {V                      d           d S # t          j        $ r                     d            w xY w)Nr|   zCancelledError was not raised)r   r\   r   rq   r   r3  )rW   rp  r  r8  r'   r@   s     r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.run>  s      Aggdmm######AQ""";hhuoo%%%%%%%
 		9:::::	 )     q)))s    A2 2'Br|   )rU   rx   r   r3  r   r   r\   )r@   r  r  r8  r'   r  s   ` @@@@r    test_async_gen_asyncio_athrow_02z4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02"  s@   	 	 	 	 	I 	 	 		 	 	 	 		 	 	 	 	 	 	 	; 	; 	; 	; 	; 	; 	; 	; w566 	0 	0I((///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0q!!!!!s   #A==BBc                 t    dd } |            }|                     d                                 t                    5  |                    t                     d d d            n# 1 swxY w Y   fd fd} j                             |                                            d           d S )Nr   c               3   $   K   	 d V  d S #  Y d S xY wr"   r   r   r   r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.fooT  r  r  c                 ,   K   	 d W V  n#  Y nxY wd d S r%  r   r  s   r   r'   zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.gen`  r  r  c                    K                } |                      d            d {V                      t                    5  |                     t                     d {V  d d d            n# 1 swxY w Y   dz  d S r  )r   rx   r-   r   
ValueErrorr  s    r   r  zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.runh  s      A''$--""#566 + +hhz*********+ + + + + + + + + + + + + + +BJDDDs   !A00A47A4r  )r   rx   r   r   rJ  r   r   r\   r  s   `   @@r    test_async_gen_asyncio_athrow_03z4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03P  s&   	 	 	
 CEE	t}-- 	  	 GGJ	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 
	 	 	 	 		 	 	 	 	 	 	 		$$SSUU+++r"""""s   A))A-0A-c                 `     d  fd} j                              |                       d S )Nc                 B   K   	 dW V  d S # t           $ r	 dW V  Y d S w xY wNr|   r  rc  r   r   r   r'   zDAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuple.<locals>.gent  sF      $   






r  c                    K                } |                      d            d {V }                    |d           |                     t                     d {V }                    |d                               t
                    5  |                      d            d {V  d d d            d S # 1 swxY w Y   d S rN  )r   r\   r   r}   rx   r-   r  s     r   r  zDAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuple.<locals>.runz  s     Aggdmm######AQ"""hh011111111AQ%%%""#566 $ $ggdmm#######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s   B88B<?B<r  r@   r  r'   s   ` @r   #test_async_gen_asyncio_athrow_tuplez7AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuples  sU    	 	 		$ 	$ 	$ 	$ 	$ 	$ 		$$SSUU+++++r   c                 `     d  fd} j                              |                       d S )Nc                 \   K   	 dW V  d S # t           $ r t          d          W V  Y d S w xY wr   )r}   r   r   r   r   r'   zLAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration.<locals>.gen  sU      '$ ' ' '#A&&&&&&&&&'s    ++c                    K                } |                      d            d {V }                    |d           |                     t                     d {V }                    |t
                                         |j        d                               t                    5  |                      d            d {V  d d d            d S # 1 swxY w Y   d S r   )	r   r\   r   r}   r   r   r{  rx   r-   r  s     r   r  zLAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration.<locals>.run  s6     Aggdmm######AQ"""hh011111111A!!!]333QWa(((""#566 $ $ggdmm#######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s   /CCCr  rP  s   ` @r   +test_async_gen_asyncio_athrow_stopiterationz?AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration  sU    	' 	' 	'	$ 	$ 	$ 	$ 	$ 	$ 		$$SSUU+++++r   c                 0   dfdfd}| j                              |                      }| j                              |                      }| j                             t                              d                     |                                 |                                 |                     t          j                  5  | j                             |           d d d            n# 1 swxY w Y   |                     t          j                  5  | j                             |           d d d            n# 1 swxY w Y   | j                             | j                                                    | 	                    d           d S )Nr   c                   K   	 t                               |            d {V  dW V  t                               d           d {V  dz  d S # t                               d           d {V  dz  w xY wr  r  )timeout	finalizeds    r   waiterzFAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01.<locals>.waiter  s      mmG,,,,,,,,,mmA&&&&&&&&&Q			 mmA&&&&&&&&&Q					s   %A 'A8c                  4   K    d          2 3 d {V } 6 d S r%  r   )_rZ  s    r   waitzDAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01.<locals>.wait  sC      !6!99       a %99s   r  r   )
r   r  r   r   r  r  rx   r3  shutdown_asyncgensr\   )r@   r]  t1t2rY  rZ  s       @@r   "test_async_gen_asyncio_shutdown_01z6AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01  s   		 	 	 	 		 	 	 	 	 Y""4466**Y""4466**	$$W]]3%7%7888 			
		w566 	- 	-I((,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-w566 	- 	-I((,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 		$$TY%A%A%C%CDDDA&&&&&s$   C33C7:C7EEEc                     g fdd } |            fd}t                                |                       |                     g            d S )Nc                 2                         |           d S r"   r#   r   contextmessagess     r   exception_handlerzQAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.exception_handler      OOG$$$$$r   c                    K   dW V  dW V  d S r   r   r   r   r   r[   zMAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.async_iterate  r   r   c                     K   t                                           } |                                2 3 d {V } d S 6 d S r"   r   get_running_loopset_exception_handlerr   r&   rg  r  s     r   mainzDAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.main  e      ++--D&&'8999       a 22   >r   r  r\   )r@   r[   ro  rg  r  rf  s      @@@r   "test_async_gen_asyncio_shutdown_02z6AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02  s    	% 	% 	% 	% 	%	 	 	 ]__	 	 	 	 	 	 	DDFF2&&&&&r   c                 >   g fdd } |            fd}t                                |                       \  }|                     |d                    |                     |d         t                     |                     d|d                    d S )Nc                 2                         |           d S r"   r#   rd  s     r   rg  z[AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.exception_handler  rh  r   c                 >   K   	 dW V  dW V  ddz   d S # ddz   w xY wNr|   r   r   r   r   r   r   r[   zWAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.async_iterate  <      !!   
 c                     K   t                                           } |                                2 3 d {V } d S 6 d S r"   rk  rn  s     r   ro  zNAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.main  rp  rq  asyncgenr  z:an error occurred during closing of asynchronous generatormessage)r   r  r\   r   r}   r   )r@   r[   ro  r|  rg  r  rf  s       @@@r   ,test_async_gen_asyncio_shutdown_exception_01z@AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01  s    	% 	% 	% 	% 	%	 	 	 ]__	 	 	 	 	 	 	DDFF,b111gk24EFFFRi(	* 	* 	* 	* 	*r   c                     g fdd fd}t                                |                       \  }|                     |d         t                     |                     d|d                    d S )Nc                 2                         |           d S r"   r#   rd  s     r   rg  z[AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.exception_handler  rh  r   c                 >   K   	 dW V  dW V  ddz   d S # ddz   w xY wrw  r   r   r   r   r[   zWAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.async_iterate  rx  ry  c                     K   t                                           } |                                             2 3 d {V } n6 t                       d S r"   )r   rl  rm  r   r   r&   r[   rg  s     r   ro  zNAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.main  sr      ++--D&&'8999(=??       a +LLLLLs   Ar  z1unhandled exception during asyncio.run() shutdownr|  )r   r  r   r}   r   )r@   ro  r|  r[   rg  rf  s      @@@r   ,test_async_gen_asyncio_shutdown_exception_02z@AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02  s    	% 	% 	% 	% 	%	 	 		 	 	 	 	 	 	DDFFgk24EFFFIi(	* 	* 	* 	* 	*r   c                     d fdfd}| j                              |                      }|                     |d t          d          D                        d S )Nc                x   K   t          |           D ]'}t                              d           d {V  |W V  (d S Nr  )ranger   r  )nr&   s     r   arangez@AsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.arange
  sV      1XX  mmD))))))))) r   c                 .    d  |           2             S )Nc                .   K   | 3 d {V }|dz  W V  6 d S Nr   r   r  s     r   	<genexpr>zXAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.make_arange.<locals>.<genexpr>  s;      3333333AAE33333333s   r   )r  r  s    r   make_arangezEAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.make_arange  s    333333r   c                  >   K   d   d          2              d {V S )Nc                 "   K   g | 3 d {V }|
6 S r"   r   r  s     r   r  zQAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.run.<locals>.<listcomp>  .      55555555A5555r  r   r   r  s   r   r  z=AsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.run  5      55[[__5555555555r   c                     g | ]}|d z  S r  r   r  s     r   r  zDAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.<listcomp>  s    888q1u888r   r   r   r   r\   r  )r@   r  r%   r  r  s      @@r   test_async_gen_expression_01z0AsyncGenAsyncioTest.test_async_gen_expression_01	  s    	 	 	
	4 	4 	4 	4 	4	6 	6 	6 	6 	6 i**33551188eBii88899999r   c                     d fdfd}| j                              |                      }|                     |d t          dd          D                        d S )Nc                 J   K   t                               d           d {V  | S r  r  )r  s    r   wrapz>AsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.wrap  s/      --%%%%%%%%%Hr   c                 :    fdt          |           D             S )Nc                F   K   | ]} |           d {V |dz  W V  d S r  r   )r  r&   r  s     r   r  zXAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.make_arange.<locals>.<genexpr>   sC      ==aTT!WW}}}}}}=AE=======r   )r  )r  r  s    r   r  zEAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.make_arange  s#    ====588====r   c                  >   K   d   d          2              d {V S )Nc                 "   K   g | 3 d {V }|
6 S r"   r   r  s     r   r  zQAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.run.<locals>.<listcomp>#  r  r  r   r   r  s   r   r  z=AsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.run"  r  r   c                     g | ]}|d z  S r  r   r  s     r   r  zDAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.<listcomp>&  s    ;;;q1u;;;r   r|   r   r  )r@   r  r%   r  r  s      @@r   test_async_gen_expression_02z0AsyncGenAsyncioTest.test_async_gen_expression_02  s    	 	 		> 	> 	> 	> 	>	6 	6 	6 	6 	6 i**335511;;eArll;;;<<<<<r   c                     g fdd fd}t                                |                       |                     g            d S )Nc                 2                         |           d S r"   r#   rd  s     r   rg  z]AsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.exception_handler,  rh  r   c                    K   dW V  dW V  d S r   r   r   r   r   r[   zYAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.async_iterate/  r   r   c                     K   t                                           } |                                             2 3 d {V } d S 6 d S r"   rk  r  s     r   ro  zPAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.main3  sk      ++--D&&'8999(=??       a +??s   Arr  )r@   ro  r[   rg  rf  s     @@@r   .test_asyncgen_nonstarted_hooks_are_cancellablezBAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable(  s    	% 	% 	% 	% 	%	 	 		 	 	 	 	 	 	DDFFX&&&&&r   c                 `     d  fd} j                              |                       d S )Nc                    K   dW V  dW V  d S r   r   r   r   r   r[   zUAsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice.<locals>.async_iterate?  r   r   c                    K                } |                                  }| d {V                      t          d          5  | d {V  d d d            n# 1 swxY w Y   |                                  d {V  d S )Nz4cannot reuse already awaited __anext__\(\)/asend\(\))r.   r<   r   r   r  nxtr[   r@   s     r   r  zKAsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice.<locals>.runC  s      B,,..CIIIIIII'' K    								               ))++s   	AA!Ar  r@   r  r[   s   ` @r   *test_async_gen_await_same_anext_coro_twicez>AsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice>  sU    	 	 	
	 
	 
	 
	 
	 
	 		$$SSUU+++++r   c                 `     d  fd} j                              |                       d S )Nc                    K   dW V  dW V  d S r   r   r   r   r   r[   zVAsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twice.<locals>.async_iterateR  r   r   c                     K                } |                                  }| d {V                      t          d          5  | d {V  d d d            d S # 1 swxY w Y   d S )Nz2cannot reuse already awaited aclose\(\)/athrow\(\))r   r<   r   r  s     r   r  zLAsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twice.<locals>.runV  s      B))++CIIIIIII'' I    								                 s   	AA"Ar  r  s   ` @r   +test_async_gen_await_same_aclose_coro_twicez?AsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twiceQ  sU    	 	 		 	 	 	 	 	 		$$SSUU+++++r   c                 \    d fd}| j                              |                       d S )Nc                    K   dW V  dW V  d S r   r   r   r   r   r[   z[AsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coros.<locals>.async_iterated  r   r   c                     K                } |                                   d {V  |                                   d {V  d S r"   r   )r  r[   s    r   r  zQAsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coros.<locals>.runh  sX      B))++))++r   r  r  s     @r   0test_async_gen_aclose_twice_with_different_coroszDAsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_corosb  sO    	 	 		 	 	 	 	
 		$$SSUU+++++r   c                 \    d fd}| j                              |                       d S )Nc                    K   dW V  dW V  d S r   r   r   r   r   r[   zQAsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustion.<locals>.async_iterateq  r   r   c                  j   K                } | 2 3 d {V }6 |                                   d {V  d S r"   r  )r  r\  r[   s     r   r  zGAsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustion.<locals>.runu  sh      B       a ))++s   r  r  s     @r   &test_async_gen_aclose_after_exhaustionz:AsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustiono  sO    	 	 		 	 	 	 	 		$$SSUU+++++r   c                 \    d fd}| j                              |                       d S )Nc                 ,   K   t                      W V  d S r"   )objectr   r   r   async_generatorz\AsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack.<locals>.async_generator~  s      ((NNNNNNr   c                     K                } t                               |                                            t                                           }|D ]}|                                 d S r"   )r   r  r   	all_tasks	get_stack)agtasksr	  r  s      r   r  zPAsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack.<locals>.run  sm       ""B		,,,%%''E ! !    ! !r   r  )r@   r  r  s     @r   /test_async_gen_aclose_compatible_with_get_stackzCAsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack}  sO    	 	 		! 	! 	! 	! 	! 		$$SSUU+++++r   N)9r   r   r   r   r   r   r   r   r  r  r  r"  r)  r9  rI  rM  rW  r^  rl  r  r  r)   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r4  r=  rE  rK  rQ  rU  ra  rs  r}  r  r  r  r  r  r  r  r  r  r   r   r   r   r     sU       % % %, , ,
? ? ?1. 1. 1.f. . .5 5 5B B B&& & &* * *"3 3 3< < <(. . .*  . . .. . .. . .*o o obE E E   
& 
& 
&	> 	> 	>
& 
& 
&(- (- (-T!, !, !,F!# !# !#F, , ,&, , ,.0 0 0(" " ".: : :>" " "2# # #B## ## ##J" " "6(" (" ("T" " "@ "  "  "D3" 3" 3"j," ," ,"\!# !# !#F, , ,$, , ,& '  '  'D' ' ',* * *:* * *8: : : = = =' ' ',, , ,&, , ,", , ,, , ,, , , , ,r   r   __main__)r   r   unittestr   test.support.import_helperr   test.supportr   r   r   r  r5   rU   r	   r  r   r   r)   r6   TestCaser8   rP   r   r   ro  r   r   r   <module>r     s          4 4 4 4 4 4 < < < < < < < <
-	
"
"  t $ $ $ $fhh	 	 	 	 	Y 	 	 	         ) ) )  +    >. . . . .* . . .bI9 I9 I9 I9 I98$ I9 I9 I9Xw, w, w, w, w,(+ w, w, w,t' zHMOOOOO r   