HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_asyncgen.cpython-310.opt-2.pyc
o

�i/��@s�ddlZddlZddlZddlZddlmZddlmZed�Ze	�Z
Gdd�de�Zej
dd�d	d
��Zdd�Zd
d�Ze
fdd�ZGdd�dej�ZGdd�dej�ZGdd�dej�Zedkrhe��dSdS)�N)�
import_module)�
gc_collect�asyncioc@�eZdZdS)�AwaitExceptionN��__name__�
__module__�__qualname__�rr�//usr/local/lib/python3.10/test/test_asyncgen.pyr�rF��throwccs�|rdVdSdVdS)Nr��resultrrrrr�	awaitables�

rc
Csfd}	z|rd}|�t�}n|�d�}Wnty+}z|jdWYd}~Sd}~ww|dkr2d}q)NFTrr)rr�send�
StopIteration�args)�coro�exc�fut�exrrr�run_until_completes
����rcs�fdd�}t|��S)Nc�s(�g}�2z3dHW}|�|�q6|S�N��append)�res�i��genrr�iterate+���zto_list.<locals>.iterate)r)r!r"rr r�to_list*s
r$csT	zt��j�Wntyt��d���w�tur���S���fdd�}|�S)Nz is not an async iteratorc�s*�z���IdHWSty�YSwr��StopAsyncIterationr��	__anext__�default�iteratorrr�
anext_implEs��zpy_anext.<locals>.anext_impl)�typer(�AttributeError�	TypeError�_no_default)r*r)r+rr'r�py_anext4s�r0c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�AsyncGenSyntaxTestcC�Bd}|�td��t|ii�Wd�dS1swYdS)NzJasync def foo():
            await abc
            yield from 123
        �yield from.*inside async��assertRaisesRegex�SyntaxError�exec��self�coderrr�test_async_gen_syntax_01U�"�z+AsyncGenSyntaxTest.test_async_gen_syntax_01cCr2)Nz4async def foo():
            yield from 123
        r3r4r8rrr�test_async_gen_syntax_02^s"�z+AsyncGenSyntaxTest.test_async_gen_syntax_02cCr2)NzXasync def foo():
            await abc
            yield
            return 123
        �return.*value.*async genr4r8rrr�test_async_gen_syntax_03f�"�z+AsyncGenSyntaxTest.test_async_gen_syntax_03cCr2)NzBasync def foo():
            yield
            return 123
        r>r4r8rrr�test_async_gen_syntax_04pr<z+AsyncGenSyntaxTest.test_async_gen_syntax_04cCr2)NzWasync def foo():
            if 0:
                yield
            return 12
        r>r4r8rrr�test_async_gen_syntax_05yr@z+AsyncGenSyntaxTest.test_async_gen_syntax_05N)rr	r
r;r=r?rArBrrrrr1Ss	
	r1c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�AsyncGenTestcCs0dd�}dd�}||�}||�}|�||�|S)Nc
Ssng}	z	|�|���Wn)ty|�d�Y|Sty5}z|�tt|���WYd}~nd}~wwq)NT�STOP)r�__next__r�	Exception�strr,)�grrrrr�sync_iterate�s
����z5AsyncGenTest.compare_generators.<locals>.sync_iteratec
Ss�g}	|��}zT	z|��WnIty7}z|jr(|�|jd�WYd}~n2|�d�WYd}~n'd}~wty>�tyX}z|�tt|���WYd}~nd}~wwq	Wntyj|�d�Y|Swq)NTrzEMPTY StopIterationrD)	r(rErrrr&rFrGr,)rHr�anrrrr�
async_iterate�s:
�����
��z6AsyncGenTest.compare_generators.<locals>.async_iterate)�assertEqual)r9�sync_gen�	async_genrIrKZsync_gen_resultZasync_gen_resultrrr�compare_generators�szAsyncGenTest.compare_generatorscs&�fdd�}��t|��gd��dS)NcsH�t�IdHdV}��|d�t�IdHdVt�IdHdVdS)N�{���)r�assertIs)�a�r9rrr!�s�
z5AsyncGenTest.test_async_gen_iteration_01.<locals>.gen)rPrQrR)rLr$�r9r!rrUr�test_async_gen_iteration_01�s	z(AsyncGenTest.test_async_gen_iteration_01c
Cs�dd�}|�}|��}|��}|�|��d�z|��Wnty8}z|�|jdd�WYd}~n
d}~ww|�d�|��}|�|��d�z|��Wntyi}z
|�|j�WYd}~dSd}~ww|�d�dS)NcSs$�t�IdHdVt�IdHdS�NrP�rrrrrr!�s�z5AsyncGenTest.test_async_gen_iteration_02.<locals>.genrrrP�StopIteration was not raisedz!StopAsyncIteration was not raised)	�	__aiter__r(rLrErr�failr&�assertFalse�r9r!rHZairJrrrr�test_async_gen_iteration_02�s*��
��z(AsyncGenTest.test_async_gen_iteration_02cCsBdd�}|�t��t|��Wd�dS1swYdS)NcSs.�t�IdHdVtdd�IdHdVdS)NrPTrrQrYrrrrr!�s
�
z5AsyncGenTest.test_async_gen_exception_03.<locals>.gen)�assertRaisesrr$rVrrr�test_async_gen_exception_03�s"�z(AsyncGenTest.test_async_gen_exception_03c
Cs�dd�}|�}|��}|��}|�|��d�z|��Wnty8}z|�|jdd�WYd}~n
d}~ww|�d�|�t��|����Wd�dS1sUwYdS)NcSs �t�IdHdVdddS)NrP�rrYrrrrr!�s�z5AsyncGenTest.test_async_gen_exception_04.<locals>.genrrrPrZ)	r[r(rLrErrr\r`�ZeroDivisionErrorr^rrr�test_async_gen_exception_04�s��
"�z(AsyncGenTest.test_async_gen_exception_04cC�Ddd�}|�td��t|��Wd�dS1swYdS)NcS��dVt�rXr%rrrrr!���z5AsyncGenTest.test_async_gen_exception_05.<locals>.genz#async generator.*StopAsyncIteration�r5�RuntimeErrorr$rVrrr�test_async_gen_exception_05���"�z(AsyncGenTest.test_async_gen_exception_05cCre)NcSrfrX)rrrrrr!rgz5AsyncGenTest.test_async_gen_exception_06.<locals>.genzasync generator.*StopIterationrhrVrrr�test_async_gen_exception_06rkz(AsyncGenTest.test_async_gen_exception_06cC�$dd�}dd�}|�|�|��dS)Ncs�:�zdVddWdVdVndVdVwdVdS�Nrbr���drrrrrrM��
�
z:AsyncGenTest.test_async_gen_exception_07.<locals>.sync_gencSs:�zdVddWdVdVndVdVwdVdSrorrrrrrNrsz;AsyncGenTest.test_async_gen_exception_07.<locals>.async_gen�rO�r9rMrNrrr�test_async_gen_exception_07s

z(AsyncGenTest.test_async_gen_exception_07cCrm)NcssB�zdVWdVdddVndVdddVwdVdS�NrbrprrqrrrrrrrrM#s��
z:AsyncGenTest.test_async_gen_exception_08.<locals>.sync_gencSsf�zdVt�IdHWt�IdHdVdddVnt�IdHdVdddVwdVdSrwrYrrrrrN-s��
z;AsyncGenTest.test_async_gen_exception_08.<locals>.async_genrtrurrr�test_async_gen_exception_08"�
z(AsyncGenTest.test_async_gen_exception_08cCrm)NcsrnrorrrrrrM<rsz:AsyncGenTest.test_async_gen_exception_09.<locals>.sync_gencSs^�zt�IdHdVddWdVt�IdHdVn
dVt�IdHdVwdVdSrorYrrrrrNFs�
�
z;AsyncGenTest.test_async_gen_exception_09.<locals>.async_genrtrurrr�test_async_gen_exception_09;ryz(AsyncGenTest.test_async_gen_exception_09cCsJdd�}|�td��|����d�Wd�dS1swYdS)NcS��dVdSrXrrrrrr!U��
z5AsyncGenTest.test_async_gen_exception_10.<locals>.genz!non-None value .* async generatorrr)r5r.r(rrVrrr�test_async_gen_exception_10Ts�"�z(AsyncGenTest.test_async_gen_exception_10cs<dd���fdd�}dd���fdd�}|�|�|��dS)	Ncss�dVdVdS�N�
�rrrrrrM\��
z:AsyncGenTest.test_async_gen_exception_11.<locals>.sync_genc3sL�dV��}|�d�z|�t��Wnty dVYnwdVdS�Nrbrprq)rr�
GeneratorExit)�sg)rMrr�sync_gen_wrapper`s�

�
zBAsyncGenTest.test_async_gen_exception_11.<locals>.sync_gen_wrappercS��dVdVdSr~rrrrrrNjr�z;AsyncGenTest.test_async_gen_exception_11.<locals>.async_gencsX�dV��}|�d�IdHz|�t��IdHWnty&dVYnwdVdSr�)�asend�athrowr�)Zasg)rNrr�async_gen_wrapperns�
�
zCAsyncGenTest.test_async_gen_exception_11.<locals>.async_gen_wrapperrt)r9r�r�r)rNrMr�test_async_gen_exception_11[s


z(AsyncGenTest.test_async_gen_exception_11cCs�dd�}|�}|�|jd�d|_|�|jd�|�d|j�d|_|�|jd�|�|j�|�|jtj	�|�
|j�|�|jtj
�|�t�|����dS)NcSr{rXrrrrrr!{r|z/AsyncGenTest.test_async_gen_api_01.<locals>.genr!Z123z.gen)rLr�assertInr
ZassertIsNone�ag_await�assertIsInstance�ag_frame�types�	FrameTyper]�
ag_running�ag_code�CodeTypeZ
assertTrue�inspectZisawaitable�aclose)r9r!rHrrr�test_async_gen_api_01zsz"AsyncGenTest.test_async_gen_api_01N)rr	r
rOrWr_rardrjrlrvrxrzr}r�r�rrrrrC�s+
		rCc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmS)n�AsyncGenAsyncioTestcCst��|_t�d�dSr)rZnew_event_loop�loopZset_event_looprUrrr�setUp�s
zAsyncGenAsyncioTest.setUpcCs|j��d|_t�d�dSr)r��closerZset_event_loop_policyrUrrr�tearDown�s
zAsyncGenAsyncioTest.tearDowncCsv|jdd��|�|t�Wd�n1swY|jdd��|�|t�Wd�dS1s4wYdS)Nzpure-Python��anextZbuiltin)�subTest�_check_async_iterator_anextr0r�)r9�	ait_classrrr�check_async_iterator_anext�s�"�z.AsyncGenAsyncioTest.check_async_iterator_anextc	s������fdd�}�j�|��}��|gd����t���j�|��Wd�n1s0wY���fdd�}�j�|��}��|d����fdd�}|����fd	d
�}�j�|��}��|d�dS)Nc�sH�g}|����IdH�|����IdH�|���d�IdH�|S)N�buckle my shoer)�results)r�rHrr�consume�s�z@AsyncGenAsyncioTest._check_async_iterator_anext.<locals>.consume)rbrpr�c�s���}���|�IdHd����|�IdHd���t���|�IdHWd�n1s1wY��t���|�IdHWd�n1sMwY��}���|d�IdHd����|d�IdHd����|d�IdHd����|d�IdHd�dS)Nrbrpr)�	completed)rLr`r&)Zg1Zg2�r�r�r9rr�test_2�s ���z?AsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_2r�c	s���}�|d�}��t��-t�|����
}|�d�Wd�n1s%wYWd�dSWd�dS1s=wYdS�Nr�)r`r�
contextlib�closing�	__await__r)�p�objrHr�rr�	test_send�s
��"�zBAsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_sendc�s&���}�|d�}��t|jt�dSr�)r`r6r)r�r�r�rr�
test_throw�s
�
zCAsyncGenAsyncioTest._check_async_iterator_anext.<locals>.test_throw)r�rrLr`r&)	r9r�r�r�rr�rr�r�r)r�r�rHr9rr��s�z/AsyncGenAsyncioTest._check_async_iterator_anextcCsdd�}|�|�dS)NcSr��Nrbrprrrrr�agen�r�z<AsyncGenAsyncioTest.test_async_generator_anext.<locals>.agen�r�)r9r�rrr�test_async_generator_anext�sz.AsyncGenAsyncioTest.test_async_generator_anextcCsGdd�d�}|�|�dS)Nc@s&eZdZ	dd�Zdd�Zdd�ZdS)zIAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncItercS�
d|_dS�Nr��yieldedrUrrr�__init__��
zRAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__init__cS�|SrrrUrrrr[��zSAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__aiter__c�s&�|jdkr	t��|jd7_|jS)Nrprb�r�r&rUrrrr(�s
�
zSAsyncGenAsyncioTest.test_python_async_iterator_anext.<locals>.MyAsyncIter.__anext__N)rr	r
r�r[r(rrrr�MyAsyncIter�s
r�r�)r9r�rrr� test_python_async_iterator_anext�sz4AsyncGenAsyncioTest.test_python_async_iterator_anextcs(ddl�G�fdd�d�}|�|�dS)Nrcs,eZdZ	dd�Zdd�Z�jdd��ZdS)zfAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCorocSr�r�r�rUrrrr��r�zoAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__init__cSr�rrrUrrrr[�r�zpAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__aiter__css(�	|jdkr
t��|jd7_|jS)NFz#this is a generator-based coroutinerprbr�rUrrrr(�s�
zpAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anext.<locals>.MyAsyncIterWithTypesCoro.__anext__N)rr	r
r�r[�	coroutiner(r�r�rr�MyAsyncIterWithTypesCoro�sr�)r�r�)r9r�rr�r�0test_python_async_iterator_types_coroutine_anext�szDAsyncGenAsyncioTest.test_python_async_iterator_types_coroutine_anextcs<dd�}|���fdd�}|j�|��}|�|ddg�dS)NcSr�r�rrrrrr!�r�z5AsyncGenAsyncioTest.test_async_gen_aiter.<locals>.genc�s�dd�t��2�IdHS)Nc���g|z3dHW}|�q6Srr��.0rrrr�
<listcomp>��zMAsyncGenAsyncioTest.test_async_gen_aiter.<locals>.consume.<locals>.<listcomp>��aiterr�rHrrr���z9AsyncGenAsyncioTest.test_async_gen_aiter.<locals>.consumerbrp�r�rrL)r9r!r�rrr�r�test_async_gen_aiter�s
z(AsyncGenAsyncioTest.test_async_gen_aitercsHg�Gdd�d�}|����fdd�}|j�|��|��ddg�dS)Nc@�eZdZdd�ZdS)z;AsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.GencSr�r�rrUrrrr[	r�zEAsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.Gen.__aiter__N�rr	r
r[rrrr�Gen�r�c�s<�t��}	z��t|�IdH�Wn
tyYdSwqr)r�rr�r&)Zait�rHr�rrr�
s���z?AsyncGenAsyncioTest.test_async_gen_aiter_class.<locals>.consumerbrpr�)r9r�r�rr�r�test_async_gen_aiter_classsz.AsyncGenAsyncioTest.test_async_gen_aiter_classcCs*dd�}t|��}t|�}|�||�dS)NcSr{�Nrbrrrrrr!r|z6AsyncGenAsyncioTest.test_aiter_idempotent.<locals>.gen)r�rS)r9r!Zapplied_onceZ
applied_twicerrr�test_aiter_idempotents
z)AsyncGenAsyncioTest.test_aiter_idempotentcsdd��dd�}�fdd�}�fdd�}�fd	d
�}|�t��|j�|��Wd�n1s1wY|�t��|j�|��Wd�n1sMwY|�t��|j�|��Wd�n1siwY|�t��|j�|��Wd�dS1s�wYdS)NcSr{r�rrrrrr!r|z4AsyncGenAsyncioTest.test_anext_bad_args.<locals>.genc���t�IdHdSrr�rrrr�call_with_too_few_args!��zGAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_too_few_argsc�s�t��dd�IdHdS�Nrbrqr�rr rr�call_with_too_many_args#r�zHAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_too_many_argsc�s�td���IdHdSr�r�rr rr�call_with_wrong_type_args%��zJAsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_wrong_type_argsc�s�t��d�IdHdS)N)Z	aiteratorr�rr rr�call_with_kwarg'r�z@AsyncGenAsyncioTest.test_anext_bad_args.<locals>.call_with_kwarg�r`r.r�r)r9r�r�r�r�rr r�test_anext_bad_argss"���"�z'AsyncGenAsyncioTest.test_anext_bad_argscs*�fdd�}�j�|��}��|d�dS)Nc�s��Gdd�d��G�fdd�d�}d}t|�d�}��t|��
|IdHWd�n1s/wYt|��}��t|��|IdHWd�dS1sPwYdS)Nc@r�)zUAsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.BadAwaitablecSsdS)N�*rrUrrrr�5r�z_AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.BadAwaitable.__await__N�rr	r
r�rrrr�BadAwaitable4r�r�c� eZdZdd�Z�fdd�ZdS)zTAsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncItercSr�rrrUrrrr[8r�z^AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncIter.__aiter__c���SrrrU�r�rrr(:�z^AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitable.<locals>.MyAsyncIter.__anext__N�rr	r
r[r(rr�rrr�7�r�z__await__.*iteratorr)r�)r�r5r.)r�ZregexrrUr�r�
bad_awaitable3s��

��z?AsyncGenAsyncioTest.test_anext_bad_await.<locals>.bad_awaitabler�r�)r9r�rrrUr�test_anext_bad_await2sz(AsyncGenAsyncioTest.test_anext_bad_awaitc�s��t|�d�}|�t��
|IdHWd�n1swYt|��}|�t��|IdHWd�dS1s<wYdS�Nr)r�)r�r`r.)r9Zaiter_classrrrr�check_anext_returning_iteratorGs��

��z2AsyncGenAsyncioTest.check_anext_returning_iteratorcC�0Gdd�d�}|j�|�|��}|�|d�dS)Nc@�eZdZdd�Zdd�ZdS)zEAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnextcSr�rrrUrrrr[Rr�zOAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnext.__aiter__cSstd�S)N�abc)�iterrUrrrr(TszOAsyncGenAsyncioTest.test_anext_return_iterator.<locals>.WithIterAnext.__anext__Nr�rrrr�
WithIterAnextQ�r�r��r�rr�rL)r9r�rrrr�test_anext_return_iteratorP�z.AsyncGenAsyncioTest.test_anext_return_iteratorcCr�)Nc@r�)zEAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnextcSr�rrrUrrrr[[r�zOAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnext.__aiter__css�dVdSrrrUrrrr(]r|zOAsyncGenAsyncioTest.test_anext_return_generator.<locals>.WithGenAnext.__anext__Nr�rrrr�WithGenAnextZr�r�r�r�)r9r�rrrr�test_anext_return_generatorYr�z/AsyncGenAsyncioTest.test_anext_return_generatorcsLGdd�d��G�fdd�d����fdd�}�j�|��}��|d�dS)Nc@r�)zEAsyncGenAsyncioTest.test_anext_await_raises.<locals>.RaisingAwaitablecss�t��r�rcrUrrrr�ds�zOAsyncGenAsyncioTest.test_anext_await_raises.<locals>.RaisingAwaitable.__await__Nr�rrrr�RaisingAwaitablecr�r�cr�)zNAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnextcSr�rrrUrrrr[hr�zXAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnext.__aiter__cr�rrrU�r�rrr(jr�zXAsyncGenAsyncioTest.test_anext_await_raises.<locals>.WithRaisingAwaitableAnext.__anext__Nr�rr�rr�WithRaisingAwaitableAnextgr�r�c�s��t���}��t��
|IdHWd�n1swYt��d�}��t��|IdHWd�dS1s<wYdSr�)r�r`rcrY)r�r9rr�do_testls�
�
��z<AsyncGenAsyncioTest.test_anext_await_raises.<locals>.do_testr�r�)r9r�rr)r�r�r9r�test_anext_await_raisesbs
z+AsyncGenAsyncioTest.test_anext_await_raisescs�tjdd���Gdd�dt����fdd�����fdd�}���fd	d
�}��fdd�}��fd
d�}��fdd�}��fdd�}�fdd�}||�||�||�||�||�||�dS)Ncss�|VSrr��vrrr�_async_yieldxs�z9AsyncGenAsyncioTest.test_anext_iter.<locals>._async_yieldc@r)z4AsyncGenAsyncioTest.test_anext_iter.<locals>.MyErrorNrrrrr�MyError|r
rc�:�z
�d�IdHWdS�y�d�IdHYdSwr�rr�rrrr�agenfn����z3AsyncGenAsyncioTest.test_anext_iter.<locals>.agenfncs���}t�||d�����F}��|�d�d���|����d�d�z|�d�Wnty>}z|}WYd}~n
d}~ww��d���|jd�Wd�dS1sVwYdS)Nr)rbrprZ)	r�r�r�rLrrrr\�value)r�r�rH�e�err�rrr9rr�test1�s��
"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test1c	s���}t�||d�����C}��|�d�d���|����d�d������|����d�Wd�n1s;wYWd�dSWd�dS1sSwYdS)Nr)rbrp)r�r�r�rLrrr`�r�r�rHr	rr�test2�s��"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test2c	s���}t�||d�����=}��|�d�d�|����td����|�d�d�Wd�n1s5wYWd�dSWd�dS1sMwYdS)Nr)rbzcannot reuse)r�r�r�rLrr�r5rir)rr9rr�test3�s��"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test3c	s�tjdd�����fdd�}|�}t�||d�����E}��|�d�d���|����d�d����d��|���d�d�Wd�n1sKwYWd�dSWd�dS1scwYdS)	Ncs��|dV|ddVS�Nrrbrr�rrrr���
zHAsyncGenAsyncioTest.test_anext_iter.<locals>.test4.<locals>._async_yieldcrr�rrrrrr�rzBAsyncGenAsyncioTest.test_anext_iter.<locals>.test4.<locals>.agenfnr)rr��val)	r�r�r�r�r�rLrrr5�r�rr�rH�rr9�rr�test4�s
��"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test4c	s�tjdd�����fdd�}|�}t�||d�����8}��|�d�d���td��|�	���d�Wd�n1s>wYWd�dSWd�dS1sVwYdS)Ncsrrrr�rrrr�rzHAsyncGenAsyncioTest.test_anext_iter.<locals>.test5.<locals>._async_yieldcs4�z	�d�IdHWn
�yYdSwdVdS�NrbZaaarrrrrr�s��
zBAsyncGenAsyncioTest.test_anext_iter.<locals>.test5.<locals>.agenfnr)r)
r�r�r�r�r�rLrr5rrrrrr�test5�s
��"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test5c	s�tjdd����fdd�}|�}t�||d�����.}�����|����d�Wd�n1s3wYWd�dSWd�dS1sKwYdS)Ncsrrrr�rrrr�rzHAsyncGenAsyncioTest.test_anext_iter.<locals>.test6.<locals>._async_yieldcs��d�IdHdVdSrrrrrrr�s�
zBAsyncGenAsyncioTest.test_anext_iter.<locals>.test6.<locals>.agenfnr))r�r�r�r�r�r`rrrrr�test6�s
��"�z2AsyncGenAsyncioTest.test_anext_iter.<locals>.test6csj��d��|t�Wd�n1swY��d��
|t�Wd�dS1s.wYdS)Nzpure-Python anext()zbuiltin anext())r�r0r�)�testrUrr�run_test�s
�
"�z5AsyncGenAsyncioTest.test_anext_iter.<locals>.run_test)r�r�rF)r9r
rr
rrrrr)rrrr9r�test_anext_iterws"

z#AsyncGenAsyncioTest.test_anext_itercs�dd��dd�}�fdd�}dd�}|�t��|j�|��Wd�n1s)wY|�t��|j�|��Wd�n1sEwY|�t��|j�|��Wd�dS1sbwYdS)	NcSr{r�rrrrrr!�r|z4AsyncGenAsyncioTest.test_aiter_bad_args.<locals>.genc�r�rr�rrrrr��r�zGAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_too_few_argsc�s�t��d�IdHdSr�r�rr rrr��r�zHAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_too_many_argsc�s�td�IdHdSr�r�rrrr�call_with_wrong_type_arg�s�zIAsyncGenAsyncioTest.test_aiter_bad_args.<locals>.call_with_wrong_type_argr�)r9r�r�rrr r�test_aiter_bad_args�s��"�z'AsyncGenAsyncioTest.test_aiter_bad_argsc�s(�g}|2z3dHW}|�|�q6|Srr)r9r!rrrrrr$�r#zAsyncGenAsyncioTest.to_listcCs0dd�}|j�|�|���}|�|ddg�dS)NcSs2�dVt�d�IdHdVt�d�IdHdS�Nrb�{�G�z�?rp�r�sleeprrrrr!�s�z:AsyncGenAsyncioTest.test_async_gen_asyncio_01.<locals>.genrbrp�r�rr$rL)r9r!rrrr�test_async_gen_asyncio_01�sz-AsyncGenAsyncioTest.test_async_gen_asyncio_01cCsLdd�}|�t��|j�|�|���Wd�dS1swYdS)NcSs0�dVt�d�IdHdVdddVdS)Nrbrrprrqr rrrrr!s�
z:AsyncGenAsyncioTest.test_async_gen_asyncio_02.<locals>.gen)r`rcr�rr$rVrrr�test_async_gen_asyncio_02
s"�z-AsyncGenAsyncioTest.test_async_gen_asyncio_02cCs:|j}Gdd�d�}|�|�|���}|�|ddg�dS)Nc@r�)z:AsyncGenAsyncioTest.test_async_gen_asyncio_03.<locals>.GencSs"�dVt�d�IdHdVdSrr rUrrrr[s�
zDAsyncGenAsyncioTest.test_async_gen_asyncio_03.<locals>.Gen.__aiter__Nr�rrrrr�r�r�rbrpr")r9r�r�rrrr�test_async_gen_asyncio_03sz-AsyncGenAsyncioTest.test_async_gen_asyncio_03csDdd����fdd�}��fdd�}�j�|���j�|��dS)NcSs\�dVt�d�IdHzdVdVWnty dVYnwt�d�IdHdVdS)Nrbrrprq���)rr!rcrrrr�foo"s�

�
z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.fooc�s������}��|��IdHd���|��IdHd���|��IdHd���|��IdHd���t��|��IdHWd�n1sIwY��t��|��IdHWd�dS1sfwYdS)Nrbrprqr')r[rLr(r`r&��it�r(r9rr�run1-s�
�"�zAAsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.run1c
�s������}��|��IdHd���|��IdHd�z	|���t�Wnty@}z��|jdd�WYd}~n
d}~ww��d���|��IdHd���t	��|��IdHWd�dS1siwYdS)Nrbrprr&rZr')
r[rLr(rrcrrr\r`r&�r*rr+rr�run29s�
��
"�zAAsyncGenAsyncioTest.test_async_gen_asyncio_anext_04.<locals>.run2�r�r)r9r,r.rr+r�test_async_gen_asyncio_anext_04!s
z3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_04c�(dd����fdd�}�j�|��dS)NcSs�dV}|V}|dVdS�Nrbrrrr�rrrr(Ls�z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05.<locals>.fooc
�sF�����}z	|���d�Wnty*}z��|jdd�WYd}~n
d}~ww��d�z	|���d�WntyT}z��|jdd�WYd}~n
d}~ww��d�z	|���d�Wnty~}z��|jdd�WYd}~n
d}~ww��d���t��|��IdHWd�dS1s�wYdS)NrrbrZr�i�)	r[r(rrrLrr\r`r&r-r+rr�runQs4�
��
��
��
"�z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05.<locals>.runr/�r9r4rr+r�test_async_gen_asyncio_anext_05Ksz3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05cs�d�dd�}|�}|�d���t��
|�d�Wd�n1s#wY�fdd�����fdd�}�j�|�����d�dS)	Nrcs��zdVWdSYdSrrrrrrr(r�
�z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.fooc�$�zdVWd�dSYd�dSr�rr��DONErrr!~���z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.genc�s^���}|�d�IdH��t��|�d�IdHWd�n1s$wY�d7�dS�Nr)r�r`r&r��r;r!r9rrr4����z@AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06.<locals>.run�)rr`rr�rrL�r9r(rHr4rr>r�test_async_gen_asyncio_anext_06n�
�z3AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06cr1)NcS�*�zdVWdStydVYdSw)N�rb�rpr�rrrrr(����zCAsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple.<locals>.fooc�s������}��|��IdHd���t��}|���t�Wd�n1s(wY��|jjdd���t	��|��IdHWd�dS1sOwYdS)NrErrF)
r[rLr(r`rrrc�	exceptionrr&)r*�cmr+rrr4�s�
�"�zCAsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple.<locals>.runr/r5rr+r�"test_async_gen_asyncio_anext_tuple��
z6AsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuplecr1)NcSs2�ztd�VWdStytd�VYdSwr�)rrcrrrrr(�s��zKAsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration.<locals>.fooc�s������}|��IdH}��|t���|jd���t��}|���t�Wd�n1s1wY|j	j
d}��|t���|jd���t��|��IdHWd�dS1sawYdS)Nrbrrq)r[r(r�rrLrr`rrcrHrr&)r*r�rIr+rrr4�s�
�"�zKAsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration.<locals>.runr/r5rr+r�*test_async_gen_asyncio_anext_stopiteration�sz>AsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiterationcsTdd���fdd�}|�td��|j�|��Wd�dS1s#wYdS)Nc	SsF�zdVddWt�d�IdHdVdSt�d�IdHdVw)Nrbrrr3r rrrrr(�s�

�zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06.<locals>.fooc��0���}|��}|��IdH|��IdHdSr�r[r(r��r!r*�r(rrr4��
�zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06.<locals>.runz%async generator ignored GeneratorExit)r5rir�rr5rrPr� test_async_gen_asyncio_aclose_06�s�"�z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_06c�:d��fdd���fdd�}|j�|��|��d�dS)Nrc	st�zdVddWt�d�IdHt�d�IdH�d7�nt�d�IdHt�d�IdH�d7�w�d7�dS)Nrbrrr&r rr:rrr(�s�

�
zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07.<locals>.fooc�rMrrNrOrPrrr4�rQzAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07.<locals>.runrbr�r5r)r;r(r� test_async_gen_asyncio_aclose_07�s
z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_07csfd�tj�jd����fdd����fdd�}�j�|�����d�����j�t�d��dS)	Nr�r�c	s��z%dV�IdH�d7�dVWt�d�IdHt�d�IdH�d7�nt�d�IdHt�d�IdH�d7�w�d7�dS)Nrbr&rprr r)r;rrrr(�s�

�
zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08.<locals>.fooc�s8���}|��}��|��IdHd�|��IdHdSr�)r[rLr(r�rOr+rrr4�s
�zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08.<locals>.runrbr)r�Futurer�rrL�cancelr!r5r)r;r(rr9r� test_async_gen_asyncio_aclose_08�s
z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_08crS)Nrc	s4�z	dVqt�d�IdHt�d�IdHd�w)NTrbrr rr:rrr!s��zDAsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09.<locals>.genc�s@���}|��IdH|��IdH~t�t�d�IdHdS)N皙�����?)r(rrr!r�r rrr4s�zDAsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09.<locals>.runrbr�r5r�r;r!r�#test_async_gen_asyncio_gc_aclose_09s

	z7AsyncGenAsyncioTest.test_async_gen_asyncio_gc_aclose_09cs\d�dd�}|�}|�d�|���fdd����fdd�}|j�|��|��d�dS)	Nrcsr7rrrrrrr("r8zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.foocr9r�rrr:rrr!-r<zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.genc�s2���}|�d�IdH|��IdH�d7�dSr=)r�r�r�rZrrr45s
�zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10.<locals>.runr@)rr�r�rrLrArrZr� test_async_gen_asyncio_aclose_10s
z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10cs�d�dd�}|�}|�d���td��|��Wd�n1s#wY�fdd�����fdd�}�j�|�����d	�dS)
Nrcss �zdVWnYdVdSrrrrrrr(Cs�

zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.foo�ignored GeneratorExitcs(�zdVWnYdV�d7�dSr�rrr:rrr!Ps�
zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.genc�s^���}|�d�IdH��td��|��IdHWd�n1s$wY�d7�dS)Nr]r)r�r5rir�r�r>rrr4Ys��zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11.<locals>.runr)rr5rir�r�rrLrArr>r� test_async_gen_asyncio_aclose_11?s

�	z4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11csDd�dd����fdd���fdd�}|j�|��|��d�dS)	Nrc�s�t�d�IdHdddS)Nrrbrr rrrr�targetg��zDAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.targetcsh�t����}zdVWz|IdHWdSty d�YdSwz|IdHWwty3d�Ywwr�)r�create_taskrc)�task)r;r_rrr(ks�
���zAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.fooc�rMrrNrOrPrrr4vrQzAAsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12.<locals>.runrbr�r5r)r;r(r_r� test_async_gen_asyncio_aclose_12dsz4AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_12csvd�dd�}|�}|�d�}��|d�|�d�}��|d��fdd����fd	d
�}�j�|�����d�dS)Nrcss�dV}|dVdSr�rr�rrr�sgen�s�zAAsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.sgenrbrr��c	s��z5t�d�IdHdV}t�d�IdH|dVt�d�IdHWt�d�IdHt�d�IdHd�dSt�d�IdHt�d�IdHd�w�Nrrbrpr r�r:rrr!�s�
�z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.genc�s����}|�d�IdH}��|d�|�d�IdH}��|d���t��|�d�IdHWd�dS1s9wYdS)Nrbrrre)r�rLr`r&�rHr��r!r9rrr4���"�z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01.<locals>.run)rrLr�r�r9rdr�r�r4rr>r�test_async_gen_asyncio_asend_01s

z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01cspd�dd����fdd����fdd�}��t���j�|��Wd�n1s+wY���d�dS)	Nrc�s�t�|�IdHdddS�Nrbrr ��delayrrr�
sleep_n_crash�r`zJAsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.sleep_n_crashc	��z0t�d�IdHdV}�d�IdH�d7�|dVWt�d�IdHt�d�IdHd�dSt�d�IdHt�d�IdHd�w�Nrrbr&rpr r��r;rorrr!����z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.genc��8���}|�d�IdH}��|d�|�d�IdHdSr2�r�rLrgrhrrr4��
�z@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02.<locals>.runrb)r`rcr�rrLr5r�r;r!r9ror�test_async_gen_asyncio_asend_02�s
�z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02csvd��fdd����fdd����fdd�}��tj���j�|��Wd�n1s.wY���d�dS)	Nrc��<�tjt�|��jd���j�|d�fdd���IdHS)NrUrpc����Sr�rWr�rrr�<lambda>��z\AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.sleep_n_crash.<locals>.<lambda>�rZ
ensure_futurer!r�Z
call_laterrmrUr|rro����
zJAsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.sleep_n_crashc	rprqr r�rrrrr!�rsz@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.genc�rtr2rurgrhrrr4�rvz@AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03.<locals>.runrb)r`r�CancelledErrorr�rrLr5rrwr�test_async_gen_asyncio_asend_03�s
�z3AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03cs�d�Gdd�dt���fdd�}|�}|�d�}��|d�|���}��|d���t��
|�d�Wd�n1s>wY��fdd	�����fd
d�}�j�|�����d�dS)Nrc@r)zCAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.FooErNrrrrr�FooEr�r
r�c3s2�zdV}Wn�yd}Ynw|dVdS)Nrbr&rprr�)r�rrrd�s�
�zBAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.sgenrb��c	s��zCt�d�IdHzdV}Wn�y"d}t�d�IdHYnw|dVt�d�IdHWt�d�IdHt�d�IdHd�dSt�d�IdHt�d�IdHd�wrqr r�)r;r�rrr!s"�
�
�zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.genc�s����}|�d�IdH}��|d�|���IdH}��|d���t��|�d�IdHWd�dS1s9wYdS)Nrbr�)r�rLr�r`r&rg)r�r!r9rrr4rizAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01.<locals>.run)rFrrLrr`rr�rrjr�r;r�r!r9r� test_async_gen_asyncio_athrow_01�s

