Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/__pycache__/test__xxinterpchannels.cpython-312.opt-2.pyc

�

'Μg����>�ddlmZddlZddlZddlmZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZe
jd�Zd�Zifd�ZGd	�d
ed
d��Zej(d��ZGd
�dedd��ZGd�dedd��Zdd�d�Zd�Zd�ZGd�dej6�ZGd�de�ZGd�de�ZGd�de�ZGd �d!ed!d"��Z ejBd#�Gd$�d%e��Z"e#d&k(rejH�yy)'�)�
namedtupleN)�dedent)�
import_helper)�interpreters�_run_output�clean_up_interpreters�_xxinterpchannelsc��t|||�y�N)�_run_interp)�id�source�shareds   �8/usr/local/lib/python3.12/test/test__xxinterpchannels.py�
run_interpr"s����F�F�#�c���t|�}tj�}||k(r*tj�|k7rt�t||�ytj|||�yr)rr�get_main�get_current�RuntimeError�exec�
run_string)r
rr�_mainns�mains     rrr&sS��
�F�^�F�� � �"�D��r�z��#�#�%��-����V�W������F�F�3rc�0��eZdZed��Zd�fd�	Z�xZS)�Interpreterc�Z�t||�r|St|t�r||�St�r)�
isinstance�str�NotImplementedError)�cls�raws  r�from_rawzInterpreter.from_raw4s*���c�3���J�
��S�
!��s�8�O�%�%rc�x��tj�}||k(r'|sd}n|dk7rtdj|���|}ng|�E|sd}n|dk(rtd��t	|tj
�s6tj
|�}n |r|dk(rd}|}ntj�}t�|�!|||�}|S)Nrz)name mismatch (expected "main", got "{}")�interpz!name mismatch (unexpected "main"))	rr�
ValueError�formatr�
InterpreterID�create�super�__new__)r!�namer
r�self�	__class__s     �rr+zInterpreter.__new__=s�����$�$�&��
��:������� �?�F�F�t�L�N�N��B�
�^������� �!D�E�E��b�,�"<�"<�=�!�/�/��3�������D��B��$�$�&�B��w��s�D�"�-���r�NN)�__name__�
__module__�__qualname__�classmethodr#r+�
__classcell__�r.s@rrr2s����&��&��rrzname idc#�HK�	d��y#tj$rYywxYw�wr)�channels�ChannelClosedError�rr�expect_channel_closedr:Xs%����+�
���&�&�
��
�s�"�	�"��"��"c�2��eZdZd�fd�	Zd�Zd�Zd�Z�xZS)�
ChannelActionc�<��|sd}|sd}t�|�||||�}|S)N�bothr�r*r+)r!�action�endr%r-r.s     �rr+zChannelAction.__new__ds,�����C���F��w��s�F�C��8���rc�:�|jdk(r#|jdvr[t|j��|jdvr#|jdvr*t|j��t|j��|jdvrt|j��y)N�use)�same�opposite�send�recv��close�force-close)r>rDrErFrG)rrD�other�extra)r@rAr&r%)r-�args�kwargss   r�__init__zChannelAction.__init__ls����;�;�%���x�x�C�C� ����*�*�
�[�[�4�
4��x�x�K�K� ����*�*��T�[�[�)�)��;�;�@�@��T�[�[�)�)�Arc�l�|jdk(r|S|jdk(r	|dk(rdSdS|jS)NrDrErFrG�rA�r-rAs  r�resolve_endzChannelAction.resolve_endxs9���8�8�v���J�
�X�X��
#� �F�]�6�6��6��8�8�Orc��|jdk(r|S|jdk(r
|�t�|S|jdk(r
|�t�|S|jdk(r*|jdk(r|S|r|jdk(r|St�y)NrDrKrLr)r%rr,)r-r%rKrLs    r�resolve_interpzChannelAction.resolve_interp�s����;�;�&� ��M�
�[�[�G�
#��}�"�"��L�
�[�[�G�
#��}�"�"��L�
�[�[�F�
"��{�{�f�$��
��5�:�:��/���"�"�
#rr/)r0r1r2r+rOrSrUr4r5s@rr<r<bs����
*��#rr<zaction end interpc�>��eZdZd	dd��fd�Zd�Zd�Zdd�d�Z�xZS)
�ChannelStateF��closedc�*��t�|�|||�}|Srr?)r!�pendingrYr-r.s    �rr+zChannelState.__new__�s����w��s�G�V�4���rc�V�t|�|jdz|j��S�N�rX��typer[rY�r-s r�incrzChannelState.incr��"���t�D�z�$�,�,��*�4�;�;�?�?rc�V�t|�|jdz
|j��Sr]r_ras r�decrzChannelState.decr�rcrT��forcec��|jr|r|jdk(r|St|�|rdd��S|jd��S)NrTrX)rYr[r`)r-rgs  rrIzChannelState.close�s?���;�;��D�L�L�A�-����t�D�z�u�!�t�D�D�$�,�,�t�D�Dr)r)r0r1r2r+rbrerIr4r5s@rrWrW�s,����%��@�@�"�E�ErrWzpending closedT��
hideclosedc���|jr|dk(r|dk(r|jrd}nd}nd}	t||||�}|rd�|S#tj$r|s|s�|j�}Y|SwxYw)NrCrGFT.)rYr[�_run_actionr7r8rI)�cidr@rA�staterj�
expectfail�results       r�
run_actionrq�s����|�|��U�?�s�f�}�����J��J��
���S�&�#�u�5����I��M���&�&���*��������M��s�A�(A,�+A,c�R�|dk(r�|dk(r&tj|d�|j�S|dk(rR|js!	tj	|�td��tj	|�|j�St|��|dk(r1i}|dvrd||<tj|fi|��|j�S|d	k(r5d
di}|dvrd||<tj|fi|��|jd��St|��#tj$r|cYSwxYw)NrCrF�spamrGzexpected ChannelEmptyErrorrI�rGrFTrJrgrf)
r7rFrbr[rG�	Exception�ChannelEmptyErrorrer&rI)rmr@rArnrNs     rrlrl�s'��
����&�=��M�M�#�w�'��:�:�<��
�F�]��=�=�B��M�M�#�&�$�$@�A�A��
�
�c�"��z�z�|�#��S�/�!�	�7�	����"�"��F�3�K����s�%�f�%��{�{�}��	�=�	 ��T����"�"��F�3�K����s�%�f�%��{�{��{�&�&��� � ��1 �1�1�!� �L�!�s�D�D&�%D&c��tj�D]}	tj|��y#tj$rY�1wxYwr)r7�list_all�destroy�ChannelNotFoundError�rms r�clean_up_channelsr|�sB��� � �"��	����S�!�#���,�,�	��	�s�1�A�Ac��eZdZd�Zy)�TestBasec�,�t�t�yr)r|rras r�tearDownzTestBase.tearDown�s�����rN)r0r1r2r�r9rrr~r~�s�� rr~c�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�ChannelIDTestsc��tjdd��}|jt|�d�|j|jd�y)N�
Trfr>)r7�_channel_id�assertEqual�intrA�r-rms  r�test_default_kwargsz"ChannelIDTests.test_default_kwargs�s?���"�"�2�T�"�2������S��2�&�������&�)rc��tjddd��}|j|jd�tjdddd��}|j|jd�tjddd��}|j|jd�tjdddd�	�}|j|jd�tjdddd��}|j|jd
�y)Nr�T�rFrgrFF�rFrGrg�rGrgrG)rGrFrgr>)r7r�r�rAr�s  r�test_with_kwargszChannelIDTests.test_with_kwargs�s����"�"�2�D��"�=��������&�)��"�"�2�D�u�D�"�I��������&�)��"�"�2�D��"�=��������&�)��"�"�2�D�u�D�"�I��������&�)��"�"�2�D�t�4�"�H��������&�)rc��Gd�dt�}tj|�d��}|jt	|�d�y)Nc��eZdZd�Zy)�*ChannelIDTests.test_coerce_id.<locals>.Intc��y�Nr�r9ras r�	__index__z4ChannelIDTests.test_coerce_id.<locals>.Int.__index__
s��rN)r0r1r2r�r9rr�Intr�s��
rr�Trfr�)rr7r�r�r�)r-r�rms   r�test_coerce_idzChannelIDTests.test_coerce_ids;��	�#�	��"�"�3�5��"�5������S��2�&rc���|jttjt	��|jttjd�|jttjd�|jttjd�|jt
tjd�|jttjd�y)Ng$@�10s10���l)�assertRaises�	TypeErrorr7r��objectr&�
OverflowErrorras r�test_bad_idzChannelIDTests.test_bad_ids������)�X�%9�%9�6�8�D����)�X�%9�%9�4�@����)�X�%9�%9�4�@����)�X�%9�%9�5�A����*�h�&:�&:�B�?����-��)=�)=�u�Erc��|jt�5tjddd��ddd�y#1swYyxYw)Nr�F�rFrG)r�r&r7r�ras r�test_bad_kwargszChannelIDTests.test_bad_kwargss1��
�
�
�z�
*�� � ��%�e� �<�+�
*�
*�s	�8�Ac���tj�}|jtj�5tj	t|�dz�ddd�y#1swYyxYw�Nr^)r7r)r�rzr�r�r�s  r�test_does_not_existz"ChannelIDTests.test_does_not_existsD���o�o���
�
�
�x�<�<�
=�� � ��S��A��.�>�
=�
=�s�"A�A(c�h�tjdd��}|jt|�d�y)Nr�Trfr�)r7r�r�rr�s  r�test_strzChannelIDTests.test_str$s+���"�"�2�T�"�2������S��4�(rc��tjdd��}|jt|�d�tjddd��}|jt|�d�tjddd��}|jt|�d�tjdddd�	�}|jt|�d�y)
Nr�Trfz
ChannelID(10)r�zChannelID(10, send=True)r�zChannelID(10, recv=True)r�)r7r�r��reprr�s  r�	test_reprzChannelIDTests.test_repr(s����"�"�2�T�"�2������c��O�4��"�"�2�D��"�=������c��$>�?��"�"�2�D��"�=������c��$>�?��"�"�2�D�t�4�"�H������c��O�4rc��tj�}tjt|��}tj�}|j	||k(�|j	||k(�|j	|t|�k(�|j	t|�|k(�|j	|tt|��k(�|j	tt|��|k(�|j
|tt|��dzk(�|j
|tt|��k(�|j
|ddzk(�|j
|td�k(�|j
|dk(�|j
||k(�|j
||k7�|j
||k7�|j	||k7�y)N皙�����?����inf�spam)r7r)r�r��
assertTrue�float�assertFalser)r-�cid1�cid2�cid3s    r�
test_equalityzChannelIDTests.test_equality5sm����� ���#�#�C��I�.����� ��������%�������%������D�	�)�*�����D�	�T�)�*������c�$�i� 0�0�1�����c�$�i�(�D�0�1������s�4�y�!1�C�!7�7�8������S��Y��/�0������D���)������u��-�.�������(�������&�������&�������&�������%rc��tj�}tj�}tj||�tj|�}|j	||�|jt
|�t
|��yr)r7r)rFrGr��assertIsr`)r-�chan�obj�gots    r�test_shareablezChannelIDTests.test_shareableKs\����� ���o�o����
�
�d�C� ��m�m�D�!������c�"��
�
�d�3�i��c��+rN)
r0r1r2r�r�r�r�r�r�r�r�r�r�r9rrr�r��s5��*�*� '�F�=�/�
)�5�&�,,rr�c� �eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zej4d�d��Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+y))*�ChannelTestsc�l�tj�}|j|tj�yr)r7r)�assertIsInstance�	ChannelIDr�s  r�test_create_cidzChannelTests.test_create_cidZs$���o�o������c�8�#5�#5�6rc��tj�}tj�}tj�}tj�}tj�}|j|t	|�dz�|j|t	|�dz�|jt|�t|�z
|||h�yr�)r7rxr)r�r��set)r-�before�id1�id2�id3�afters      r�test_sequential_idsz ChannelTests.test_sequential_ids^s����"�"�$���o�o����o�o����o�o����!�!�#������c�#�h��l�+�����c�#�h��l�+�����U��c�&�k�1�C��c�?�Crc�H�tj�}t|td��}t	|j��}tj�}t|td��}t	|j��}|j
|t	|�dz�y)Nz{
            import _xxinterpchannels as _channels
            cid = _channels.create()
            print(cid)
            r^)rr)rrr��stripr�)r-r��outr�r�r�s      r�test_ids_globalzChannelTests.test_ids_globalis����!�!�#���#�v�'� ���
�3�9�9�;����!�!�#���#�v�'� ���
�3�9�9�;�������s�4�y�1�}�-rc���	tj�}tj|d��}tj|d��}|j|g�|j|g�y)NT�rFF)r7r)�list_interpretersr�)r-rm�send_interps�recv_interpss    r�#test_channel_list_interpreters_nonez0ChannelTests.test_channel_list_interpreters_none|s[��K��o�o����1�1�#�D�1�A���1�1�#�E�1�B������r�*�����r�*rc�*�	tj�}tj�}tj	|d�tj|d��}tj|d��}|j
||g�|j
|g�tj�}t|td|�d���tj|d��}tj|d��}|j
||g�|j
||g�y)NrFTr�F�T
            import _xxinterpchannels as _channels
            obj = _channels.recv(�)
            )	rrr7r)rFr�r�rr)r-�interp0rmr�r��interp1s      r�$test_channel_list_interpreters_basicz1ChannelTests.test_channel_list_interpreters_basic�s���6��'�'�)���o�o����
�
�c�6�"��1�1�#�D�1�A���1�1�#�E�1�B�������y�1�����r�*��%�%�'���G�V�)"�"%��'
�%��	�
 �1�1�#�D�1�A���1�1�#�E�1�B�������y�1������y�1rc�`�	tj�}tj�}tj�}tj�}tj�}tj	|d�t|t
d|�d���t|t
d|�d���t|t
d|�d���tj|d��}tj|d��}|jt|�||h�|jt|�||h�y)	NrF�N
            import _xxinterpchannels as _channels
            _channels.send(z, "send")
            r�r�Tr�F)
rrr)r7rFrrr�r�r�)r-r�r��interp2�interp3rmr�r�s        r�'test_channel_list_interpreters_multiplez4ChannelTests.test_channel_list_interpreters_multiple�s*��M��'�'�)���%�%�'���%�%�'���%�%�'���o�o����
�
�c�6�"��G�V�)��5�!
�%��	�	�G�V�)"�"%��'
�%��	�	�G�V�)"�"%��'
�%��	� �1�1�#�D�1�A���1�1�#�E�1�B������\�*�W�g�,>�?�����\�*�W�g�,>�?rc�T�	tj�}tj�}tj�}tj	|d�t|t
d|�d���tj|d��}tj|d��}|j||g�|j||g�tj|�tj|d��}tj|d��}|j||g�|j|g�y)NrFr�r�Tr�F)
rrr)r7rFrrr�r�ry�r-r�r�rmr�r�s      r�(test_channel_list_interpreters_destroyedz5ChannelTests.test_channel_list_interpreters_destroyed�s
��M��'�'�)���%�%�'���o�o����
�
�c�6�"��G�V�)"�"%��'
�%��	�
 �1�1�#�D�1�A���1�1�#�E�1�B�������y�1������y�1����W�%��1�1�#�D�1�A���1�1�#�E�1�B�������y�1�����r�*rc�
�	tj�}tj�}tj�}tj�}tj	|d�t|t
d|�d���tj	|d�t|t
d|�d���tj|d��}tj|d��}|jt|�d�|jt|�d�tj|d��tj|d��}tj|d��}|jt|�d	�|jt|�d�t|t
d
|�d���tj|d��}tj|d��}|jt|�d	�|j||g�y)N�datar�r�Tr�Fr^r�r�Q
            import _xxinterpchannels as _channels
            _channels.release()rrr)r7rFrrr�r��len�release)r-r�r�r�rmr�r�s       r�'test_channel_list_interpreters_releasedz4ChannelTests.test_channel_list_interpreters_released�s���H��'�'�)���%�%�'���%�%�'���o�o����
�
�c�6�"��G�V�)"�"%��'
�%��	�	�
�
�c�6�"��G�V�)"�"%��'
�%��	�
 �1�1�#�D�1�A���1�1�#�E�1�B������\�*�A�.�����\�*�A�.�	����4��(��1�1�#�D�1�A���1�1�#�E�1�B������\�*�A�.�����\�*�A�.�	�G�V�)�"�e�$
�%��	�
 �1�1�#�D�1�A���1�1�#�E�1�B������\�*�A�.������y�1rc���	tj�}tj�}tj�}tj	|d�tj|d��}tj|d��}|j
t|�d�|j
t|�d�tj|d��|jtj�5tj|d��ddd�|jtj�5tj|d��ddd�y#1swY�IxYw#1swYyxYw)NrFTr�Fr^rrf)rrr)r7rFr�r�r�rIr�r8r�s      r�%test_channel_list_interpreters_closedz2ChannelTests.test_channel_list_interpreters_closed�s��F��'�'�)���%�%�'���o�o����
�
�c�6�"� �1�1�#�D�1�A���1�1�#�E�1�B������\�*�A�.�����\�*�A�.�	���s�$��'�
�
�
�x�:�:�
;��&�&�s��&�6�<�
�
�
�x�:�:�
;��&�&�s��&�7�<�
;�<�
;��
;�
;�s�.E�-E�E�E#c���	tj�}tj�}tj�}tj	|d�tj|d��}tj|d��}|j
t|�d�|j
t|�d�tj|d��|jtj�5tj|d��ddd�tj|d��}|j
t|�d�t|td|�d���y#1swY�UxYw)	NrFTr�Fr^r�O
            import _xxinterpchannels as _channels
            _channels.close(�, force=True)
            )
rrr)r7rFr�r�r�rIr�r8rrr�s      r�.test_channel_list_interpreters_closed_send_endz;ChannelTests.test_channel_list_interpreters_closed_send_end
s0��Q��'�'�)���%�%�'���o�o����
�
�c�6�"� �1�1�#�D�1�A���1�1�#�E�1�B������\�*�A�.�����\�*�A�.�	���s���&�
�
�
�x�:�:�
;��&�&�s��&�6�<� �1�1�#�E�1�B������\�*�A�.�	�G�V�)� �E�"
�%��	�	�<�
;�s�.E�E#c���tj�}d}tj||�tj|�}|j	||�|j||�y�Nrs)r7r)rFrGr��assertIsNot)r-rm�origr�s    r�test_send_recv_mainz ChannelTests.test_send_recv_main2sO���o�o������
�
�c�4� ��m�m�C� ������d�#�����d�#rc�V�tj�}t|td��}y)Na

            import _xxinterpchannels as _channels
            cid = _channels.create()
            orig = b'spam'
            _channels.send(cid, orig)
            obj = _channels.recv(cid)
            assert obj is not orig
            assert obj == orig
            )rr)rr)r-r�r�s   r�test_send_recv_same_interpreterz,ChannelTests.test_send_recv_same_interpreter;s(���!�!�#���#�v�'� ��rc���tj�}tj�}t|t	d|�d���}tj|�}|j
|d�y)Nr��, b'spam')
            rs)r7r)rrrrGr�)r-rmr�r�r�s     r�%test_send_recv_different_interpretersz2ChannelTests.test_send_recv_different_interpretersGsc���o�o����!�!�#���#�v�+��5�!
�'� ����m�m�C� ������g�&rc���tj���fd�}tj|��}|j	�tj�d�|j
�tj��}|j|d�y)Nc���		tj��}	tj�|�y#tj$rtjd�YnwxYw�])Nr�)r7rGrv�time�sleeprF)r�rms �r�fz8ChannelTests.test_send_recv_different_threads.<locals>.fUsS����$�"�-�-��,�C��
�M�M�#�s�#�� �1�1�$��J�J�s�O�$��	s�1�(A�A��targetrs)	r7r)�	threading�Thread�startrF�joinrGr�)r-r��tr�rms    @r� test_send_recv_different_threadsz-ChannelTests.test_send_recv_different_threadsRsd����o�o���	$�
���A�&��	���	��
�
�c�7�#�	�����m�m�C� ������g�&rc�R����tj��tj��d����fd�}tj|��}|j�tj
�d�|j�tj��}|j|d�y)Nc
�>��t�td��d��d����y)Nz�
                import time
                import _xxinterpchannels as _channels
                while True:
                    try:
                        obj = _channels.recv(z�)
                        break
                    except _channels.ChannelEmptyError:
                        time.sleep(0.1)
                assert(obj == b'spam')
                _channels.send(z, b'eggs')
                )rr)rmr�r�s���rr�zIChannelTests.test_send_recv_different_interpreters_and_threads.<locals>.fks8����c�6�/.�
/2�U�3 �
!$�u�%�+�$��Crr�rs�eggs)
r7r)rrrrrFrrGr�)r-r�rr�rmr�r�s    @@@r�1test_send_recv_different_interpreters_and_threadsz>ChannelTests.test_send_recv_different_interpreters_and_threadsfsw����o�o����!�!�#����
	�
���A�&��	���	��
�
�c�7�#�	�����m�m�C� ������g�&rc��|jtj�5tjdd�ddd�y#1swYyxYw)Nr�rs)r�r7rzrFras r�test_send_not_foundz ChannelTests.test_send_not_found�s0��
�
�
�x�<�<�
=��M�M�"�g�&�>�
=�
=�s�A�A	c��|jtj�5tjd�ddd�y#1swYyxYwr�)r�r7rzrGras r�test_recv_not_foundz ChannelTests.test_recv_not_found�s.��
�
�
�x�<�<�
=��M�M�"��>�
=�
=�s	�?�Ac��tj�}|jtj�5tj	|�ddd�y#1swYyxYwr)r7r)r�rvrGr�s  r�test_recv_emptyzChannelTests.test_recv_empty�s:���o�o���
�
�
�x�9�9�
:��M�M�#��;�
:�
:�s�A�Ac���t�}tj�}tj||�}tj	|d�tj	|d�tj	|d�tj	|d�tj||�}tj||�}tj|�}tj||�}tj||�}|j||�|j|d�|j
|d�|j
|d�|j
|d�|j||�y)Nr^rsr)r�r7r)rGrFr�r�)	r-�defaultrm�obj1�obj2�obj3�obj4�obj5�obj6s	         r�test_recv_defaultzChannelTests.test_recv_default�s���(���o�o����}�}�S�'�*���
�
�c�4� ��
�
�c�1���
�
�c�7�#��
�
�c�7�#��}�}�S�'�*���}�}�S�'�*���}�}�S�!���}�}�S�'�*���}�}�S�'�*���
�
�d�G�$��
�
�d�D�!�����q�!�����w�'�����w�'��
�
�d�G�$rc	��|jd�5tj�}tj�}tj|td|�d���tj|�|jtd|�d��5tj|�ddd�~ddd�|jd�5tj�}tj�}tj|td|�d���tj|d�tj|�tj|�|jtd|�d��5tj|�ddd�~ddd�y#1swY��xYw#1swY��xYw#1swY�+xYw#1swYyxYw)	NrYzV
                import _xxinterpchannels as _channels
                _channels.send(�, b'spam')
                zchannel z
 is closedz
still openrz	 is empty)�subTestr7r)rrrry�assertRaisesRegexrrGrF)r-r�r%r�s    r�"test_recv_sending_interp_destroyedz/ChannelTests.test_recv_sending_interp_destroyed�s���
�\�\�(�
#��?�?�$�D�!�(�(�*�F��#�#�F�F�8 � $�v�&�4�-�
�
� � ��(��'�'��*2�4�&�
�(C�E��
�
�d�#�E��$��\�\�,�
'��?�?�$�D�!�(�(�*�F��#�#�F�F�8 � $�v�&�4�-�
�
�M�M�$��(�� � ��(��M�M�$���'�'��*2�4�&�	�(B�D��
�
�d�#�D��(�
'�	E�E��$�
#��0D�D��(�
'�sI�A;F�
F�#	F�B&F7�+F+�	F7�F	�F�F(�+F4	�0F7�7Gc�P�tj�}gd�}|D]}}|j|�5tj||�tj	|�}|j||�|j
t|�t|��ddd��y#1swY��xYw)N)Nr�rs�*)r7r)rrFrGr�r�r`)r-rm�objectsr�r�s     r�test_allowed_typeszChannelTests.test_allowed_types�s~���o�o���
���C����c�"��
�
�c�3�'��m�m�C�(��� � ��c�*��
�
�d�3�i��c��3�#�"��"�"�s�A"B�B%	c�6�tj�}tj�}t|t	d�t|j���}tj|�}|j|d�|j|j�d�y)Nz�
            import _xxinterpchannels as _channels
            print(cid.end)
            _channels.send(cid, b'spam')
            r{rsrF)
r7r)rrr�dictrFrGr�r��r-rmr%r�r�s     r�test_run_string_arg_unresolvedz+ChannelTests.test_run_string_arg_unresolved�sx���o�o����$�$�&���&�&�*�#�

�S�X�X�� ���m�m�C� ������g�&��������f�-rz(disabled until high-level channels existc�d�tj�}tj|d��}tj�}t	|td�t
|j���}tj|�}|j|d�|j|j�d�y)NT)�_resolvez�
            import _xxinterpchannels as _channels
            print(chan.id.end)
            _channels.send(chan.id, b'spam')
            )r�rsrF)r7r)r�rrrr#rFrGr�r�r$s     r�test_run_string_arg_resolvedz)ChannelTests.test_run_string_arg_resolved�s����o�o����"�"�3��"�6���$�$�&���&�&�*�#�

�c�h�h��!���m�m�C� ������g�&��������f�-rc���tj�}tj|d�tj|�tj	|�|jtj�5tj|d�ddd�|jtj�5tj|�ddd�y#1swY�GxYw#1swYyxYw�Nrsr�r7r)rFrGrIr�r8r�s  r�test_close_single_userz#ChannelTests.test_close_single_user�s����o�o����
�
�c�7�#��
�
�c�����s��
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;���4C�2C�C�C&c	�"�tj�}tj�}tj�}tj|t	d|�d���tj|t	d|�d���tj|�|j
tj�5}tj|t	d|�d���ddd�|jdtj��|j
tj�5}tj|t	d|�d���ddd�|jdt|j��y#1swY��xYw#1swY�;xYw)Nr�r�zN
            import _xxinterpchannels as _channels
            _channels.recv(r�z 
                _channels.send(rr8)r7r)rrrrIr��RunFailedError�assertInr�	exception)r-rmr�r��cms     r�test_close_multiple_usersz&ChannelTests.test_close_multiple_userssb���o�o����!�!�#���!�!�#������V�1��5�!
�-�&�	�	����V�1��5�!
�-�&�	�	���s��
�
�
�|�:�:�
;�r��#�#�C��5 � #�u�%�1�*�
�<�	
�
�
�*�C����,=�>�
�
�
�|�:�:�
;�r��#�#�C��5 � #�u�%�1�*�
�<�	
�
�
�*�C����,=�>�<�
;��
<�
;�s�7$E9�'$F�9F�Fc�>�tj�}tj|d�tj|�tj	|�|jtj�5tj	|�ddd�y#1swYyxYwr�r+r�s  r�test_close_multiple_timesz&ChannelTests.test_close_multiple_timess`���o�o����
�
�c�7�#��
�
�c�����s��
�
�
�x�:�:�
;��N�N�3��<�
;�
;�s�4B�Bc�F�gd�}|D]�\}}|j||f�5tj�}tj|d�tj	|�tj|||��|j
tj�5tj|d�ddd�|j
tj�5tj	|�ddd�ddd���y#1swY�QxYw#1swY� xYw#1swY��xYw)N))FF�TF)FT)TTrsr�r)rr7r)rFrGrIr�r8)r-�testsrFrGrms     r�test_close_emptyzChannelTests.test_close_empty&s����� �J�D�$����t�T�l�+��o�o�'���
�
�c�7�+��
�
�c�"����s��D��9��&�&�x�'B�'B�C��M�M�#�w�/�D��&�&�x�'B�'B�C��M�M�#�&�D�,�+� �D�C��C�C��,�+�s<�A7D�C>�.'D�D
�+D�>D�D�
D�D�D 	c�l�tj�}tj|d�tj|d�|jtj�5tj|�ddd�tj
|�tj|d�y#1swY�5xYw)Nrs�hamr�r7r)rFr��ChannelNotEmptyErrorrIrGr�s  r�%test_close_defaults_with_unused_itemsz2ChannelTests.test_close_defaults_with_unused_items9sr���o�o����
�
�c�7�#��
�
�c�6�"�
�
�
�x�<�<�
=��N�N�3��>��
�
�c���
�
�c�7�#�>�
=�s� B*�*B3c���tj�}tj|d�tj|d�|jtj�5tj|d��ddd�tj
|�tj|d�tj
|�tj
|�tj|d��y#1swY�vxYw)Nrsr;T�rGrr<r�s  r�*test_close_recv_with_unused_items_unforcedz7ChannelTests.test_close_recv_with_unused_items_unforcedCs����o�o����
�
�c�7�#��
�
�c�6�"�
�
�
�x�<�<�
=��N�N�3�T�N�*�>��
�
�c���
�
�c�7�#��
�
�c���
�
�c�����s���&�
>�
=�s� C-�-C6c�,�tj�}tj|d�tj|d�tj|d��|j	tj
�5tj|d�ddd�tj
|�tj
|�|j	tj
�5tj
|�ddd�y#1swY�qxYw#1swYyxYw)Nrsr;Tr�r�r7r)rFrIr�r8rGr�s  r�*test_close_send_with_unused_items_unforcedz7ChannelTests.test_close_send_with_unused_items_unforcedPs����o�o����
�
�c�7�#��
�
�c�6�"����s���&�
�
�
�x�:�:�
;��M�M�#�w�'�<��
�
�c���
�
�c��
�
�
�x�:�:�
;��M�M�#��<�
;�	<�
;��<�
;�s�7C>�D
�>D�
Dc���tj�}tj|d�tj|d�|jtj�5tj|dd��ddd�tj
|�tj|d�tj
|�tj
|�tj|d��y#1swY�vxYw)Nrsr;Trtrr@r<r�s  r�*test_close_both_with_unused_items_unforcedz7ChannelTests.test_close_both_with_unused_items_unforced]s����o�o����
�
�c�7�#��
�
�c�6�"�
�
�
�x�<�<�
=��N�N�3�T��N�5�>��
�
�c���
�
�c�7�#��
�
�c���
�
�c�����s���&�
>�
=�s� C.�.C7c���tj�}tj|d�tj|d�tj|dd��|j	tj
�5tj|d�ddd�|j	tj
�5tj
|�ddd�y#1swY�GxYw#1swYyxYw)Nrsr;Tr�rrCr�s  r�(test_close_recv_with_unused_items_forcedz5ChannelTests.test_close_recv_with_unused_items_forcedj����o�o����
�
�c�7�#��
�
�c�6�"����s��T��2�
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;���8C�6C!�C�!C*c���tj�}tj|d�tj|d�tj|dd��|j	tj
�5tj|d�ddd�|j	tj
�5tj
|�ddd�y#1swY�GxYw#1swYyxYw)Nrsr;Tr�rrCr�s  r�(test_close_send_with_unused_items_forcedz5ChannelTests.test_close_send_with_unused_items_forcedurIrJc���tj�}tj|d�tj|d�tj|ddd��|j	tj
�5tj|d�ddd�|j	tj
�5tj
|�ddd�y#1swY�GxYw#1swYyxYw)Nrsr;Tr�rrCr�s  r�(test_close_both_with_unused_items_forcedz5ChannelTests.test_close_both_with_unused_items_forced�s����o�o����
�
�c�7�#��
�
�c�6�"����s��D���=�
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�s�9C�7C"�C�"C+c�|�tj�}tj|�|jtj�5tj|d�ddd�|jtj�5tj
|�ddd�y#1swY�GxYw#1swYyxYwr�)r7r)rIr�r8rFrGr�s  r�test_close_never_usedz"ChannelTests.test_close_never_used�sy���o�o������s��
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;���	B&�B2�&B/�2B;c���tj�}tj|d�tj�}tj|td|�d���|j
tj�5tj|�ddd�|j
tj�5tj|�ddd�y#1swY�GxYw#1swYyxYw)Nrsr�r�)
r7r)rFrrrr�r8rGrI�r-rmr%s   r�!test_close_by_unassociated_interpz.ChannelTests.test_close_by_unassociated_interp�s����o�o����
�
�c�7�#��$�$�&�������4� �E�"
�0�)�	��
�
�x�:�:�
;��M�M�#��<�
�
�
�x�:�:�
;��N�N�3��<�
;�<�
;��
;�
;�s�C�>C)�C&�)C2c�.�tj�}tj|d�tj|d�tj|d�tj|�tj	|d��|jtj�5tj|d�ddd�|jtj�5tj|�ddd�y#1swY�GxYw#1swYyxYw)NrsTrfrr+r�s  r�-test_close_used_multiple_times_by_single_userz:ChannelTests.test_close_used_multiple_times_by_single_user�s����o�o����
�
�c�7�#��
�
�c�7�#��
�
�c�7�#��
�
�c�����s�$��'�
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�s�"C?� D�?D�Dc��tj�}|jtj�5tj	dd��ddd�tj|�|jtj�5tj	|d��ddd�y#1swY�^xYw#1swYyxYw)Nr�Tr�)r7r)r�rzr�rIr8r�s  r�.test_channel_list_interpreters_invalid_channelz;ChannelTests.test_channel_list_interpreters_invalid_channel�s����o�o���
�
�
�x�<�<�
=��&�&�t�$�&�7�>�	���s��
�
�
�x�:�:�
;��&�&�s��&�6�<�
;�>�
=��
<�
;�s�B)�B5�)B2�5B>c��tj�}|jt�5tj	|�ddd�y#1swYyxYwr)r7r)r�r�r�r�s  r�+test_channel_list_interpreters_invalid_argsz8ChannelTests.test_channel_list_interpreters_invalid_args�s6���o�o���
�
�
�y�
)��&�&�s�+�*�
)�
)�s�A	�	AN),r0r1r2r�r�r�r�r�r�r�r�r�r�r�r�r�rr	rr
rrrr!r%�unittest�skipr(r,r3r5r9r>rArDrFrHrLrNrPrTrVrXrZr9rrr�r�Xs���7�	D�.�&+�2�,@�4+�.)2�V8�,!8�J$�
�	'�'�('�8'���
%�*�<4�&
.�$�X�]�]�=�>�.�?�.�$	�?�0 �'�&$�'��'�	�	�	�� ��	7�,rr�c�N�eZdZ			d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�ChannelReleaseTestsc���tj�}tj|d�tj|�tj	|dd��|jtj�5tj|d�ddd�|jtj�5tj|�ddd�y#1swY�GxYw#1swYyxYw�NrsTr�r�r7r)rFrGr�r�r8r�s  r�test_single_userz$ChannelReleaseTests.test_single_user�s����o�o����
�
�c�7�#��
�
�c������4�d��3�
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�s�7C�5C �C� C)c
��tj�}tj�}tj�}tj|t	d|�d���t|t	d|�d|�d���}tj|t	d|�d���|j
|j�d�y)	Nr�r�r�z )
            _channels.release(z+)
            print(repr(obj))
            z
            _channels.release(r�zb'spam')r7r)rrrrr�r�)r-rmr�r�r�s     r�test_multiple_usersz'ChannelReleaseTests.test_multiple_users�s����o�o����!�!�#���!�!�#������V�1��5�!
