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/test_asyncio/__pycache__/test_pep492.cpython-310.pyc
o

�i��@s�dZddlZddlZddlZddlmZddlZddlmZdd�Z	Gdd�d�Z
Gd	d
�d
ej�ZGdd�de�Z
Gd
d�de�ZGdd�de�ZedkrTe��dSdS)z3Tests support for new syntax introduced by PEP 492.�N)�mock)�utilscCst�d�dS�N)�asyncioZset_event_loop_policy�rr�:/usr/local/lib/python3.10/test/test_asyncio/test_pep492.py�tearDownModule
src@s.eZdZdd�Zd
dd�Zdd�Zdd	�ZdS)�FakeCorocC�dSrr)�self�valuerrr�send�z
FakeCoro.sendNcCr
rr)r�typ�val�tbrrr�throwrzFakeCoro.throwcCr
rr�rrrr�closerzFakeCoro.closeccs�dVdSrrrrrr�	__await__s�
zFakeCoro.__await__)NN)�__name__�
__module__�__qualname__r
rrrrrrrr	s

r	cseZdZ�fdd�Z�ZS)�BaseTestcsHt���t��|_t��|j_t��|j_d|jjj	_
|�|j�dS)Nr)�super�setUprZ
BaseEventLoop�looprZMockZ_process_events�	_selector�selectZreturn_valueZset_event_loopr��	__class__rrr"s

zBaseTest.setUp)rrrr�
__classcell__rrrrr src@seZdZdd�Zdd�ZdS)�	LockTestsc�Tt��t��t��t��g}�fdd�}|D]}�j�||����|���qdS)Nc	�s��t�d�IdH��|���|4IdH�'}��|d���|���t�d�IdH��|���Wd�IdHn1IdHsCwY��|���dS)N�{�G�z�?)r�sleep�assertFalse�lockedZassertIs�
assertTrue)�lock�_lockrrr�test5s�(�z7LockTests.test_context_manager_async_with.<locals>.test�	r�Lock�	Condition�	Semaphore�BoundedSemaphorer�run_until_completer&r'�rZ
primitivesr+Z	primitiverrr�test_context_manager_async_with-��
�z)LockTests.test_context_manager_async_withcr#)Nc	�s��t�d�IdH��|�����td��&|IdH�Wd�n1s'wYWd�dSWd�dS1s?wYdS)Nr$z#can't be used in 'await' expression)rr%r&r'ZassertRaisesRegex�	TypeError)r)rrrr+Ks����"�z7LockTests.test_context_manager_with_await.<locals>.testr,r2rrr�test_context_manager_with_awaitCr4z)LockTests.test_context_manager_with_awaitN)rrrr3r6rrrrr"+sr"c@�eZdZdd�ZdS)�StreamReaderTestscsRd}tj|jd����|�����fdd�}|j�|��}|�|gd��dS)Nsline1
line2
line3�rc�s(�g}�2z3dHW}|�|�q6|Sr)�append)�data�line��streamrr�readercs��z/StreamReaderTests.test_readline.<locals>.reader)sline1
sline2
sline3)r�StreamReaderrZ	feed_dataZfeed_eofr1�assertEqual)rZDATAr?r;rr=r�
test_readline\s
zStreamReaderTests.test_readlineN)rrrrBrrrrr8Zsr8c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�CoroutineTestscCsLdd�}|�}z|�t�|��W|��n|��w|�t�t���dS)Nc���dSrrrrrr�foop��z,CoroutineTests.test_iscoroutine.<locals>.foo)r(rZiscoroutinerr	)rrE�frrr�test_iscoroutineoszCoroutineTests.test_iscoroutinecCsdd�}|�t�|��dS)Nc�rDrrrrrrrE{rFz4CoroutineTests.test_iscoroutinefunction.<locals>.foo)r(rZiscoroutinefunction)rrErrr�test_iscoroutinefunctionzsz'CoroutineTests.test_iscoroutinefunctioncsnGdd�d��|�t��tj�fdd��}Wd�n1s wY|�}|�|�d�d�|��dS)Nc@r7)zCCoroutineTests.test_function_returning_awaitable.<locals>.AwaitablecSsdS)N)�spamrrrrrr�rzMCoroutineTests.test_function_returning_awaitable.<locals>.Awaitable.__await__N)rrrrrrrr�	AwaitablesrKc���Srrr�rKrr�func��z>CoroutineTests.test_function_returning_awaitable.<locals>.funcrJ)ZassertWarns�DeprecationWarningr�	coroutinerAr
r)rrN�cororrMr�!test_function_returning_awaitable~s�z0CoroutineTests.test_function_returning_awaitablecsXdd���fdd�}|j�|��}|�|d�|j�d�|j�|��}|�|d�dS)Nc�s�dS)NrJrrrrr�bar�s�z5CoroutineTests.test_async_def_coroutines.<locals>.barc�s���IdHSrrr�rTrrrE�s�z5CoroutineTests.test_async_def_coroutines.<locals>.foorJT)rr1rA�	set_debug)rrEr;rrUr�test_async_def_coroutines�sz(CoroutineTests.test_async_def_coroutinescsJ�fdd�}��t��d��j�d��j�|����t��d�dS)Nc�s���t��dk�dS�Nr)r(�sys�#get_coroutine_origin_tracking_depthrrrr�start�s�zOCoroutineTests.test_debug_mode_manages_coroutine_origin_tracking.<locals>.startrT)rArYrZrrVr1)rr[rrr�1test_debug_mode_manages_coroutine_origin_tracking�s
z@CoroutineTests.test_debug_mode_manages_coroutine_origin_trackingcsFdd��tj�fdd�����fdd�}�j�|��}��|d�dS)Ncss�dEdHdS)NrrJrrrrr�gen�s�
z0CoroutineTests.test_types_coroutine.<locals>.gencrLrrr)r]rrrN�rOz1CoroutineTests.test_types_coroutine.<locals>.funcc�s ���}��|tj�|IdHSr)ZassertIsInstance�types�_GeneratorWrapper)�wrapper)rNrrrrR�s�
z1CoroutineTests.test_types_coroutine.<locals>.cororJ)r^rQrr1rA)rrRr;r)rNr]rr�test_types_coroutine�sz#CoroutineTests.test_types_coroutinecs4d���fdd�����fdd�}�j�|��dS)Nc�s4��jdd�}z��|djjd�Wd}dSd}w)N�)�limitrrE)Z	get_stackrA�f_code�co_name)rG)�TrrrrE�s
�z1CoroutineTests.test_task_print_stack.<locals>.fooc�s"�tj���jd���IdHdS)Nr9)rZ
ensure_futurerr�rfrErrr�runner�s�z4CoroutineTests.test_task_print_stack.<locals>.runner)rr1�rrhrrgr�test_task_print_stack�sz$CoroutineTests.test_task_print_stackcsddd����fdd�}�j�d��jtdd���j�|��Wd�dS1s+wYdS)Nc�s�t�d�IdHdS)Ng�������?)rr%rrrr�afunc�s�z/CoroutineTests.test_double_await.<locals>.afuncc�sH���}�j�|�}zt�d�IdH|IdHW|��dS|��wrX)rZcreate_taskrr%�cancel)rR�t�rkrrrrh�s�z0CoroutineTests.test_double_await.<locals>.runnerTz"coroutine is being awaited already)�msg)rrVZassertRaises�RuntimeErrorr1rirrnr�test_double_await�s	�"�z CoroutineTests.test_double_awaitN)rrrrHrIrSrWr\rarjrqrrrrrCms	rC�__main__)�__doc__rYr^ZunittestrrZtest.test_asynciorZ
test_utilsrr	ZTestCaserr"r8rCr�mainrrrr�<module>s /n