�z4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01cs�d�Gdd�dt���fdd�����fdd������fdd	�}��tj���j�|��Wd�n1s9wY���d
�dS)Nrc@r)zCAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.FooErNrrrrrr�#r
r�c�ry)NrUrpcrzrr{rr|rrr})r~z]AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.sleep_n_crash.<locals>.<lambda>rrmrUr|rro&r�zKAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.sleep_n_crashc	s��z@t�d�IdHzdV}Wn�y�d�IdHYnw|dVt�d�IdHWt�d�IdHt�d�IdHd�dSt�d�IdHt�d�IdHd�wrfr r�)r;r�rorrr!,s �
�
�zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.genc�sf���}|�d�IdH}��|d�z
|���IdHWntjy+���d��w��d�dS)NrbzCancelledError was not raised)r�rLr�rr�r\rgr�rrr4<s��zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02.<locals>.runrb)rFr`rr�r�rrLr5r)r;r�r!r9ror� test_async_gen_asyncio_athrow_02 s�z4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02cs�d�dd�}|�}|�d���t��
|�t�Wd�n1s#wY�fdd�����fdd�}�j�|�����d�dS)	Nrcsr7rrrrrrr(Rr8zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.foocr9r�rrr:rrr!^r<zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.genc�s^���}|�d�IdH��t��|�t�IdHWd�n1s$wY�d7�dSr=)r�r`r&r��
ValueErrorr�r>rrr4fr?zAAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03.<locals>.runr@)rr`rrr�r�rrLrArr>r� test_async_gen_asyncio_athrow_03NrCz4AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03cr1)NcSrD�NrbrFr�rrrrr!rrGzDAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuple.<locals>.genc�s����}|�d�IdH}��|d�|�t�IdH}��|d���t��|�d�IdHWd�dS1s9wYdSr�)r�rLr�rcr`r&rgrhrrr4xs�"�zDAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuple.<locals>.runr/r5rrhr�#test_async_gen_asyncio_athrow_tupleqs	z7AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuplecr1)NcSs.�zdVWdStytd�VYdSwr�)rcrrrrrr!�s��zLAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration.<locals>.genc�s����}|�d�IdH}��|d�|�t�IdH}��|t���|jd���t��|�d�IdHWd�dS1s@wYdSr�)	r�rLr�rcr�rrr`r&rgrhrrr4�s�"�zLAsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration.<locals>.runr/r5rrhr�+test_async_gen_asyncio_athrow_stopiteration�rKz?AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiterationcs�d��fdd���fdd�}|j�|��}|j�|��}|j�t�d��|��|��|�tj��|j�|�Wd�n1sDwY|�tj��|j�|�Wd�n1s`wY|j�|j���|�	�d�dS)Nrc	sR�zt�|�IdHdVWt�d�IdH�d7�dSt�d�IdH�d7�wrlr )�timeout)�	finalizedrr�waiter�s��
zFAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01.<locals>.waiterc�s��d�2z3dHW}q6dSr�r)�_)r�rr�wait�s��zDAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01.<locals>.waitrYrp)
r�rarrr!rWr`r�Zshutdown_asyncgensrL)r9r��t1�t2r)r�r�r�"test_async_gen_asyncio_shutdown_01�s 	��z6AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01csHg��fdd��dd�}|����fdd�}t�|��|��g�dS)Nc���|�dSrr�r��context��messagesrr�exception_handler��zQAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.exception_handlercSr�r�rrrrrrK�r�zMAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.async_iteratec��0�t��}|����2z3dHW}dS6dSr�r�get_running_loop�set_exception_handler�r�r�r�r*rr�main���
�zDAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02.<locals>.main�rr4rL)r9rKr�r�r�r*r�r�"test_async_gen_asyncio_shutdown_02�sz6AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02csrg��fdd��dd�}|����fdd�}t�|���\}|�|d��|�|dt�|�d	|d
�dS)Ncr�rrr�r�rrr��r�z[AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.exception_handlercS�(�z
dVdVWdddSddw�NrbrprrrrrrrK��
�zWAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.async_iteratec�r�rr�r�r�rrr��r�zNAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01.<locals>.mainZasyncgenrHz:an error occurred during closing of asynchronous generator�message)rr4rLr�rcr�)r9rKr�r�rr�r�,test_async_gen_asyncio_shutdown_exception_01�s�z@AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01cs\g��fdd��dd����fdd�}t�|���\}|�|dt�|�d|d	�dS)
Ncr�rrr�r�rrr��r�z[AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.exception_handlercSr�r�rrrrrrK�r�zWAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.async_iteratec�s6�t��}|�����2z3dHW}n6t�dSr)rr�r�rr��rKr�rrr��s�
�
zNAsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02.<locals>.mainrHz1unhandled exception during asyncio.run() shutdownr�)rr4r�rcr�)r9r�r�r�rKr�r�r�,test_async_gen_asyncio_shutdown_exception_02�s�z@AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_02csLdd���fdd���fdd�}|j�|��}|�|dd�td	�D��dS)
NcSs*�t|�D]
}t�d�IdH|VqdS�Nr)�rangerr!)�nrrrr�aranges
��z@AsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.arangecsdd��|�2�S)NcSs"�|z3dHW}|dVq6dS�Nrprr�rrr�	<genexpr>s� zXAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.make_arange.<locals>.<genexpr>r�r�)r�rr�make_arange
szEAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.make_arangec���dd��d�2�IdHS)Nc�r�rrr�rrrr�r�zQAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.run.<locals>.<listcomp>rrr�r�rrr4r�z=AsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.runcS�g|]}|d�qSrFrr�rrrr��zDAsyncGenAsyncioTest.test_async_gen_expression_01.<locals>.<listcomp>r�r�rrLr��r9r4rr)r�r�r�test_async_gen_expression_01s
z0AsyncGenAsyncioTest.test_async_gen_expression_01csNdd���fdd���fdd�}|j�|��}|�|dd�td	d
�D��dS)Nc�s�t�d�IdH|Sr�r r�rrr�wraps�z>AsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.wrapcs�fdd�t|�D�S)Ncs&�|]}�|�IdHr|dVqdSr�rr��r�rrr�s�$zXAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.make_arange.<locals>.<genexpr>)r�r�r�rrr�szEAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.make_arangec�r�)Nc�r�rrr�rrrr�!r�zQAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.run.<locals>.<listcomp>rrrr�rrr4 r�z=AsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.runcSr�rFrr�rrrr�$r�zDAsyncGenAsyncioTest.test_async_gen_expression_02.<locals>.<listcomp>rbrr�r�r)r�r�r�test_async_gen_expression_02s
 z0AsyncGenAsyncioTest.test_async_gen_expression_02csBg��fdd��dd����fdd�}t�|��|�g��dS)Ncr�rrr�r�rrr�*r�z]AsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.exception_handlercSr�r�rrrrrrK-r�zYAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.async_iteratec�s2�t��}|�����2z3dHW}dS6dSrr�r�r�rrr�1s�
�zPAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable.<locals>.mainr�)r9r�rr�r�.test_asyncgen_nonstarted_hooks_are_cancellable&szBAsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellablecr1)NcSr�r�rrrrrrK=r�zUAsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice.<locals>.async_iteratec�sb���}|��}|IdH��td��
|IdHWd�n1s#wY|��IdHdS)Nz4cannot reuse already awaited __anext__\(\)/asend\(\))r(r5rir��r*Znxt�rKr9rrr4As�
��zKAsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice.<locals>.runr/r5rr�r�*test_async_gen_await_same_anext_coro_twice<sz>AsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twicecr1)NcSr�r�rrrrrrKPr�zVAsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twice.<locals>.async_iteratec�sV���}|��}|IdH��td��|IdHWd�dS1s$wYdS)Nz2cannot reuse already awaited aclose\(\)/athrow\(\))r�r5rir�r�rrr4Ts�
�"�zLAsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twice.<locals>.runr/r5rr�r�+test_async_gen_await_same_aclose_coro_twiceOs
z?AsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twicec�&dd���fdd�}|j�|��dS)NcSr�r�rrrrrrKbr�z[AsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coros.<locals>.async_iteratec�s(���}|��IdH|��IdHdSr�r�r)�rKrrr4fs�zQAsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coros.<locals>.runr/r5rr�r�0test_async_gen_aclose_twice_with_different_coros`szDAsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coroscr�)NcSr�r�rrrrrrKor�zQAsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustion.<locals>.async_iteratec�s.���}|2z3dHW}q6|��IdHdSrr�)r*r�r�rrr4ss��zGAsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustion.<locals>.runr/r5rr�r�&test_async_gen_aclose_after_exhaustionmsz:AsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustioncr�)NcSs�t�VdSr)�objectrrrr�async_generator|s�z\AsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack.<locals>.async_generatorc�s4���}t�|���t��}|D]}|��qdSr)rrar�Z	all_tasksZ	get_stack)ZagZtasksrb�r�rrr4s�
�zPAsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack.<locals>.runr/r5rr�r�/test_async_gen_aclose_compatible_with_get_stack{szCAsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stackN)9rr	r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr$r#r$r%r0r6rBrJrLrRrTrXr[r\r^rcrkrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��sn3
			q*##!%* "5.#"
r��__main__)r�r�Zunittestr�Ztest.support.import_helperrZtest.supportrrr�r/rFrr�rrr$r0ZTestCaser1rCr�rr�rrrr�<module>s@
1