�-�&�	��#�v�+"�"%��'�"�e�$
�'� ���	����V�1�"�e�$
�-�&�	�	
�������i�0rc���tj�}tj|d�tj|�tj	|�|jtj�5tj|d�ddd�|jtj�5tj|�ddd�y#1swY�GxYw#1swYyxYwr*rar�s  r�test_no_kwargsz"ChannelReleaseTests.test_no_kwargs
s����o�o����
�
�c�7�#��
�
�c�������
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�r-c�J�tj�}tj|d�tj|�tj	|dd��|jtj�5tj	|dd��ddd�y#1swYyxYw)NrsTr�rar�s  r�test_multiple_timesz'ChannelReleaseTests.test_multiple_timessr���o�o����
�
�c�7�#��
�
�c������4�d��3�
�
�
�x�:�:�
;����S�t�$��7�<�
;�
;�s�7B�B"c�F�tj�}tj|d�tj|d�tj|dd��|j	tj
�5tj
|�ddd�y#1swYyxYw)Nrsr;Tr�)r7r)rFr�r�r8rGr�s  r�test_with_unused_itemsz*ChannelReleaseTests.test_with_unused_itemssk���o�o����
�
�c�7�#��
�
�c�6�"�����4�d��3�
�
�
�x�:�:�
;��M�M�#��<�
;�
;�s�8B�B c�|�tj�}tj|�|jtj�5tj|d�ddd�|jtj�5tj
|�ddd�y#1swY�GxYw#1swYyxYwr�)r7r)r�r�r8rFrGr�s  r�test_never_usedz#ChannelReleaseTests.test_never_used's{���o�o��������
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�rQc���tj�}tj|d�tj�}tj|td|�d���tj
|�}tj|�|jtj�5tj|d�ddd�|j|d�y#1swY�xYw)Nrsr�r�r)r7r)rFrrrrGr�r�r8r�)r-rmr%r�s    r�test_by_unassociated_interpz/ChannelReleaseTests.test_by_unassociated_interp0s����o�o����
�
�c�7�#��$�$�&�������4�"�e�$
�0�)�	��m�m�C� �������
�
�
�x�:�:�
;��M�M�#�w�'�<�����g�&�<�
;�s�+C�C&c
�2�tj�}tj�}tj|t	d|�d|�d���|jtj�5tj|�ddd�y#1swYyxYw)NzT
            import _xxinterpchannels as _channels
            obj = _channels.send(z), b'spam')
            _channels.release(r�)r7r)rrrr�r8rGrSs   r�test_close_if_unassociatedz.ChannelReleaseTests.test_close_if_unassociated?s���o�o����$�$�&�������4"�"%��'�"�e�$
�0�)�	��
�
�x�:�:�
;��M�M�#��<�
;�
;�s�.B
�
Bc�*�tj�}tj|d�tj|�tj|d�tj	|d��tj|�}|j|d�y)NrsTr�)r7r)rFrGr�r�)r-rmr�s   r�test_partiallyz"ChannelReleaseTests.test_partiallyLsg���o�o����
�
�c�4� ��
�
�c���
�
�c�7�#�����4��(��m�m�C� ������g�&rc�0�tj�}tj|d�tj|d�tj|d�tj|�tj	|dd��|jtj�5tj|d�ddd�|jtj�5tj|�ddd�y#1swY�GxYw#1swYyxYwr`rar�s  r�'test_used_multiple_times_by_single_userz;ChannelReleaseTests.test_used_multiple_times_by_single_userWs����o�o����
�
�c�7�#��
�
�c�7�#��
�
�c�7�#��
�
�c������4�d��3�
�
�
�x�:�:�
;��M�M�#�w�'�<�
�
�
�x�:�:�
;��M�M�#��<�
;�<�
;��
;�
;�s�#D�!D�D	�DN)
r0r1r2rbrdrfrhrjrlrnrprrrtr9rrr^r^�sC�����"	�1�(	�8���
'��	'�rr^c�t��eZdZdZ�fd�Zed��Zed��Zd�Zd
d�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Z�xZS)�ChannelCloseFixtureFc�j��|jri}netj|�}tj|�}tj|�}|j||j||j|i}|sd}t�|�||||||�}t
�|_t�|_	||_
|S)NrD)�QUICKrr#r,r*r+r��_preppedrW�_state�_known)	r!rAr%rKrL�creator�knownr-r.s	        �rr+zChannelCloseFixture.__new__ls�����9�9��E� �)�)�&�1�F��(�(��/�E��(�(��/�E����V��
�
�E��
�
�E��E�
��G��w��s�C����w�G�����
�"�n�������rc��|jSr�rzras rrnzChannelCloseFixture.state�s���{�{�rc��	|jS#t$r@|j|j�}|j	|�|_|jcYSwxYwr)�_cid�AttributeError�_get_interpreterr|�_new_channel)r-r|s  rrmzChannelCloseFixture.cid�sP��	��9�9����	��+�+�D�L�L�9�G��)�)�'�2�D�I��9�9��	�s��AA�Ac�J�|j|�}|j|�|Sr)r��_prep_interpreter�r-r%s  r�get_interpreterz#ChannelCloseFixture.get_interpreter�s%���&�&�v�.�����v�&��
rc��|�|j}|dk(r|jjdk(ryt|jj�S)NrGrFF)rArnrY�boolrRs  r�expect_closed_errorz'ChannelCloseFixture.expect_closed_error�s@���;��(�(�C��&�=�T�Z�Z�.�.�&�8���D�J�J�%�%�&�&rc�&�|j|�yr)r�r�s  r�prep_interpreterz$ChannelCloseFixture.prep_interpreter�s�����v�&rc��||_yrr)r-r@rps   r�
record_actionz!ChannelCloseFixture.record_action�s	����rc�,�t�t�yr)rr|ras r�clean_upzChannelCloseFixture.clean_up�s�����rc���|jdk(rtj�Stj�}t|jd|�d��tj|�|_|jS)Nrz�
                import _xxsubinterpreters
                cid = _xxsubchannels.create()
                # We purposefully send back an int to avoid tying the
                # channel to the other interpreter.
                _xxsubchannels.send(zC, int(cid))
                del _xxsubinterpreters
                )r,r7r)rr
