Sindbad~EG File Manager
�
*Μgq����ddlZddlZddlZddlZddlZddlmZddlmZejd��ddlm
Z
mZddlmZddl
mZmZmZmZmZmZmZmZmZmZd �ZGd
�d�ZGd�d
�Zd�Zd�Zd�ZGd�de�Ze �d�Z!e �d�Z"ed��Z#Gd�dejH�Z%Gd�dejH�Z&Gd�dejH�Z'Gd�dejH�Z(Gd�dejH�Z)Gd �d!ejH�Z*Gd"�d#e�Z+Gd$�d%ejH�Z,Gd&�d'ejH�Z-Gd(�d)ejH�Z.Gd*�d+ejH�Z/e d,k(rej`�yy)-�N)�contextmanager)�supportT)�module)�run�iscoroutinefunction)�IsolatedAsyncioTestCase)
�ANY�call� AsyncMock�patch� MagicMock�Mock�create_autospec�sentinel� _CallList�sealc�.�tjd�y�N)�asyncio�set_event_loop_policy���B/usr/local/lib/python3.12/test/test_unittest/testmock/testasync.py�tearDownModulers���!�!�$�'rc�>�eZdZd�Zd�Zd�Zed��Zed��Z y)�
AsyncClassc��yrr��selfs r�__init__zAsyncClass.__init__s��rc��K�y�wrrrs r�async_methodzAsyncClass.async_methods����$���c��yrrrs r�
normal_methodzAsyncClass.normal_method���Trc��K�y�wrr)�clss r�async_class_methodzAsyncClass.async_class_methods ����'+�r#c��K�y�wrrrrr�async_static_methodzAsyncClass.async_static_methods ����%)�r#N)
�__name__�
__module__�__qualname__r r"r%�classmethodr)�staticmethodr+rrrrrs'���&�!��+��+��)��)rrc��eZdZd�Zy)�AwaitableClassc#�K�d��y�wrrrs r� __await__zAwaitableClass.__await__"s�������N)r,r-r.r4rrrr2r2!s��rr2c��K�y�wrrrrr�
async_funcr7$s�����r#c��K�y�wrr)�a�b�cs r�async_func_argsr<&�����t�r#c��yrrrrr�normal_funcr?(���4rc��eZdZd�Zy)�NormalClassc��yrrrs rr9z
NormalClass.a+s��rN)r,r-r.r9rrrrBrB*s��rrBz.AsyncClassz.NormalClassc#�K�|jtd�5d��tj�ddd�y#1swYyxYw�w)Nzwas never awaited$)�assertWarnsRegex�RuntimeWarning�gc�collect)�tests r�assertNeverAwaitedrJ2s1����
� � �~�/C� D�
� �
�
��
E� D� D�s�A�;� A�A�Ac�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�AsyncPatchDecoratorTestc�X��tjtd��fd��}|�y)Nr"c�:���jt|��yr)�
assertTruer��mock_methodrs �r�
test_asynczLAsyncPatchDecoratorTest.test_is_coroutine_function_patch.<locals>.test_async=s����O�O�/��<�=r�r�objectr�rrRs` r� test_is_coroutine_function_patchz8AsyncPatchDecoratorTest.test_is_coroutine_function_patch<s%��� ���j�.� 1� >�
2� >��rc���tjtd��fd��}tt�d���fd��}|�|�y)Nr"c�r��|�}�jtj|��t|�yr�rO�inspect�isawaitabler�rQ�mrs �rrRz?AsyncPatchDecoratorTest.test_is_async_patch.<locals>.test_asyncC�(����
�A��O�O�G�/�/��2�3���Frz
.async_methodc�r��|�}�jtj|��t|�yrrYr\s �r�test_no_parent_attributezMAsyncPatchDecoratorTest.test_is_async_patch.<locals>.test_no_parent_attributeIr^r)rrTr�async_foo_name)rrRr`s` r�test_is_async_patchz+AsyncPatchDecoratorTest.test_is_async_patchBsN��� ���j�.� 1� �
2� �
�.�!��/� 0� �
1� �
�� �"rc�X��tjtd��fd��}|�y)Nr"c�2���j|t�yr��assertIsInstancerrPs �rrRzCAsyncPatchDecoratorTest.test_is_AsyncMock_patch.<locals>.test_asyncS�����!�!�+�y�9rrSrUs` r�test_is_AsyncMock_patchz/AsyncPatchDecoratorTest.test_is_AsyncMock_patchRs'��� ���j�.� 1� :�
2� :� �rc�X��tjtd��fd��}|�y)Nr+c�2���j|t�yrrerPs �rrRzPAsyncPatchDecoratorTest.test_is_AsyncMock_patch_staticmethod.<locals>.test_asyncZrgrrSrUs` r�$test_is_AsyncMock_patch_staticmethodz<AsyncPatchDecoratorTest.test_is_AsyncMock_patch_staticmethodYs(��� ���j�"7� 8� :�
9� :� �rc�X��tjtd��fd��}|�y)Nr)c�2���j|t�yrrerPs �rrRzOAsyncPatchDecoratorTest.test_is_AsyncMock_patch_classmethod.<locals>.test_asyncargrrSrUs` r�#test_is_AsyncMock_patch_classmethodz;AsyncPatchDecoratorTest.test_is_AsyncMock_patch_classmethod`s(��� ���j�"6� 7� :�
8� :� �rc����tt�d�d��tt�d�d���fd���}t|���jt j
t��y)N�.async_func���return_value�.async_func_args�c��~�K��j|jd��j|jd��jtt��jt
t��jt��d{���d��jtddd���d{���d�y7�07��w)Nr<r7rqru��r;)�assertEqual�
_mock_namerfr7rr<)�func_args_mock� func_mockrs �rrRz@AsyncPatchDecoratorTest.test_async_def_patch.<locals>.test_asynchs������
���^�6�6�8I�J����Y�1�1�<�@��!�!�*�i�8��!�!�/�9�=����:�<�/��3����?�1�a�1�#=�=�q�A�0��=�s$�BB=�B9� %B=�.B;�/B=�;B=)rr,rrOrZrr7rUs` r�test_async_def_patchz,AsyncPatchDecoratorTest.test_async_def_patchgs_��� �(��;�'�a� 8� �(��+�,�1� =� B�
>�
9� B� �J�L������3�3�J�?�@rN) r,r-r.rVrbrhrkrnr}rrrrLrL;s!���#� ���ArrLc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�AsyncPatchCMTestc����fd�}|�y)Nc���tjtd�5}�jt |��ddd�y#1swYyxYw�Nr")rrTrrOrrPs �rrRz>AsyncPatchCMTest.test_is_async_function_cm.<locals>.test_asynczs1������j�.�9�[���� 3�K� @�A�:�9�9�s�A�A rrUs` r�test_is_async_function_cmz*AsyncPatchCMTest.test_is_async_function_cmys��� B� �rc����fd�}|�y)Nc����tjtd�5}|�}�jt j
|��t
|�ddd�y#1swYyxYwr�)rrTrrOrZr[rr\s �rrRz5AsyncPatchCMTest.test_is_async_cm.<locals>.test_async�sD������j�.�9�[��M������ 3� 3�A� 6�7��A��:�9�9�s�7A�A%rrUs` r�test_is_async_cmz!AsyncPatchCMTest.test_is_async_cm�s��� � �rc����fd�}|�y)Nc���tjtd�5}�j|t�ddd�y#1swYyxYwr�)rrTrrfrrPs �rrRz9AsyncPatchCMTest.test_is_AsyncMock_cm.<locals>.test_async�s/������j�.�9�[��%�%�k�9�=�:�9�9�s �<�ArrUs` r�test_is_AsyncMock_cmz%AsyncPatchCMTest.test_is_AsyncMock_cm�s��� >� �rc�0���fd�}t|��y)Nc����K�tt�d�t��5�jtt�ddd��jt
jt��y#1swY�2xYw�w)Nrp)rr,rrfr7rOrZrrs�rrRz6AsyncPatchCMTest.test_async_def_cm.<locals>.test_async�sN������(��;�/���=��%�%�j�)�<�>��O�O�G�7�7�
�C�D�>�=�s�A7�A+�1A7�+A4�0A7�rrUs` r�test_async_def_cmz"AsyncPatchCMTest.test_async_def_cm�s��� E�
�J�L�rc����ddi�tj�ddi���fd��}�jt|��t |��y)Nr9r:c��8�K��j�dd�y�w�Nr9r:)ry��foors��rrRz>AsyncPatchCMTest.test_patch_dict_async_def.<locals>.test_async�s��������S��X�s�+�s�)r�dictrOrr�rrRr�s` @r�test_patch_dict_async_defz*AsyncPatchCMTest.test_patch_dict_async_def�sK����C�j�� ���C�#�s�� $� ,�
%� ,�
���+�J�7�8��J�L�rc�<���ddi���fd�}t|��y)Nr9c���K�tj�ddi�5�j�dd�ddd�y#1swYyxYw�wr�)rr�ryr�s��rrRzFAsyncPatchCMTest.test_patch_dict_async_def_context.<locals>.test_async�s8��������C�#�s��,�� � ��S��3�/�-�,�,�s�A�;� A�A�Ar�r�s` @r�!test_patch_dict_async_def_contextz2AsyncPatchCMTest.test_patch_dict_async_def_context�s����C�j�� 0� �J�L�rN) r,r-r.r�r�r�r�r�r�rrrrrxs �������rrc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
AsyncMockTestc�L�t�}|jt|��yr)rrOr�r�mocks r� test_iscoroutinefunction_defaultz.AsyncMockTest.test_iscoroutinefunction_default�s���{�����+�D�1�2rc��d�}t|�}|jt|��|jtj|��y)Nc��K�y�wrrrrrr�z<AsyncMockTest.test_iscoroutinefunction_function.<locals>.foo�s�����r#�rrOrrZ�rr�r�s r�!test_iscoroutinefunction_functionz/AsyncMockTest.test_iscoroutinefunction_function�s7�����~�����+�D�1�2�����3�3�D�9�:rc��t�}|�}|jtj|��t |�|jdt
|��y)N�assert_awaited)rrOrZr[r�assertIn�dir�rr�r]s r�test_isawaitablezAsyncMockTest.test_isawaitable�sA���{���F������+�+�A�.�/��A���
�
�&��D� �2rc��d�}t|�}|jt|��|jtj|��y)Nc��yrrrrrr�zCAsyncMockTest.test_iscoroutinefunction_normal_function.<locals>.foo�r@rr�r�s r�(test_iscoroutinefunction_normal_functionz6AsyncMockTest.test_iscoroutinefunction_normal_function�s7�����~�����+�D�1�2�����3�3�D�9�:rc���tj�}|j�}|j�|j �t|�}|j
|tj�yr)r�new_event_loop�
create_future�stop�closerrf�Future)r�loop�futr�s r�test_future_isfuturez"AsyncMockTest.test_future_isfuture�sM���%�%�'��� � �"��� � ���
�
����~�����d�G�N�N�3rN)r,r-r.r�r�r�r�r�rrrr�r��s��3�;�3�;�4rr�c�$�eZdZd�Zd�Zd�Zd�Zy)�AsyncAutospecTestc���ttd���fd��}ttd���fd��}|�|�y)NT��autospecc�r���j|jt��j|t�yr�rfr"rr
rPs �rrRz=AsyncAutospecTest.test_is_AsyncMock_patch.<locals>.test_async�s)����!�!�+�":�":�I�F��!�!�+�y�9rc�F���j|jt�yr)rfr%r
rPs �r�test_normal_methodzEAsyncAutospecTest.test_is_AsyncMock_patch.<locals>.test_normal_method�s����!�!�+�";�";�Y�Gr�rra)rrRr�s` rrhz)AsyncAutospecTest.test_is_AsyncMock_patch�sF��� �~�� -� :�
.� :�
�~�� -� H�
.� H� ���rc�z�|jt�5ttd��ddd�y#1swYyxYw)NT)�instance)�assertRaises�RuntimeErrorrr7rs r�test_create_autospec_instancez/AsyncAutospecTest.test_create_autospec_instance�s&��
�
�
�|�
,��J��6�-�
,�
,�s�1�:c���tt�}|ddd����fd�}|j|jd�|j |j
�|j|jg�|j�t|��|jt|��|jtj���|j|jd�|j|j
tddd���|j|jtddd��g�|j�|jddd��|j!ddd��|j#�|j%t&�5|j)d��ddd�y#1swYyxYw)Nrqrurwrxc��&�K���d{���y7��wrr)� awaitables�r�mainz4AsyncAutospecTest.test_create_autospec.<locals>.main�s������O�O�s���r)�e)rr<ry�await_count�assertIsNone�
await_args�await_args_list�assert_not_awaitedrrOrr�iscoroutiner
�assert_awaited_once�assert_awaited_once_with�assert_awaited_withr�r��AssertionError�assert_any_await)r�specr�r�s @r�test_create_autospecz&AsyncAutospecTest.test_create_autospec�s]�����/����A��O� � �
����)�)�1�-����$�/�/�*�����-�-�r�2����!��D�F�����+�D�1�2�����+�+�I�6�7�����)�)�1�-�������$�q�!�q�/�:�����-�-��Q��Q��/@�A�� � �"��%�%�a��a�%�0�� � ��A�� �+�����
�
�
�~�
.��!�!�A�!�&�/�
.�
.�s�F8�8Gc�0���fd�}t|��y)Nc���K�tt�d�d��5}|ddd��}�j|jt��jt
|���jtj|���jtj|���j|jd��j|jg��j|j�|j!�|�d{���ddd��jjd��j|jt#ddd����j|jt#ddd��g�|j%�|j'ddd��|j)ddd��|j+�|j-��j|jd��j|j��j|jg�y7��swY��&xYw�w) NrtTr�rqrurwrxr)rr,rfr�rrOrrr�rZr[ryr�r�r�r�r�r
r�r�r�r��
reset_mock)rQr�rs �rrRz>AsyncAutospecTest.test_patch_with_autospec.<locals>.test_async�s�������(��#3�4�t�D��'��1��2� ��%�%�k�&6�&6� �B���� 3�K� @�A����� 3� 3�I� >�?����� 3� 3�I� >�?�� � ��!8�!8�!�<�� � ��!<�!<�b�A��!�!�+�"8�"8�9��.�.�0����E�
���[�4�4�a�8����[�3�3�T�!�Q�!�_�E����[�8�8�4��1��?�:K�L��+�+�-��0�0��A��0�;��+�+�A�q�A�+�6��&�&�(��"�"�$����[�4�4�a�8����k�4�4�5����[�8�8�"�=� ��E�D�s0�I�C6H7�H4�H7�D!I�4H7�7I�<Ir�rUs` r�test_patch_with_autospecz*AsyncAutospecTest.test_patch_with_autospec�s��� >�< �J�L�rN)r,r-r.rhr�r�r�rrrr�r��s���7�'�6 rr�c�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zy)�
AsyncSpecTestc����fd�}ttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc���|t�}�j|jt��j|jt
�yr)rrfr"rr%r
)� mock_typer�rs �r�
inner_testzCAsyncSpecTest.test_spec_normal_methods_on_class.<locals>.inner_tests9����Z�(�D��!�!�$�"3�"3�Y�?��!�!�$�"4�"4�i�@rztest method types with �rr
�subTest�rr�r�s` r�!test_spec_normal_methods_on_classz/AsyncSpecTest.test_spec_normal_methods_on_classsF��� A�
$�Y�/�I���� 7� �{�C�D��9�%�E�D�0�D�D�� � >�A c��tt�}|j|jt�|j|j
t�yr)rrrfr"rr%r�s r�+test_spec_normal_methods_on_class_with_mockz9AsyncSpecTest.test_spec_normal_methods_on_class_with_mock&s8���J������d�/�/��;����d�0�0�$�7rc��tt�}t|�|jt�5|j
ddd�|jt�5|jddd�y#1swY�4xYw#1swYyxYwr)rrrr��AttributeErrorr%r"r�s r�0test_spec_normal_methods_on_class_with_mock_sealz>AsyncSpecTest.test_spec_normal_methods_on_class_with_mock_seal+s^���J����T�
�
�
�
�~�
.����/�
�
�
�~�
.����/�
.�/�
.��
.�
.�s�
A0�
A<�0A9�<Bc���t�}t|_t|_t|��}t|_|j
|jt�|j|jt�y�N��spec_set) rr7�async_func_attrr?�later_async_func_attrrrfr�assertNotIsInstance)r�async_instance�mock_async_instances r�#test_spec_async_attributes_instancez1AsyncSpecTest.test_spec_async_attributes_instance3sZ��#���)3��&�/:��,�"�N�;��/9��,����1�A�A�9�M�� � �!4�!J�!J�I�Vrc����fd�}tttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc���|t��}�j||�t��5�jt j
|���ddd�|t��}�j||�y#1swY�)xYw�N�r��r7rfrJrOrZr[r?�r��
async_mock� sync_mockrs �rr�z8AsyncSpecTest.test_spec_mock_type_kw.<locals>.inner_testAsh���"�
�3�J��!�!�*�i�8�#�D�)����� 3� 3�J�L� A�B�*�"�{�3�I��!�!�)�Y�7� *�)�s�*A>�>Bztest spec kwarg with �rr
rr�r�s` r�test_spec_mock_type_kwz$AsyncSpecTest.test_spec_mock_type_kw@sG��� 8�$�Y��5�I���� 5�i�[�A�B��9�%�C�B�6�B�B��� A�A c����fd�}tttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc���|t�}�j||�t��5�jt j
|���ddd�|t�}�j||�y#1swY�(xYwrr�r�s �rr�z@AsyncSpecTest.test_spec_mock_type_positional.<locals>.inner_testOsh���"�:�.�J��!�!�*�i�8�#�D�)����� 3� 3�J�L� A�B�*�"�+�.�I��!�!�)�Y�7� *�)�s�*A<�<Bztest spec positional with r�r�s` r�test_spec_mock_type_positionalz,AsyncSpecTest.test_spec_mock_type_positionalNsG��� 8�$�Y��5�I���� :�9�+�F�G��9�%�H�G�6�G�G�r�c��tt��}|j|t�|�}|jt j
|��t
|�yr��rr?rfrOrZr[rr�s r� test_spec_as_normal_kw_AsyncMockz.AsyncSpecTest.test_spec_as_normal_kw_AsyncMock\sA���k�*�����d�I�.��F������+�+�A�.�/��A�rc��tt�}|j|t�|�}|jt j
|��t
|�yrrr�s r�(test_spec_as_normal_positional_AsyncMockz6AsyncSpecTest.test_spec_as_normal_positional_AsyncMockcsA����%�����d�I�.��F������+�+�A�.�/��A�rc�\��tjtdd���fd��}|�y)Nr"Tr�c�2���j|t�yrrerPs �rrRz6AsyncSpecTest.test_spec_async_mock.<locals>.test_asynckrgrrSrUs` r�test_spec_async_mockz"AsyncSpecTest.test_spec_async_mockjs)��� ���j�.�t� <� :�
=� :� �rc�F��ttd���fd��}|�y)NTr�c�r���j|t��j|jt�yr)rfr
r"rrPs �rrRzIAsyncSpecTest.test_spec_parent_not_async_attribute_is.<locals>.test_asyncrs)����!�!�+�y�9��!�!�+�":�":�I�Frr�rUs` r�'test_spec_parent_not_async_attribute_isz5AsyncSpecTest.test_spec_parent_not_async_attribute_isqs%��� �~�D� )� G�
*� G� �rc�x��tjtdtj���fd��}|�y)Nr"r�c�����j|t��jtj|���jtj
|��yr)rfr
�assertFalserZr�r[rPs �r�test_async_attributezFAsyncSpecTest.test_target_async_spec_not.<locals>.test_async_attributezsE����!�!�+�y�9����W�0�0��=�>����W�0�0��=�>r)rrTrrBr9)rrs` r�test_target_async_spec_notz(AsyncSpecTest.test_target_async_spec_notys/��� ���j�.�{�}�}� E� ?�
F� ?�
�rc�d��tjtdt���fd��}|�y)Nr9r�c�2���j|t�yrre)�mock_async_funcrs �r� test_attribute_not_async_spec_iszUAsyncSpecTest.test_target_not_async_spec_is.<locals>.test_attribute_not_async_spec_is�s����!�!�/�9�=r)rrTrBr7)rrs` r�test_target_not_async_spec_isz+AsyncSpecTest.test_target_not_async_spec_is�s(��� ���k�3�Z� 8� >�
9� >�(�*rc�N��ttt���fd��}|�y)Nr�c�r���j|jt��j|t�yrr�)�MockNormalClassrs �r� test_async_attributes_coroutineszRAsyncSpecTest.test_spec_async_attributes.<locals>.test_async_attributes_coroutines�s)����!�!�/�">�">� �J��!�!�/�9�=r)r�normal_foo_namer)rrs` r�test_spec_async_attributesz(AsyncSpecTest.test_spec_async_attributes�s$��� ��Z� 0� >�
1� >� )�*rN)r,r-r.r�r�r�r�r�rrrr
r
rrrrrrr�r�sD��&�8�
�W�&�&������+�+rr�c�$�eZdZd�Zd�Zd�Zd�Zy)�AsyncSpecSetTestc�\��tjtdd���fd��}|�y)Nr"Tr�c�2���j|t�yrre)r"rs �rrRz<AsyncSpecSetTest.test_is_AsyncMock_patch.<locals>.test_async�s����!�!�,� �:rrSrUs` rrhz(AsyncSpecSetTest.test_is_AsyncMock_patch�s(��� ���j�.�4� @� ;�
A� ;��rc��ttj��}|jt |��|j|t�yr�)rrr"rOrrfr�s r�test_is_async_AsyncMockz(AsyncSpecSetTest.test_is_async_AsyncMock�s4���*�"9�"9�:�����+�D�1�2����d�I�.rc�`�tt��}|jt|j��|jt|j��|j|jt�|j|jt�|j|t�yr�) r
rrOrr"rr%rfrr�s r�test_is_child_AsyncMockz(AsyncSpecSetTest.test_is_child_AsyncMock�sz���*�-�����+�D�,=�,=�>�?����,�T�-?�-?�@�A����d�/�/��;����d�0�0�)�<����d�I�.rc��t�}td���|_tj|d�5}|j |t�ddd�y#1swYyxYw)Nc��|Srr��xs r�<lambda>z=AsyncSpecSetTest.test_magicmock_lambda_spec.<locals>.<lambda>�s��arr�� mock_func)r
r+rrTrf)r�mock_obj�cms r�test_magicmock_lambda_specz+AsyncSpecSetTest.test_magicmock_lambda_spec�sB���;��&�K�8���
�\�\�(�K�
0�B��!�!�"�i�0�1�
0�
0�s�A�AN)r,r-r.rhr#r%r.rrrrr�s���/�
/�1rrc�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zy)�AsyncArgumentsc��tK�d�}t|d��}|d��d{���}|j|d�y7��w)Nc��K�y�wrr)r�vars r�additionz6AsyncArguments.test_add_return_value.<locals>.addition�r=r#�
rr��rry)rr4r��outputs r�test_add_return_valuez$AsyncArguments.test_add_return_value�s5����+����3���A�w��������$��s�8�6�8c���K�Gd�dt�}d�}t||d���}|j|d�5|d��d{���ddd�y7�
#1swYyxYw�w)Nc��eZdZy)�BAsyncArguments.test_add_side_effect_exception.<locals>.CustomErrorN�r,r-r.rrr�CustomErrorr<�s�rr>c��K�y�wrr�r3s rr4z?AsyncArguments.test_add_side_effect_exception.<locals>.addition�s�����r#zside-effect��side_effectr6)� Exceptionr�assertRaisesRegex)rr>r4r�s r�test_add_side_effect_exceptionz-AsyncArguments.test_add_side_effect_exception�sS����*�)�*�%���{�=�/I�J��
�
#�
#�K��
?��q�'�M�M�@�
?���@�
?�s.�8A"�A�A�A� A"�A�A�A"c��rK�d�}t|��}|d��d{���}|j|d�y7��w)Nc��K�|dzS�w�Nrqrr@s rr4z?AsyncArguments.test_add_side_effect_coroutine.<locals>.addition�s������7�N�r5rAr6�r7�rr4r��results r�test_add_side_effect_coroutinez-AsyncArguments.test_add_side_effect_coroutine��5���� ��X�.���A�w��������#����7�5�7c��rK�d�}t|��}|d��d{���}|j|d�y7��w)Nc��|dzSrHrr@s rr4zEAsyncArguments.test_add_side_effect_normal_function.<locals>.addition�s����7�NrrAr6rIr7rJs r�$test_add_side_effect_normal_functionz3AsyncArguments.test_add_side_effect_normal_function�rMrNc���K�gd�}t|��}|D]!}|j|��d{���|��#|jt�5}|��d{���ddd�y7�97�#1swYyxYw�w)N�rqrurwrA)rryr��StopAsyncIteration)r�valsr��itemr�s r�test_add_side_effect_iterablez,AsyncArguments.test_add_side_effect_iterable�sk�������T�*���D����4�6�\�4�0���
�
�1�
2�a��&�L�L�3�
2�*��
��3�
2�s9�+A7�A'
� A7�A+�A)�A+�
A7�)A+�+A4�0A7c��K�Gd�dt�}d|d�g}t|��}|j|��d{���d�|j|�5}|��d{���ddd�y7�37�#1swYyxYw�w)Nc��eZdZy)�OAsyncArguments.test_add_side_effect_exception_iterable.<locals>.SampleExceptionNr=rrr�SampleExceptionrZ�s��rr[rqr�rA)rCrryr�)rr[rUr�r�s r�'test_add_side_effect_exception_iterablez6AsyncArguments.test_add_side_effect_exception_iterable�sv���� �i� ��?�5�)�*���T�*�����t�v��q�)�
�
�
��
/�1��&�L�L�0�
/�&��
��0�
/�s9�;B�A1�B�A5�#A3�$A5�(
B�3A5�5A>�:Bc��K�td��}t|��}|��d{���}|j||�y7��w)Nr5rr)r�assertIs)r�valuer�rKs r�test_return_value_AsyncMockz*AsyncArguments.test_return_value_AsyncMock�s6�����r�*���e�,���v����
�
�f�e�$����#?�=�?c���K�tj�}|jd�t|��}|��d{���}|j |tj�y7�%�w)Nrr)rr��
set_resultrrf�rr�r�rKs r�test_return_value_awaitablez*AsyncArguments.test_return_value_awaitable�sJ�����n�n������t���c�*���v������f�g�n�n�5��s�<A&�A$�&A&c��HK�tj�}|jd�t|g��}|��d{���}|j |tj�|jt�5|��d{���ddd�y7�R7�#1swYyxYw�w)NrA)rr�rcrrfr�rTrds r�!test_side_effect_awaitable_valuesz0AsyncArguments.test_side_effect_awaitable_values�s{�����n�n������t���c�U�+���v������f�g�n�n�5�
�
�
�1�
2��&�L�L�3�
2���
��3�
2�s:�=B"�B�9B"�9B�B�B�
B"�B�B�B"c��K�td��}t|��}|��d{���}|j|d�y7��w)Nr5rrrAr7)r�effectr�rKs r�test_side_effect_is_AsyncMockz,AsyncArguments.test_side_effect_is_AsyncMock�s8������+���V�,���v��������$��rac�����K�tj��d���fd�}t|��}|��d{���}|j|��|j �|j��y7�8�w)NFc���K�d��S�w�NTr��ranr_s��r�innerz2AsyncArguments.test_wraps_coroutine.<locals>.inners������C��L�s���wraps)rr�rryr�rO�rrpr�rKror_s @@r�test_wraps_coroutinez#AsyncArguments.test_wraps_coroutine�s_�������� ���� �
�u�%���v��������'�����������s�3A2�A0�9A2c�����K�d�d���fd�}t|��}|��d{���}|j|��|j�|j��y7�8�w)NrqFc���d��Srmrrns��rrpz8AsyncArguments.test_wraps_normal_function.<locals>.inners
����C��Lrrq)rryr�rOrss @@r�test_wraps_normal_functionz)AsyncArguments.test_wraps_normal_function
sX��������� �
�u�%���v��������'�����������s�!A �A�9A c��zK�t�}|d�}|d�}|�d{���|�d{���|jtd�td�g�|j|jtd�td�g�|j|j
td�td�g�y7��7���w)Nrurq)r�assert_has_awaitsr
ryr��call_args_list)rr��mock2�mock1s r�test_await_args_list_orderz)AsyncArguments.test_await_args_list_orders������[�
��1�
���1�
���������$�$�d�1�g�t�A�w�%7�8�����3�3�d�1�g�t�A�w�5G�H�����2�2�T�!�W�d�1�g�4F�G� ���s � B;�B7� B;�B9�BB;�9B;N)r,r-r.r9rErLrQrWr\r`rergrjrtrwr}rrrr0r0�sD��%��$�$�� �%�6� �%�
�
�Hrr0c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�AsyncMagicMethodsc��t�}|j|jt�|j|jt�|j|j
t�|j|jt�yr)r
rf�
__aenter__r� __aexit__� __anext__� __aiter__�r�m_mocks r�+test_async_magic_methods_return_async_mocksz=AsyncMagicMethods.test_async_magic_methods_return_async_mocks(sc��������f�/�/��;����f�.�.� �:����f�.�.� �:�
���f�.�.� �:rc��t�}|j|jt�|j|jt�|j|j
t�|j|jt�yr)rrf� __enter__r
�__exit__�__next__�__len__�r�a_mocks r�*test_sync_magic_methods_return_magic_mocksz<AsyncMagicMethods.test_sync_magic_methods_return_magic_mocks1s[��������f�.�.� �:����f�o�o�y�9����f�o�o�y�9����f�n�n�i�8rc��t�}|jt|d��|jt|d��|jt|d��y)Nr�r�r�)r
rO�hasattrr�s r�&test_magicmock_has_async_magic_methodsz8AsyncMagicMethods.test_magicmock_has_async_magic_methods8sB�����������5�6�������4�5�������4�5rc���t�}|jt|d��|jt|d��|jt|d��|jt|d��y)Nr�r�r�r�)rrOr�r�s r�%test_asyncmock_has_sync_magic_methodsz7AsyncMagicMethods.test_asyncmock_has_sync_magic_methods>sU�����������4�5������
�3�4������
�3�4������ �2�3rc�(�t�}|j|jt�|j|jt�|jt
|j��|jt
|j��yr)r
rfr�rr�rOrr�s r�&test_magic_methods_are_async_functionsz8AsyncMagicMethods.test_magic_methods_are_async_functionsEse��������f�/�/��;����f�.�.� �:����+�F�,=�,=�>�?����+�F�,<�,<�=�>rN)r,r-r.r�r�r�r�r�rrrrr's��;�9�6�4�?rrc�f�eZdZGd�d�ZGd�d�ZGd�d�Zd�Zd�Zd �Zd
�Z d�Z
y)
�AsyncContextManagerTestc��eZdZd�Zd�Zy)�/AsyncContextManagerTest.WithAsyncContextManagerc��K�y�wrr�r�args�kwargss rr�z:AsyncContextManagerTest.WithAsyncContextManager.__aenter__Ps����T�r#c��K�y�wrrr�s rr�z9AsyncContextManagerTest.WithAsyncContextManager.__aexit__Rs����D�r#N)r,r-r.r�r�rrr�WithAsyncContextManagerr�Os��9�8rr�c��eZdZd�Zd�Zy)�.AsyncContextManagerTest.WithSyncContextManagerc��yrrr�s rr�z8AsyncContextManagerTest.WithSyncContextManager.__enter__Us��drc��yrrr�s rr�z7AsyncContextManagerTest.WithSyncContextManager.__exit__Ws��TrN)r,r-r.r�r�rrr�WithSyncContextManagerr�Ts��2�1rr�c��eZdZd�Zd�Zy)�&AsyncContextManagerTest.ProductionCodec��d|_yr)�sessionrs rr z/AsyncContextManagerTest.ProductionCode.__init__[s ���D�Lrc���K�|jjd�4�d{���}|j��d{���}|cddd��d{���S7�/7�7� #1�d{���7swYyxYw�w)Nzhttps://python.org)r��post�json)r�response�vals rr�z+AsyncContextManagerTest.ProductionCode.main^sN�����|�|�(�(�)=�>�>�(�$�M�M�O�+���?�>�>��+��?��>�>�>�sT� A-�A�A-�A�A�A�A-�A�
A-�A�A-�A*�A!�A*�&A-N)r,r-r.r r�rrr�ProductionCoder�Ys�� � rr�c����fd�}ttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc�J���j�}td��|_|d��}td��}tddi��|_||j
_||jj_t|j��}�j|ddi�y)N�sessionmock��name�magic_cmr�r��{rr)r�r
r�rr�r�rsr�rr�ry)r��pcr-r�rKrs �rr�zKAsyncContextManagerTest.test_set_return_value_of_aenter.<locals>.inner_testds�����$�$�&�B�"�
�6�B�J��
�+�B� �j�1�H�%�F�C�=�A�H�M�)1�B�M�M�&�+-�B�J�J�O�O�(������^�F����V�f�c�]�3rz%test set return value of aenter with r�r�s` r�test_set_return_value_of_aenterz7AsyncContextManagerTest.test_set_return_value_of_aentercsE��� 4�$�Y�/�I���� E�i�[�Q�R��9�%�S�R�0�R�R�r�c����fd�}ttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc�����d��j�}||����fd�}t|��}�j���j�jj��j�j
j��jj
��j
j
��j�|�y)NFc��~�K��4�d{���}d�ddd��d{���|S7�7�#1�d{���7swYSxYw�wrmr)rK�called�cm_mocks ��r�use_context_managerzqAsyncContextManagerTest.test_mock_supports_async_context_manager.<locals>.inner_test.<locals>.use_context_managerys3�����"�7�f�!�F�#�7��
�#��7��7�7�7��
�s0�=�#�=�'�=�%�=�=�:�0�:�=)r�rrOr�r�r�r��assertIsNot)r�r-r�� cm_resultr�r�rs @@�rr�zTAsyncContextManagerTest.test_mock_supports_async_context_manager.<locals>.inner_testts�����F��-�-�/�B���m�G�
��/�1�2�I��O�O�F�#��O�O�G�.�.�5�5�6��O�O�G�-�-�4�4�5����-�-�/����,�,�.����W�i�0rz!test context manager magics with r�r�s` r�(test_mock_supports_async_context_managerz@AsyncContextManagerTest.test_mock_supports_async_context_managerssE��� 1�($�Y�/�I���� A�)��M�N��9�%�O�N�0�N�N�r�c���|j�}t|��t�}|�j_�fd�}|jt
|��|�y)Nc��z�K��4�d{���}|cddd��d{���S7�7�#1�d{���7swYyxYw�wrr)rK�
mock_instances �rr�z^AsyncContextManagerTest.test_mock_customize_async_context_manager.<locals>.use_context_manager�s$�����$�}���%�}�}��}��}�}�}�s0�;�"�;�&�;�$�;�;�8�/�8�;)r�r
rTr�rsr^r)rr��expected_resultr�r�s @r�)test_mock_customize_async_context_managerzAAsyncContextManagerTest.test_mock_customize_async_context_manager�sN����/�/�1��!�(�+�
� �(��0?�
� � �-� �
�
�
�c�-�/�0�/�Brc������d�d��fd�}�fd�}|j�}t|��|�_|�_�fd�}t |��|j��|j��y)NFc���K�d�y�wrmr)r��enter_calleds �r�enter_coroutineziAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.enter_coroutine�s������L���c���K�d�y�wrmr)r��exit_calleds �r�exit_coroutinezhAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.exit_coroutine�s������K�r�c��x�K��4�d{��� ddd��d{���y7�7�#1�d{���7swYyxYw�wrr)r�s�rr�zmAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.use_context_manager�s"�����$�}��%�}�}��}��}�}�}�s0�:�!�:�%�:�#�:�:�7�.�7�:)r�r
r�r�rrO)rr�r�r�r�r�r�r�s @@@r�8test_mock_customize_async_context_manager_with_coroutinezPAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine�sl������� � ��/�/�1��!�(�+�
�#2�
� �"0�
�� � ��!�"�����%�����$rc��d�}|j�}t|�}|jt�5t ||��ddd�y#1swYyxYw)Nc��bK�|4�d{���t��7�#1�d{���7swYyxYw�wr)� TypeError)�context_managers r�raise_inzYAsyncContextManagerTest.test_context_manager_raise_exception_by_default.<locals>.raise_in�s����&���k�!�'�����s$�/��/��/�,�#�,�/)r�r
r�r�r)rr�r�r�s r�/test_context_manager_raise_exception_by_defaultzGAsyncContextManagerTest.test_context_manager_raise_exception_by_default�sH�� "��/�/�1��!�(�+�
�
�
�
�y�
)����'�(�*�
)�
)�s�A�AN)r,r-r.r�r�r�r�r�r�r�r�rrrr�r�Ms:��9�9�
2�2�
��&� &�4C�%�4)rr�c�4�eZdZGd�de�Zd�Zd�Zd�Zy)�AsyncIteratorTestc��eZdZd�Zd�Zd�Zy)�#AsyncIteratorTest.WithAsyncIteratorc��gd�|_y)N)r�� NormalFoo�baz)�itemsrs rr z,AsyncIteratorTest.WithAsyncIterator.__init__�s ��4�D�Jrc��yrrrs rr�z-AsyncIteratorTest.WithAsyncIterator.__aiter__�r&rc��K�y�wrrrs rr�z-AsyncIteratorTest.WithAsyncIterator.__anext__�s����4�r#N)r,r-r.r r�r�rrr�WithAsyncIteratorr��s�� 5� "�'rr�c���td���gd��j_�fd�}t|��}|j |gd��y)N�testerr�rSc��F�K��2�cgc3d{���}|��7�6c}Scc}w�wrr)�i� mock_iters �rr�z;AsyncIteratorTest.test_aiter_set_return_value.<locals>.main�s"�����%.�/�/��A�/��/�/��/�s$�!���
�����!)rr�rsrry)rr�rKr�s @r�test_aiter_set_return_valuez-AsyncIteratorTest.test_aiter_set_return_value�s;����8�,� �+4� ���(� 0��T�V��������+rc����fd�}ttfD]'}�jd|���5||�ddd��)y#1swY�4xYw)Nc�V���j�}||�}�jt|j���jt|j���j t|j
���j t|j
��yr)r�rrr�rOr�)r�r�r�rs �rr�zIAsyncIteratorTest.test_mock_aiter_and_anext_asyncmock.<locals>.inner_test�s�����-�-�/�H�%�h�/�M�
���0��1C�1C�D�E����0��1H�1H�I�J��O�O�/��0B�0B�C�D��O�O�/�
�0G�0G�H�Irz%test aiter and anext corourtine with r�r�s` r�#test_mock_aiter_and_anext_asyncmockz5AsyncIteratorTest.test_mock_aiter_and_anext_asyncmock�sF��� J�$�Y�/�I���� E�i�[�Q�R��9�%�S�R�0�R�R�r�c�����d��gd����fd�}���fd�}���fd�}ttfD]q}�jd|���5||�ddd��jd|���5||�ddd��jd|���5||�ddd��sy#1swY�VxYw#1swY�=xYw#1swY��xYw) Nc��RK�g}|23d{���}|j|��7�6|S�wr)�append)�iterator�accumulatorrVs r�iteratez6AsyncIteratorTest.test_mock_async_for.<locals>.iterate�s3�����K�&�
)�d��"�"�4�(�
)��h���s�'�$�"�$�'�$�')�FOO�BAR�BAZc�t��|�j��}�jt�|��g�yr)r�ryr)r�r�r�rs ��r�test_defaultz;AsyncIteratorTest.test_mock_async_for.<locals>.test_default�s0���%�d�&<�&<�&>�?�M����S���!7�8�"�=rc���|�j��}�dd|j_�jt �|����yr)r�r�rsryr�r�r��expectedr�rs ���r�test_set_return_valuezDAsyncIteratorTest.test_mock_async_for.<locals>.test_set_return_value�sB���%�d�&<�&<�&>�?�M�3;�A�;�M�#�#�0����S���!7�8�(�Crc���|�j��}t�dd�|j_�j t�|����yr)r��iterr�rsryrr�s ���r�test_set_return_value_iterzIAsyncIteratorTest.test_mock_async_for.<locals>.test_set_return_value_iter�sG���%�d�&<�&<�&>�?�M�37����3D�M�#�#�0����S���!7�8�(�Crzdefault value with zset return_value with zset return_value iterator with r�)rr�r�r�r�r�r�s` @@r�test_mock_async_forz%AsyncIteratorTest.test_mock_async_for�s���� �)�� >�
D�
D�
$�Y�/�I���� 3�I�;�?�@��Y�'�A���� 6�y�k�B�C�%�i�0�D���� ?� �{�K�L�*�9�5�M�L�0�@�@��D�C��M�L�s$� B �' B,� B8� B) �,B5 �8C N)r,r-r.rTr�r�r�r�rrrr�r��s��(�F�(�,�&�" 6rr�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�AsyncMockAssertc�"�t�|_yr)rr�rs r�setUpzAsyncMockAssert.setUps���K�� rc��DK�|j|i|���d{���y7��wr)r�r�s r�_runnable_testzAsyncMockAssert._runnable_tests�����d�i�i��(��(�(�(�s� �� c��"K�|�d{���S7��wrr)r� coroutines r�_await_coroutinez AsyncMockAssert._await_coroutines��������s��
�c�b�tt�}t|�5|j�ddd�|j t|j��|jj
�|jj�|jj�|jt�5|j�ddd�|jt�5|jj�ddd�y#1swY��xYw#1swY�NxYw#1swYyxYwr)rrrJr"rOr�
assert_called�assert_called_once�assert_called_once_withr�r�r�r�s r�"test_assert_called_but_not_awaitedz2AsyncMockAssert.test_assert_called_but_not_awaiteds�����$��
��
%�����&����+�D�,=�,=�>�?����'�'�)����,�,�.����1�1�3�
�
�
�~�
.����!�/�
�
�
�~�
.����,�,�.�/�
.�&�
%��/�
.��
.�
.�s#�D
�;D�)D%�
D�D"�%D.c�j�tt�}|j�}|jj�|jj �|jj�|j
t�5|jj�ddd�t|j|��|jj �|jj�|jj�|jj�y#1swY��xYwr)
rrr"rr r
r�r�r�rrr�r�)rr��mock_coroutines r�test_assert_called_then_awaitedz/AsyncMockAssert.test_assert_called_then_awaiteds�����$���*�*�,�����'�'�)����,�,�.����1�1�3�
�
�
�~�
.����,�,�.�/� �D�!�!�.�1�2����,�,�.����(�(�*����-�-�/����2�2�4�/�
.�s�D)�)D2c��|jt�5|jj�ddd�|jt�5|jj �ddd�t|j
��|jj�|jj�y#1swY��xYw#1swY�cxYwr) r�r�r�r�rrrr r�rs r�+test_assert_called_and_awaited_at_same_timez;AsyncMockAssert.test_assert_called_and_awaited_at_same_time+s���
�
�
�~�
.��I�I�$�$�&�/��
�
�~�
.��I�I�#�#�%�/� �D���!�"�� � �$�$�&�� � �%�%�'�/�
.��/�
.�s�B?�C�?C�Cc��tt�}|j�}t|�5|j�ddd�|j t
�5|jj
�ddd�|jj�t|j|��|jj
�|jj�y#1swY��xYw#1swY�~xYwr)rrr"rJr�r�r�rrrr��rr�rs r�)test_assert_called_twice_and_awaited_oncez9AsyncMockAssert.test_assert_called_twice_and_awaited_once6s�����$���%�%�'� � ��
%�����&�
�
�
�~�
.����,�,�.�/����'�'�)��D�!�!�)�,�-����(�(�*����-�-�/�&�
%��
.�
.�s�C%�C1�%C.�1C:c�f�tt�}|j�}|jj�t |j|��|j
t�5t |j|��ddd�|jj�y#1swY�$xYwr) rrr"r rrr�r�r�rs r�)test_assert_called_once_and_awaited_twicez9AsyncMockAssert.test_assert_called_once_and_awaited_twiceDs�����$���%�%�'� ����,�,�.��D�!�!�)�,�-�
�
�
�|�
,���%�%�i�0�1�-�
���(�(�*�-�
,�s�)B'�'B0c��|jt�5|jj�ddd�|jt�5|jj �ddd�|jt
�5t
|j|j��ddd�|jt�5|jj�ddd�|jt�5|jj �ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�fxYw#1swYyxYwr)r�r�r�r�rr�rrrs r�"test_assert_awaited_but_not_calledz2AsyncMockAssert.test_assert_awaited_but_not_calledNs���
�
�
�~�
.��I�I�$�$�&�/�
�
�
�~�
.��I�I�#�#�%�/�
�
�
�y�
)���%�%�d�i�i�0�1�*��
�
�~�
.��I�I�$�$�&�/�
�
�
�~�
.��I�I�#�#�%�/�
.�/�
.��
.�
.��
)�
)��/�
.��
.�
.�s;�D$�D0�%D<�E�E�$D-�0D9�<E�E�Ec�>�td�g}t|�5|jd�ddd�|jj|�|j t
�5|jj
|�ddd�y#1swY�^xYw#1swYyxYw�Nr�)r
rJr��assert_has_callsr�r�ry)r�kallss r� test_assert_has_calls_not_awaitsz0AsyncMockAssert.test_assert_has_calls_not_awaits\sr���e��
��
��
%��I�I�e��&�� � �"�"�5�)�
�
�
�~�
.��I�I�'�'��.�/�
.�&�
%��/�
.�s�B�"B�B�Bc�
�t|�5|j�ddd�ddifg}|j|jj|�t|�5|jd�ddd�t|�5|jd�ddd�t �t d�t d�g}|j|jj|�y#1swY��xYw#1swY��xYw#1swY�gxYw)N�rr�r�)rJr�ry�
mock_callsr
)r�kalls_empty�
mock_kallss r�0test_assert_has_mock_calls_on_async_mock_no_specz@AsyncMockAssert.test_assert_has_mock_calls_on_async_mock_no_specds���
��
%��I�I�K�&��B��|�n��������-�-�{�;�
��
%��I�I�e��&�
��
%��I�I�e��&��v�t�E�{�D��K�8�
�������-�-�z�:�&�
%��
&�
%��
%�
%�s#�C!�C-�C9�!C*�-C6�9Dc��tt�}t|�5|j�ddd�ddifg}|j |jj
|�|j |j
t
j�g�t|�5|jddddd��ddd�t
�t
ddddd��g}t
j�t
jddddd��g}|j |jj
|�|j |j
|�y#1swY��xYw#1swY��xYw) Nrrrqrurw�r6)r9r:)rrrJr"ryrr
)r�a_class_mockr �method_kallsr!s r�2test_assert_has_mock_calls_on_async_mock_with_speczBAsyncMockAssert.test_assert_has_mock_calls_on_async_mock_with_specqs�� ��,��
��
%��%�%�'�&��B��|�n������2�2�=�=�{�K�����0�0�4�3D�3D�3F�2G�H�
��
%��%�%�a��A��a�%�8�&����Q��1��Q� 7�8���'�'�)�4�+<�+<�Q��1��Q�+O�P�
�����2�2�=�=�|�L�����0�0�*�=�&�
%��&�
%�s�E�E�E�Ec�4�t|�5|jjdd��ddd�t|�5|jjjdtj
��ddd�|j
|jjddddifdd d
tj
ifgd�|j
|jjjdd d
tj
ifgd�y#1swY��xYw#1swY��xYw)Nrw)�fishrI)�cake� something)rwr)zsomething_else.something)rIr*z#method calls not recorded correctly)rJr�r+�something_elser�Cakery�method_callsrs r� test_async_method_calls_recordedz0AsyncMockAssert.test_async_method_calls_recorded�s���
��
%��I�I������-�&�
��
%��I�I�$�$�.�.�q�x�}�}�.�E�&�
������/�/�
�$����/�
'����
�
�/F�G�2
�
2� 3�
������1�1�>�>�&��v�x�}�}�.E�F�G�>� @�&�
%��
%�
%�s�D�6D�D�Dc�����fd�}|�j�t��5�j�ddd�t��5�jdd�ddd�t��5�jd��ddd��jj�|�j�tt�}t��5|j�ddd�t��5|jdd��ddd�|j�||�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�mxYw#1swY�RxYw)Nc���d}|D]L}t||�}�j|t��j|t��j |g��Ny)N)rzr.r)�getattrrfr�listry)r��namesr��attrrs �r�assert_attrsz:AsyncMockAssert.test_async_arg_lists.<locals>.assert_attrs�sN���D�E����t�T�*���%�%�d�I�6��%�%�d�D�1�� � ��r�*� rrqrurw)r9)r�rJr�rrr")rr6r�s` r�test_async_arg_listsz$AsyncMockAssert.test_async_arg_lists�s���� +� �T�Y�Y��
��
%��I�I�K�&�
��
%��I�I�a��O�&�
��
%��I�I��I�N�&�
� � �����T�Y�Y���:�&��
��
%����!�&�
��
%�����Q��'�&� �����V��#&�
%��
%�
%��
%�
%��&�
%��
%�
%�s;�D(�D4�.E�E�3E�(D1�4D=�E �E�E!c���|jt�5|jj�ddd�t |j��|jj�y#1swY�=xYwr)r�r�r�r�rrrs r�test_assert_awaitedz#AsyncMockAssert.test_assert_awaited�sQ��
�
�
�~�
.��I�I�$�$�&�/� �D���!�"�� � � � �"� /�
.�s�A-�-A6c��|jt�5|jj�ddd�t |j��|jj�t |j��|jt�5|jj�ddd�y#1swY��xYw#1swYyxYwr)r�r�r�r�rrrs r�test_assert_awaited_oncez(AsyncMockAssert.test_assert_awaited_once�s���
�
�
�~�
.��I�I�)�)�+�/� �D���!�"�� � �%�%�'��D���!�"�
�
�
�~�
.��I�I�)�)�+�/�
.�/�
.��/�
.�s�B>�C
�>C�
Cc�~�d}|jt|�5|jjd�ddd�t |j��d}|jt|�5|jjd�ddd�t |jd��|jjd�t |jd��|j
t�5|jjd�ddd�y#1swY��xYw#1swY��xYw#1swYyxYw)NzNot awaitedr�zexpected await not found�
SomethingElse)rDr�r�r�rrr�)r�msgs r�test_assert_awaited_withz(AsyncMockAssert.test_assert_awaited_with�s�����
�
#�
#�N�C�
8��I�I�)�)�%�0�9� �D���!�"�(��
�
#�
#�N�C�
8��I�I�)�)�%�0�9� �D����&�'�� � �%�%�e�,��D����0�1�
�
�
�~�
.��I�I�)�)�%�0�/�
.�9�
8��
9�
8��/�
.�s#�D�.D'�6D3�D$�'D0�3D<c��|jt�5|jjd�ddd�t |jd��|jjd�t |jd��|jt�5|jjd�ddd�y#1swY��xYw#1swYyxYwr)r�r�r�r�rrrs r�test_assert_awaited_once_withz-AsyncMockAssert.test_assert_awaited_once_with�s���
�
�
�~�
.��I�I�.�.�u�5�/� �D����&�'�� � �*�*�5�1��D����&�'�
�
�
�~�
.��I�I�.�.�u�5�/�
.�/�
.��/�
.�s�C�C�C�Cc� �|jt�5|jjd�ddd�t |jd��|jt�5|jjd�ddd�t |jd��|jjd�t |jd��|jjd�y#1swY��xYw#1swY��xYw)Nr�r�r=)r�r�r�r�rrrs r�test_assert_any_waitz$AsyncMockAssert.test_assert_any_wait�s���
�
�
�~�
.��I�I�&�&�u�-�/� �D����&�'�
�
�
�~�
.��I�I�&�&�u�-�/� �D����&�'�� � �"�"�5�)��D����0�1�� � �"�"�5�)�/�
.��/�
.�s�C8�)D�8D�D
c�j�td�td�g}|jt�5}|jj |�ddd�|jt
jj�d�t|jd��|jt�5|jj |�ddd�t|jd��|jt�5|jj |�ddd�t|jd��|jj |�t|jd��|jj |�y#1swY��JxYw#1swY��xYw#1swY��xYw)Nr�r�rqr=)r
r�r�r�ryry�len� exceptionr�rr)r�callsr-s r�test_assert_has_awaits_no_orderz/AsyncMockAssert.test_assert_has_awaits_no_order�s3���e��d�5�k�*��
�
�
�~�
.�"��I�I�'�'��.�/�����R�\�\�.�.�/��3��D����&�'�
�
�
�~�
.��I�I�'�'��.�/� �D����&�'�
�
�
�~�
.��I�I�'�'��.�/� �D����&�'�� � �#�#�E�*��D����0�1�� � �#�#�E�*�!/�
.��
/�
.��/�
.�s#�F�.F�F)�F�F&�)F2c�,�Gd�d�}t|j|�d��|jjt t
d�g�|jj
t
d�|jjt
d�y)Nc��eZdZd�Zy)�9AsyncMockAssert.test_awaits_asserts_with_any.<locals>.Fooc��yrr�r�others r�__eq__z@AsyncMockAssert.test_awaits_asserts_with_any.<locals>.Foo.__eq__����TrN�r,r-r.rOrrr�FoorK����)rrRrq)rrr�ryr
r r�r�)rrRs r�test_awaits_asserts_with_anyz,AsyncMockAssert.test_awaits_asserts_with_any�sg�� *� *� �D�����q�)�*�� � �#�#�T�#�q�\�N�3�� � �%�%�c�1�-�� � �"�"�3��*rc���Gd�d�}t|����fd�}t||�d���jttd�g��jtd��j
td�y)Nc��eZdZd�Zy)�BAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>.Fooc��yrrrMs rrOzIAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>.Foo.__eq__ rPrNrQrrrrRrWrSrrRr�c��,�K��|��d{���y7��wrr)r��mock_with_specs �r�_custom_mock_runnable_testzYAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>._custom_mock_runnable_test
s����� �$�'�'�'�s� ��rq)rrryr
r r�r�)rrRr[rZs @r�%test_awaits_asserts_with_spec_and_anyz5AsyncMockAssert.test_awaits_asserts_with_spec_and_anysh��� *� *�#��,�� (� �&�s�u�a�0�1��(�(�$�s�A�,��8��*�*�3��2��'�'��Q�/rc� �td�td�g}|jt�5|jj |d��ddd�t|j
d��|jt�5|jj |d��ddd�t|j
d��|jt�5|jj |d��ddd�t|j
d��|jj |d��t|j
d��|jj |d��y#1swY��#xYw#1swY��xYw#1swY��xYw)Nr�r�T)� any_order�bamf�qux)r
r�r�r�ryrr)rrGs r�test_assert_has_awaits_orderedz.AsyncMockAssert.test_assert_has_awaits_ordereds-���e��d�5�k�*��
�
�
�~�
.��I�I�'�'���'�>�/� �D����&�'�
�
�
�~�
.��I�I�'�'���'�>�/� �D����'�(�
�
�
�~�
.��I�I�'�'���'�>�/� �D����&�'�� � �#�#�E�T�#�:��D����&�'�� � �#�#�E�T�#�:�/�
.��/�
.��/�
.�s#�E+�E8�F�+E5�8F�F
c���|jj�t|j��|j t
�5|jj�ddd�y#1swYyxYwr)r�r�rrr�r�rs r�test_assert_not_awaitedz'AsyncMockAssert.test_assert_not_awaited(sM��� � �$�$�&��D���!�"�
�
�
�~�
.��I�I�(�(�*�/�
.�
.�s� A-�-A6c���dd�}t|��|_t|jd��|j t
dj
tjd���5}|jjt�g�ddd�|jjj�|j t
dj
tjd���5}|jjt�tdd�g�ddd�|j|jjt�y#1swY��xYw#1swY�@xYw) Nc��K�y�wrrr(s r�fzIAsyncMockAssert.test_assert_has_awaits_not_matching_spec_error.<locals>.f0s����T�r#r�rqz^{}$z6Awaits not found.
Expected: [call()]
Actual: [call(1)]z�Error processing expected awaits.
Errors: [None, TypeError('too many positional arguments')]
Expected: [call(), call(1, 2)]
Actual: [call(1)]rur)rr�rrrDr��format�re�escaperyr
r�rF� __cause__rfr�)rrfr-s r�.test_assert_has_awaits_not_matching_spec_errorz>AsyncMockAssert.test_assert_has_awaits_not_matching_spec_error/s��!��1�%�� ��D����"�#�
�
#�
#���
�
��I�I�2�3�4�5�
9;��I�I�'�'����1�
5�
���"�,�,�0�0�1�
�
#�
#���
�
��I�I�,�-�.�/�35��I�I�'�'����a���(<�=�/�
���b�l�l�4�4�i�@�'5�5��/�/�s�(%E�20E!�E�!E*N)r,r-r.rrrrrrrrrrr"r'r/r7r9r;r?rArCrHrTr\rarcrkrrrr�r�s��� �)��/�5� (�0�+�&�/�;�
>�
@��:#� ,�1�" 6�*�+�*+�0�;�&+�Arr��__main__)1rrGrZrh�unittest�
contextlibrrIr�requires_working_socketrrr�
unittest.mockr r
rrr
rrrrrrrr2r7r<r?rTrBr,rarrJ�TestCaserLrr�r�r�rr0rr�r�r�r�rrr�<module>rrs���� �� ��%������t�,�,�,�G�G�G�(� *� *����+���&���:�[�)���J�l�+������:A�h�/�/�:A�z/�x�(�(�/�d4�H�%�%�4�BM��)�)�M�`s+�H�%�%�s+�l1�x�(�(�1�8wH�,�wH�t$?��)�)�$?�Lo)�h�/�/�o)�dB6��)�)�B6�JDA�h�'�'�DA�N
�z���H�M�M�O�r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists