File: D:/Python311/Lib/test/test_asyncio/__pycache__/test_locks.cpython-311.pyc
�
��Vc� � �L � d Z ddlZddlmZ ddlZddlZddlZdZ ej e� � Zd� Z G d� dej
� � Z G d� d ej
� � Z G d
� dej
� � Z
G d� d
ej
� � Z G d� dej
� � Zedk r ej � � dS dS )zTests for locks.py� N)�mockz�^<(?P<class>.*?) object at (?P<address>.*?)\[(?P<extras>(set|unset|locked|unlocked|filling|draining|resetting|broken)(, value:\d)?(, waiters:\d+)?(, waiters:\d+\/\d+)?)\]>\Zc �. � t j d � � d S �N)�asyncio�set_event_loop_policy� � �0D:\Python311\Lib\test\test_asyncio\test_locks.py�tearDownModuler s � ��!�$�'�'�'�'�'r c �V � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
S )� LockTestsc � � K � t j � � }| � t |� � � d� � � � | � t
� t |� � � � � � |� � � � d {V �� | � t |� � � d� � � � | � t
� t |� � � � � � d S )Nz[unlocked]>� [locked]>)r �Lock�
assertTrue�repr�endswith�RGX_REPR�match�acquire��self�locks r
� test_reprzLockTests.test_repr s� � � � ��|�~�~������T�
�
�+�+�M�:�:�;�;�;�������t�D�z�z�2�2�3�3�3��l�l�n�n������������T�
�
�+�+�K�8�8�9�9�9�������t�D�z�z�2�2�3�3�3�3�3r c � �� K � t j � � }| � t d� � 5 |� d {V �� d d d � � n# 1 swxY w Y | � |� � � � � d S )Nz/object Lock can't be used in 'await' expression)r r �assertRaisesRegex� TypeError�assertFalse�lockedr s r
� test_lockzLockTests.test_lock% s� � � � ��|�~�~��
�
#�
#��=�
�
� � � �J�J�J�J�J�J�J� � � � � � � � � � � ���� � � � �
��������'�'�'�'�'s � A�A
�
A
c � �: K � t j t j t j t j t j g}t j � � }|D ]I}| � t |j � d�� � 5 ||�� � d d d � � n# 1 swxY w Y �Jd S )Nz8\.__init__\(\) got an unexpected keyword argument 'loop'��loop)
r r � Condition�Event� Semaphore�BoundedSemaphore�get_running_loopr r �__name__)r �primitives_clsr# �clss r
�&test_lock_doesnt_accept_loop_parameterz0LockTests.test_lock_doesnt_accept_loop_parameter0 s� � � � ��L����M����$�
�� �'�)�)��!� � �C��'�'���L� ,� ,� ,�� �
�
�
�������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�� � s �6
B�B �B c � � K � t j � � t j � � t j � � t j � � g}|D ]�}t j d� � � d {V �� | � |� � � � � | � t d� � 5 |� d {V ��5 d d d � � n# 1 swxY w Y d d d � � n# 1 swxY w Y | � |� � � � � ��d S )N�{�G�z�?z.object \w+ can't be used in 'await' expression)
r r r$ r&