rGr�)r-r|�chs   rr�z ChannelCloseFixture._new_channel�sg���<�<�6�!��?�?�$�$����"�B��w�z�z�(%�
&(�D�)�$�
�!�
�
�b�)�D�I��y�y�rc���|dvr|jS|dk(r|jS|dk(r|jS|}	|j|}|S#t$rt|�x}|j|<Y|SwxYw)N)rDr%rKrL)r%rKrLr{�KeyErrorr)r-r%r,s   rr�z$ChannelCloseFixture._get_interpreter�s����'�'��;�;��
�w�
��:�:��
�w�
��:�:���D�
?����T�*���M���
?�-8��->�>�����T�*��M�
?�s�A�#A.�-A.c���|j|jvry|jj|j�|jdk(ryt	|jd|j
�d��y)Nra

            import _xxinterpchannels as channels
            import test.test__xxinterpchannels as helpers
            ChannelState = helpers.ChannelState
            try:
                cid
            except NameError:
                cid = channels._channel_id(r�)r
ry�addr,rrmr�s  rr�z%ChannelCloseFixture._prep_interpreter�sb���9�9��
�
�%���
�
���&�)�)�$��;�;�&� ���6�9�9�#,�-1�H�H�:�6
��	rr)r0r1r2rxr+�propertyrnrmr�r�r�r�r�r�r�r�r4r5s@rrvrves_���

�E��*���������
'�'���� 
�rrvzend interp other extra creatorz%these tests take several hours to runc�p�eZdZ			d�Zd�Zd�Zd�Zd�Zdd�d�Zd	�Z	d
�Z
dd�Zd
�Zdd�Z
d�Zd�Zd�Zy)�ExhaustiveChannelTestsc#�<K�g��|jdd�D]"}|��|j�D]	}||z����$|jdd�D]"}|��|j�D]	}||z����$|jdd�D]~}|��|jdd�D]'}||z}|��|j�D]	}||z����)|jdd�D]'}||z}|��|j�D]	}||z����)��|jdd�D]~}|��|jdd�D]'}||z}|��|j�D]	}||z����)|jdd�D]'}||z}|��|j�D]	}||z����)��y�w)NrDrKrL)�_iter_close_action_sets�_iter_post_close_action_sets�_iter_use_action_sets)r-�closeactions�postactions�
useactions�actionss     r�iter_action_setsz'ExhaustiveChannelTests.iter_action_setss�������!�8�8���I�L���#�@�@�B��"�[�0�0� C�J�!�8�8��'�J�L���#�@�@�B��"�[�0�0� C�K��4�4�V�W�E�J��� $� <� <�V�W� M��$�|�3���
�#'�#D�#D�#F�K�!�K�/�/�$G�!N�
!%� <� <�W�g� N��$�|�3���
�#'�#D�#D�#F�K�!�K�/�/�$G�!O�F��4�4�W�g�F�J��� $� <� <�V�W� M��$�|�3���
�#'�#D�#D�#F�K�!�K�/�/�$G�!N�
!%� <� <�W�g� N��$�|�3���
�#'�#D�#D�#F�K�!�K�/�/�$G�!O�G�s�FFc#�K�||f}tdd|�g��tdd|�g��tdd|�tdd|�g��tdd|�g��tdd|�g��tdd|�tdd|�g��|D]8}|D]1}|D]*}tdd|�tdd|�tdd|�g���,�3�:|D]K}|D]D}|D]=}|D]6}tdd|�tdd|�tdd|�tdd|�g���8�?�F�My�w)NrCrGrF�r<)r-r�r��interpsr��interp4s      rr�z,ExhaustiveChannelTests._iter_use_action_sets.sj�����G�$��
�%���1��	�
�%���1��	�
�%���1��%���1��	�
�%���1��	�
�%���1��	�
�%���1��%���1��	��G�"��&�G�%�e�V�W�=�%�e�V�W�=�%�e�V�W�=��� '�#���G�"��&�G�#*��)�%���A�)�%���A�)�%���A�)�%���A�	��$+� '�#��s�DD
c
#��K�d}||f}dD]&}|rdnd}|D]}|D]}t|||�g�����(dD]3}	dD],}
|D]%}|D]}t|	d|�t|
d|�g��� �'�.�5y�w)Nrtr7rJrIrHrGrFr�)
r-r�r��endsr�rg�opr%rA�recvop�sendoprGrFs
             rr�z.ExhaustiveChannelTests._iter_close_action_sets_s��������G�$��"�E�"'��W�B�!���C�%�b�#�v�6��� �"�#�/�F�2��#�D� '��)�&�&�$�?�)�&�&�$�?���!(�$�3�/�s�A+A-c#�ZK�dD]"}tdd|�g��tdd|�g���$y�w)N)rDrLrKrCrGrFr�r�s  rr�z3ExhaustiveChannelTests._iter_post_close_action_setsrs>����0�F��e�V�V�4��
��e�V�V�4��
�	1�s�)+c�6�|D]}|j||��yr)rq)r-�fixr�r@s    r�run_actionsz"ExhaustiveChannelTests.run_actions{s���F��O�O�C��(�rTric��|j|j�}|j|j|j|j
�}|j
|�|jdk(rAt|j|j||j|��}|j||�ytj�}t|j d|j�dt#|j��dt#|��dt#|j��d|�d|�d|�d��t%t&j)tj+|�d	�t-tj+|���
�}|j||�y)NrrizB
                result = helpers.run_action(
                    z,
                    z!,
                    hideclosed=z6,
                    )
                channels.send(zF, result.pending.to_bytes(1, 'little'))
                channels.send(z2, b'X' if result.closed else b'')
                �little)r[rY)rSrArUr%rKrLr�r,rqrmr@rnr�r7r)rr
r�rWr��
from_bytesrGr�)r-r�r@rjrAr%rpr�s        rrqz!ExhaustiveChannelTests.run_actionsR��� � ����)���&�&�s�z�z�3�9�9�c�i�i�H�����V�$��;�;�&� ������
�
���	�	�%��F�
���f�f�-��?�?�$�D��v�y�y�'��W�W�I���&�-�-�(�)�*��#�Y�K� ��#�)�)�_�%�& � *�|�,�#�f�%�#�f�%�
#�

�"����x�}�}�T�':�H�E��H�M�M�$�/�0��F�
���f�f�-rc
#�hK�gd�}|D]%\}}}dD]}dD]}t|||||������'y�w)N))rr%rL)r%rrL)r�r�rL)r�r�r)rDrKr|r�)rv)r-rr%rKrLr|rAs       r�
iter_fixturesz$ExhaustiveChannelTests.iter_fixtures�sG����
��%1� �F�E�5�7��+�C�-�c�6�5�%��Q�Q�,�8�%1�s�02c��|rdnd}t||jd�}|j�s|j||d��y|j	t
j�5|j||d��ddd�y#1swYyxYw)NrJrIrDFri)r<rAr�rqr�r7r8)r-r�rgr�rIs     r�_closezExhaustiveChannelTests._close�sn��#�]����b�#�'�'�6�2���&�&�(��O�O�C��5�O�9��"�"�8�#>�#>�?�����U�u��=�@�?�?�s�"B�B	Nc�|�|�|jdk(�r |jtj�5tj	|j
�ddd�|jtj�5tj
|j
d�ddd�|jtj�5tj|j
�ddd�|jtj�5tj|j
d��ddd�yt|jd�t|jd�t|jd�t|jd�y#1swY��<xYw#1swY��xYw#1swY��xYw#1swYyxYw)	NrrsTrfzn
                with helpers.expect_channel_closed():
                    channels.recv(cid)
                zw
                with helpers.expect_channel_closed():
                    channels.send(cid, b'spam')
                zo
                with helpers.expect_channel_closed():
                    channels.close(cid)
                z{
                with helpers.expect_channel_closed():
                    channels.close(cid, force=True)
                )
r,r�r7r8rGrmrFrIrr
)r-r�r%s   r�_assert_closed_in_interpz/ExhaustiveChannelTests._assert_closed_in_interp�s6���>�V�[�[�F�2��"�"�8�#>�#>�?��
�
�c�g�g�&�@��"�"�8�#>�#>�?��
�
�c�g�g�w�/�@��"�"�8�#>�#>�?����s�w�w�'�@��"�"�8�#>�#>�?����s�w�w�d��3�@�?�
�v�y�y�#�
�
�v�y�y�#�
�
�v�y�y�#�
�
�v�y�y�#�
�+@�?��?�?��?�?��?�?�s/� F�9!F� F&�"F2�F�F#�&F/�2F;c��|j|jj�t|jj�D]!}t
j
|j��#|j|�dD]5}|j|�}|jdk(r�$|j||��7|jd�}|j||�y)N)rDrKr�fresh)r�rnrY�ranger[r7rGrmr�r�r,)r-r��_r%s    r�_assert_closedz%ExhaustiveChannelTests._assert_closed�s�������	�	�(�(�)��s�y�y�(�(�)�A��M�M�#�'�'�"�*��%�%�c�*�'�F��(�(��0�F��{�{�f�$���)�)�#�v�6�	(��$�$�W�-���%�%�c�6�2rc#��K�d}|j�D]�}t�|j�D]�}|dz
}|dkDry|r;|dz
dzdk(r
t�t||djt	|���nC|dz
dzdk(r
tdd��td	d��t
jj�|||f����|s��td
���t�y�w)Nrr^r��z({} actions)� �rQ�.z---)r��printr�r'r��sys�stdout�flush)r-�verbose�ir�r�s     r�_iter_close_testsz(ExhaustiveChannelTests._iter_close_tests�s�����
���,�,�.�G��G��)�)�+���Q����t�8����A���{�a�'����!�S�.�"7�"7��G��"E�F��A���{�a�'��c�r�*��#�2�&��
�
�(8�(8�(:���g�o�%�,���e��!/�"	��s�CC&�C&c�L�dt_|j�D]\}}}�y)NT)rvrxr��r-r�r�r�s    r�_skim_close_testsz(ExhaustiveChannelTests._skim_close_tests�s'��$(��!�#�5�5�7�O�A�s�G�� 8rc�f�|j�D]�\}}}|jdj|||��5|j|j�|j||�|j
|d��|j|�ddd�|j���y#1swY�xYw)N�	{} {}  {}Frf�	r�rr'r�r%r�r�r�r�r�s    r�
test_closez!ExhaustiveChannelTests.test_close�s���#�5�5�7�O�A�s�G����k�0�0��C��A�B��$�$�S�Z�Z�0�� � ��g�.����C�u��-��#�#�C�(�
C�
�L�L�N� 8�B�B���AB'�'B0	c�f�|j�D]�\}}}|jdj|||��5|j|j�|j||�|j
|d��|j|�ddd�|j���y#1swY�xYw)Nr�Trfr�r�s    r�test_force_closez'ExhaustiveChannelTests.test_force_closes���#�5�5�7�O�A�s�G����k�0�0��C��A�B��$�$�S�Z�Z�0�� � ��g�.����C�t��,��#�#�C�(�
C�
�L�L�N� 8�B�B�r�r)F)r0r1r2r�r�r�r�r�rqr�r�r�r�r�r�r�r�r9rrr�r��s`��� �� +0�Z/�b�&�)�59�.�@R�>��83� �,�

�
rr��__main__)%�collectionsr�
contextlibr��textwraprrr�r[�test.supportr�test.test__xxsubinterpretersrrr�
import_moduler7rrr�contextmanagerr:r<rWrqrlr|�TestCaser~r�r�r^rvr\r�r0rr9rr�<module>r�sX��"��
�����&���'�=�&�&�':�;�� $�-/�	4�!�*�]�I�6�!�L���+��+�/#�J��0C�D�/#�fE�:�n�.>�?�E�&7;��*!!�H� �x� � � �`,�X�`,�Je	,�8�e	,�Pb�(�b�Jn�*�%:�%E�G�n�b����6�7�{�X�{�8�{�|	�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists