AlkantarClanX12

Your IP : 3.144.255.116


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/guppy/sets/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/guppy/sets/__pycache__/test.cpython-311.pyc

�

�܋f�����ddlTddlZddlmZddlZddlZddlZ	ddlZ	dZ
n
#e$rdZ
YnwxYwe
rd�Znd�Ze
��ZeZeZe
ZeZeZd�Zd�Zd	�Zd'd
�Zd�Zd�Zd
�Zd�Zd�Zd�Z d�Z!d(d�Z"	Gd�de��Z#	d�Z$d)d�Z%d�Z&d�Z'd�Z(d�Z)	d�Z*d�Z+	Gd�d ��Z,Gd!�d"��Z-d'd#�Z.d$�Z/d%�Z0e,��Z1e2d&kre0��dSdS)*�)�*N)�process_time�c
��ttttj�|||g������S�N)�list�map�int�numpy�random�random_integers��low�high�lengths   �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/guppy/sets/test.py�random_integers_listrs0���C��U�\�9�9�#�t�f�X�N�N�O�O�P�P�P�c�>�����fd�t|��D��S)Nc�:��g|]}tj������S�)r�randint)�.0�irrs  ��r�
<listcomp>z(random_integers_list.<locals>.<listcomp>s%���A�A�A�a���s�D�)�)�A�A�Ar)�rangers`` rrrs'����A�A�A�A�A�5��=�=�A�A�A�Arc�>�|||zz|ksJ�|||zz|ksJ�dSrr��a�bs  r�
absorptionr!#s:����A��;�!�������A��;�!������rc�V�||z|z|||zzksJ�||z|z|||zzksJ�dSrr�rr �cs   r�associativer%(sJ��
��E�Q�;�!�q�1�u�+�%�%�%�%�
��E�Q�;�!�q�1�u�+�%�%�%�%�%�%rc�>�||z||zksJ�||z||zksJ�dSrrrs  r�commutativer'-s0���q�5�A��E�>�>�>�>��q�5�A��E�>�>�>�>�>�>rc��|�$||z||zksJ�||z||zksJ�dS|||zz
||z
||z
zksJ�|||zz
||z
||z
zksJ�dSrrr#s   r�deMorganr)2s����y��Q��x�A�2���7�"�"�"�"��Q��x�A�2���7�"�"�"�"�"�"��A��E�{�q�1�u��Q��/�/�/�/�/��A��E�{�q�1�u��Q��/�/�/�/�/�/�/rc�2�||z|ksJ�||z|ksJ�dSrr)rs r�idempotencer+;s(���q�5�A�:�:�:�:��q�5�A�:�:�:�:�:�:rc�^�||z|ksJ�||z|ksJ�||z|ksJ�||z|ksJ�dSrrrs  r�	inclusionr-@sJ���q�5�A�:�:�:�:��q�5�A�:�:�:�:��q�5�A�:�:�:�:��q�5�A�:�:�:�:�:�:rc��|||zz||z||zzksJ�|||zz||z||zzksJ�||z||zz||zz||z||zz||zzksJ�||z||zkr||z||zkr
||ksJ�dSdSdSrrr#s   r�distributiver/Gs�����A��;�1�q�5�Q��U�+�+�+�+�+���A��;�1�q�5�Q��U�+�+�+�+�+�
��E�a�!�e���A��&�1�q�5�Q��U�*;�q�1�u�*E�E�E�E�E��A���Q����1�q�5�A��E�>�>�q�A�v�v�v�>���>�>�v�vrc��|D]~}t|��|D]j}t||��t||��t||��|D]5}t	|||��t|||��t
|||���6�k�dSr)r+r-r'r!r%r/r))�as_�bs�csrr r$s      r�test_set_operationsr4Ns���
�	"�	"���A�����	"�	"�A��a��O�O�O���1�����q�!�����
"�
"���A�q�!�$�$�$��Q��1�%�%�%���A�q�!�!�!�!�
"�		"�	"�	"rc��d�}|D]�}|D]�}|t|��t|��k||k��|||k||ko||k��|||k||ko||ks||ko||k��|||k||ko||ko
||ko||k��|||k||ko||k��|||k||ko||k��|||k||ko||ks||ko||k������dS)Nc��|r|sJ�dSdSrrrs  r�impztest_set_sub.<locals>.imp\s�������z����r)�len)r1r2r7rr s     r�test_set_subr9[s������
�D�D���	D�	D�A��C��A���#�a�&�&� �!�q�&�)�)�)��C��A��q�1�u�,�a�!�e�)�-�-�-��C��Q���Q��B�A��E�O�Q�!�V�B�Q��U��C�C�C��C��Q���Q��G�1��6�G�!�q�&�j�G��a��Z�H�H�H��C��Q��A��F�
�1�1��6�z�2�2�2��C��A��q�1�u�*�Q��U��+�+�+��C��Q���Q��B�A��E�O�Q�!�V�B�Q��U��C�C�C�C�	D�D�Drc	��|D�]U}t|��tt|����ksJ�t||z��t|��ksJ�t||z��t|��ksJ�|D]�}t||z��tt||z����ksJ�t||z��tt||z����ksJ�t||z
��tt||z
����ksJ�t||z��tt||z����ksJ��א�WdSr)r8r�r1r2rr s    r�test_set_lenr<isM��
�2�2���1�v�v��T�!�W�W���%�%�%�%��1�q�5�z�z�S��V�V�#�#�#�#��1�q�5�z�z�S��V�V�#�#�#�#��	2�	2�A��q�1�u�:�:��T�!�a�%�[�[�!1�!1�1�1�1�1��q�1�u�:�:��T�!�a�%�[�[�!1�!1�1�1�1�1��q�1�u�:�:��T�!�a�%�[�[�!1�!1�1�1�1�1��q�1�u�:�:��T�!�a�%�[�[�!1�!1�1�1�1�1�1�	2�	2�2rc���|D]s}|D]n}|t|��z||zksJ�|t|��z
||z
ksJ�|t|��z||zksJ�|t|��z||zksJ��o�tdSr)r�tupler;s    r�test_set_convertr?ys���
�)�)���	)�	)�A��t�A�w�w�;�!�a�%�'�'�'�'��u�Q�x�x�<�1�q�5�(�(�(�(��t�A�w�w�;�!�a�%�'�'�'�'��u�Q�x�x�<�1�q�5�(�(�(�(�(�
	)�)�)rrc��tt|����}t��}|D]}||�}�t��}||z
}	|r|	|fS|	Sr)rr�clock)
�f�args�N�retx�r�	starttimer�x�endtime�elapseds
          r�eltimerK�sb���U�1�X�X���A����I�
����
�A�t�H����g�g�G��	�!�G�����z���rc� �eZdZd�Zd�Zd�ZdS)�IdSetc�\�t�|t|��dz��dS�N�)�bitsmut�append�id��selfrHs  rrRzIdSet.append��&�����t�R��U�U�b�[�)�)�)�)�)rc�\�t�|t|��dz��dSrO)rQ�removerSrTs  rrXzIdSet.remove�rVrc�X�t�|t|��dz��SrO)rQ�__contains__rSrTs  rrZzIdSet.__contains__�s"���#�#�D�"�Q�%�%�2�+�6�6�6rN)�__name__�
__module__�__qualname__rRrXrZrrrrMrM�sA������*�*�*�*�*�*�7�7�7�7�7rrMc�L�|}|r||z||zdz}}t||��|�|S�Nr)�printr#s   r�addra�sB��	�A�
���1�u�q�1�u��l�1��
�a�������
�Hr�@c�H�ttj||����Sr)r
r�	randrange)�lims rrr�s���v����c�*�*�+�+�+rc���t��}t��}t��dz}t��}t��}t��dz}||z|z||z|zz}|S)N�)r)rr �ashr$�d�bshrFs       r�randlongrk�s_���	�	�A��	�	�A�
�)�)�c�/�C��	�	�A��	�	�A�
�)�)�c�/�C�	
�Q��#��!�a�%�3�,�'�A��Hrc�&�i}|D]}||vrd||<�|Sr_r)�l�ds�es   r�dictsetrp�s.��	�B�
�����B�;�;��B�q�E��
�Irc��t|��}t|�����}|���|Sr)rpr�keys�sort)rmrn�kss   r�dslistru�s2��	����B�	
�b�g�g�i�i���B��G�G�I�I�I�
�Irc��i}g}td��D]2}	td��}||vr|�|��d||<n�/�3|S)z? randlist(n, amp) -> list of n unique random ints in [-amp,amp]�'r�P�)rrrR)�n�amprn�rngrr s      r�randlistr|�sd��	�B�
�C�
�5�\�\����	�����A���{�{��
�
�1�
�
�
���1���	�
��Jrc�4�|j}|D]
}||���dSr�rR�rr �ap�bits    r�t_appendr��s1��	
��B�����
��3������rc�T�|j}|D]}|t|��dz���dSrO)rRrSrs    r�t_append_idr��s?��	
��B�����
��2�c�7�7�b�=������rc���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd'd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&S)(�Testrc��dSrr�rUs r�test0z
Test.test0�s���rc	�(�ddl}|���}tgd���gztgd���gztgd���dgztgd���tt	d����ztgd���tt	ddd����zt��tg��td��td��td��tt����f}t||���|D]
}|tusJ��td��td	��ttd
��|���ttd��|���ttd
��|���ttdg��td
��z|���tttdg����|���tttdg����|���td�����}|}|dz}tt|��|���|dz}tt|��|���|d
dgz}tt|��|���|dz}tt|��|���|tdg��z}tt|��||���|tdg��z}t|��}t||���||z}t||���|dz}t||���||z}|dz}tt|��|���||z}|d
dgz}tt|��|���||z}|dz}tt|��|���||z}|tdg��z}t||���||z}|tdg��z}t|d|tdg��z|���|dz}t||���|dz}tt|��|���|d
dgz}tt|��|���|dz}tt|��|���|tdg��z}t||���|dz}||z}||z}t|d||z||ztg��|z|���t|��}|dz}t||dzt|��t|��|���||z}t||���||z}t|t|��t|��|���|dz}t|t|��|���|dz}t|t|��|���|dz}t|t|��|���|dz}t|t|��|���|dz}t|t|��|���|dz}t|t|��|���|td��z}t|t|��|���|td��z}t|t|��|���||usJ�ttd��|���ttdg��|���ttdg��tdg��z|���|�	��dksJ�dS)Nr)r����d���r��filerbl��)r�rr�i@r�)����%r�zts&.�mt������a�(ImmBitSet([]), ImmBitSet([]), ImmBitSet([]), ImmBitSet([]), ImmBitSet([]), ImmBitSet([]))
ImmBitSet([15])
ImmBitSet([4])
(~ImmBitSet([15]))
ImmBitSet([0, 1])
2
2
[0]
[0, 14]
[0, 3, 4, 14]
[0, 3, 4, 6, 8, 14]
[0, 3, 4, 6, 7, 8, 14] MutBitSet([0, 3, 4, 6, 7, 8, 14])
ImmBitSet([0, 3, 4, 6, 7, 8, 14, 37])
MutBitSet([0, 3, 4, 6, 7, 8, 14, 37])
MutBitSet([0])
[14]
[3, 4]
[6, 8]
MutBitSet([7])
MutBitSet([0, 3, 4, 7, 8, 14, 37]) ts&. ImmBitSet([0, 3, 4, 7, 8, 14, 37])
MutBitSet([3, 4, 7, 8, 14, 37])
[3, 4, 7, 8, 37]
[7, 8, 37]
[6, 7, 37]
MutBitSet([6, 37])
MutBitSet(~ImmBitSet([])) mt (~ImmBitSet([])) (~ImmBitSet([])) (~ImmBitSet([]))
MutBitSet(~ImmBitSet([])) (~ImmBitSet([])) -1 -1
MutBitSet([])
MutBitSet([]) 0 0
MutBitSet(~ImmBitSet([])) -1
MutBitSet(~ImmBitSet([0])) -2
MutBitSet([1]) 2
MutBitSet(~ImmBitSet([])) -1
MutBitSet(~ImmBitSet([0])) -2
MutBitSet([1]) 2
MutBitSet(~ImmBitSet([])) -1
MutBitSet(~ImmBitSet([0])) -2
(~ImmBitSet([]))
ImmBitSet([-1])
ImmBitSet([-1, 4])
)
�io�StringIO�bitsetrrr`�Emptyr
�mutcopy�getvalue)	rUr�rB�emptiesro�ms�msa�ts�xss	         r�test1z
Test.test1�sy���	�	�	��K�K�M�M���y�y�y���B����y�y�y���B���	�y�y�y���Q�C����y�y�y���D��s���,�,�,�,��y�y�y���D��s�B��!3�!3�4�4�4�4�
�H�H��2�J�J��2�J�J��1�I�I��1�I�I��6�8�8���

��	�g�A������	�	�A���:�:�:�:�:��y�����y����
�f�V�n�n�1�%�%�%�%�
�f�T�l�l��#�#�#�#�
�v�f�~�~�o�A�&�&�&�&�
�f�a�S�k�k�F�1�I�I�%�A�.�.�.�.�
�c�&�!��+�+���Q�'�'�'�'�
�c�&�!��+�+���Q�'�'�'�'�
�A�Y�Y�
�
�
 �
 ����
�a���
�d�2�h�h�Q�����
�f���
�d�2�h�h�Q�����
�q�!�f���
�d�2�h�h�Q�����
�f���
�d�2�h�h�Q�����
�f�a�S�k�k���
�d�2�h�h���#�#�#�#�
�f�b�T�l�l���
�B�Z�Z��
�b�q�����
�b���
�b�q�����
�a���
�b�q�����
�b���
�f���
�d�2�h�h�Q�����
�b���
�q�!�f���
�d�2�h�h�Q�����
�b���
�f���
�d�2�h�h�Q�����
�b���
�f�a�S�k�k���
�b�q�����
�b���
�v�q�c�{�{�l���
�b�&�"���s���|�+�!�4�4�4�4�
�a���
�b�q�����
�f���
�d�2�h�h�Q�����
�q�!�f���
�d�2�h�h�Q�����
�f���
�d�2�h�h�Q�����
�f�a�S�k�k���
�b�q�����
�a���
�b���
�r�c�	��
�b�$��r�T�	�2���8�f�R�j�j�[�B�3�->�Q�G�G�G�G�
�B�Z�Z��
�a���
�b�"�q�&�#�b�'�'�3�r�7�7��3�3�3�3�
�b���
�b�q�����
�r�c�	��
�b�#�b�'�'�3�r�7�7��+�+�+�+�
�b���
�b�#�b�'�'��"�"�"�"�
�b���
�b�#�b�'�'��"�"�"�"�
�b���
�b�#�b�'�'��"�"�"�"�
�b���
�b�#�b�'�'��"�"�"�"�
�b���
�b�#�b�'�'��"�"�"�"�
�b���
�b�#�b�'�'��"�"�"�"�
�f�R�j�j���
�b�#�b�'�'��"�"�"�"�
�f�R�j�j���
�b�#�b�'�'��"�"�"�"��S�y�y�y�y�
�f�R�j�j�q�!�!�!�!�
�f�b�T�l�l��#�#�#�#�
�f�b�T�l�l�V�Q�C�[�[�(�q�1�1�1�1��z�z�|�|�) �)�)�)�)�)�)rc��d�td��D��D�]�}d�td��D��D�]�}g}|t|��t|��fD�]j}|t|��t|��fD�]F}g}|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�||z��|�|����H��l|dd�D]3}t	||d��D]\}}t|��|ksJ���4��А��dS)Nc�*�g|]}t����Sr�rk)rrs  rrzTest.test2.<locals>.<listcomp>�s��0�0�0��(�*�*�0�0�0r�
c�*�g|]}t����Srr�)r�js  rrzTest.test2.<locals>.<listcomp>�s��4�4�4�Q�h�j�j�4�4�4rrr)rr�rQrR�zipr
)	rUrr r��ta�tb�trrFrHs	         r�test2z
Test.test2�s2��0�0�e�B�i�i�0�0�0�	+�	+�A�4�4�%��)�)�4�4�4�
+�
+�����f�Q�i�i�����4�&�&�B� �&��)�)�W�Q�Z�Z�8�&�&�����	�	�"�r�'�*�*�*��	�	�"�r�'�*�*�*��	�	�"�r�'�*�*�*��	�	�"��s�(�+�+�+��	�	�"��s�(�+�+�+��	�	�"��s�(�+�+�+��	�	�2�#��(�+�+�+��	�	�2�#��(�+�+�+��	�	�2�#��(�+�+�+��	�	�2�#���)�,�,�,��	�	�2�#���)�,�,�,��	�	�2�#���)�,�,�,��	�	�"�
�
�
�
�#&�&�Q�R�R�&�+�+�B� #�B��1����+�+���1�"�1�v�v��{�{�{�{�{�+�+�-
+�	+�	+rc��t��}t��}t��}t��}g}|t|��t|��fD�]o}|t|��t|��fD�]K}|dzr||z}n|dzr||z}n
|dzr||z}|t|��t|��fD�]}g}	||z}|	�t|����||z}|	�t|����||z}|	�t|����||z}|	�t|����||z}|	�t|����||z}|	�t|����|�|	����	��M��q|dd�D]3}	t
|	|d��D]\}
}t|
��|ksJ���4dS)Nr�r�r)rkrr�rQrRr
r�)rU�p�oprr r��tpr�r�r�rFrHs            r�test3z
Test.test3�s���J�J��
�Y�Y���J�J���J�J��
���f�Q�i�i�����,�	"�	"�B��&��)�)�W�Q�Z�Z�0�
"�
"����6���"�H�B�B��!�V���"�H�B�B��!�V���"�H�B��f�Q�i�i�����4�"�"�B��B��"�H�B��I�I�c�"�g�g�&�&�&��"�H�B��I�I�c�"�g�g�&�&�&��"�H�B��I�I�c�"�g�g�&�&�&��2�#�I�B��I�I�c�"�g�g�&�&�&��2�#�I�B��I�I�c�"�g�g�&�&�&��2�#�I�B��I�I�c�"�g�g�&�&�&��I�I�b�M�M�M�M�"�
"�0�Q�R�R�&�	#�	#�B��B��1����
#�
#���1��1�v�v��{�{�{�{�{�
#�	#�	#rc�$�d�}d}tdddd|jdzzz��D]�}d|z}t|t|d||f��t|dt	|��|f��t|dt	|��t	|��f��t|dt|��|f��t|dt|��t|��f��t|dt|��t	|��f������dS)Nc�^�|dkr&||z}||z}||z}||z}||z}|dz}|dk�$dSdS�Nrrr)ryrH�ys   r�f1zTest.test4.<locals>.f1�sT���a�%�%��Q����Q����Q����Q����Q����Q���
�a�%�%�%�%�%�%rrr�ir���)r�fasterr`rKr�rQ)rUr�rH�expr�s     r�test4z
Test.test4�s��	�	�	�
����G�U�A�d�k�"�n�,<�%=�>�>�	=�	=�C��S��A��#�v�b�4��A�,�/�/���d�F�1�I�I�q�1�2�2���d�F�1�I�I�v�a�y�y�9�:�:���d�G�A�J�J��2�3�3���d�G�A�J�J���
�
�;�<�<���d�G�A�J�J��q�	�	�:�;�;�
=�
=�
=�
=�	=�	=rc��i}td��D]q}t��}d||<d||t��dzz<d||t��dzz<d||t��dzz
<d||t��dzz
<�rt|��}t|��}|���d�}|t	|��||��g}|D�]u}tt|����|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�tt��}||z}t|��|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�tt��}||z}t|��|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�t}||z}t|��|ksJ�tt��}||z}t|��|ksJ�t}||z}|}t|��|ksJ�t}||z}|}t|��|ksJ�t}||z}|}t|��|ksJ�tt��}||z}|}t|��|ksJ���wdS)N�2r�c�4�td�|D����S)Nc��g|]}|df��S�rr)rr�s  rrz/Test.test5.<locals>.dictset.<locals>.<listcomp>�s��2�2�2�c�#�q��2�2�2r)�dict)�bitss rrpzTest.test5.<locals>.dictset�s���2�2�T�2�2�2�3�3�3r)	rrrrsr>r�r�rQ�Omega)	rUr�rr��sbitsrp�seqs�seqr2s	         r�test5z
Test.test5�s������r���	)�	)�A��)�)�C��D��I�'(�D��W�Y�Y��^�#�$�'(�D��W�Y�Y��^�#�$�'(�D��W�Y�Y��^�#�$�'(�D��W�Y�Y��^�#�$�$��D�z�z���T�
�
��
�
�
����	4�	4�	4��e�D�k�k�7�7�4�=�=�1���9	%�9	%�C���s���$�$��-�-�-�-��B��c��B���8�8�u�$�$�$�$��B��r��B���8�8�u�$�$�$�$��B��#�I�B���8�8�u�$�$�$�$�����B��#�I�B���8�8�u�$�$�$�$��B��c��B���8�8�u�$�$�$�$��B��r��B���8�8�u�$�$�$�$��B��#�I�B���8�8�u�$�$�$�$�����B��#�I�B���8�8�u�$�$�$�$��B��c��B���8�8�u�$�$�$�$��B��r��B���8�8�u�$�$�$�$��B��#�I�B���8�8�u�$�$�$�$�����B��#�I�B���8�8�u�$�$�$�$��B��c��B���B���8�8�u�$�$�$�$��B��r��B���B���8�8�u�$�$�$�$��B��#�I�B���B���8�8�u�$�$�$�$�����B��#�I�B���B���8�8�u�$�$�$�$�$�s9	%�9	%rc��t��fD�]v}||t��fD�]_}t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ�t|��t|��k||kksJ���a��xdSr)rkr�rQ)rUrr s   r�test6z
Test.test6<sy���*�*��	?�	?�A��!��X�Z�Z�(�
?�
?������f�Q�i�i�/�Q�!�V�<�<�<�<�����f�Q�i�i�/�Q�!�V�<�<�<�<�����v�a�y�y�j�0�a�A�2�g�>�>�>�>�����v�a�y�y�j�0�a�A�2�g�>�>�>�>� ��)�)��v�a�y�y�0�q�b�A�g�>�>�>�>� ��)�)��v�a�y�y�0�q�b�A�g�>�>�>�>� ��)�)���q�	�	�z�1��r�a�R�x�@�@�@�@� ��)�)���q�	�	�z�1��r�a�R�x�@�@�@�@� ����w�q�z�z�1�q�A�v�>�>�>�>� ����w�q�z�z�1�q�A�v�>�>�>�>� ����v�a�y�y�0�a�1�f�=�=�=�=� ����v�a�y�y�0�a�1�f�=�=�=�=�����g�a�j�j�0�a�1�f�=�=�=�=�����g�a�j�j�0�a�1�f�=�=�=�=�=�#
?�	?�	?rc���
����ddl}|����
td��}tt	|���
���|�d��tt	|��|���t	|���
���|�d��tt	|��|�d��t	|���
���|�d��tt	|��|�d��t	|���
���|�d��|�d��|�d��tt	|��|���t	|���
���tt	|��|�d��t	|���
���|�d��tt	|���
���t�
������
���dksJ�d��
d	��d
��d���
fd�}d�fd
�	}d�fd�	}�fd�}�fd�}�
fd�}�fd�}	d�fd�	}
d|j	dzz}ttdd|����ttdd|����ttddd|z����tdd|j	dzz
��fD]x}t||��|	|��||��||���||��||��|
|��||d��||d��|
|d���
�
�yttd����}t||��||����dS)Nrr�rr�r�r�z�MutBitSet([])
MutBitSet([1]) 1 MutBitSet([])
MutBitSet([1]) 1 MutBitSet([])
MutBitSet([1]) 1 MutBitSet([])
MutBitSet([1, 2, 3]) 3 MutBitSet([1, 2])
MutBitSet([1, 2]) 1 MutBitSet([2])
MutBitSet([])
c�4�|j}|D]
}||���dSrr~rs    rrBzTest.test7.<locals>.frs1����B��
�
����3�����
�
rc�&�d}|D]}||vr|dz
}�|Sr�r)rr �sr�s    r�fluzTest.test7.<locals>.fluws.���A��
�
���!�8�8���F�A���Hrc��|D]}d||<�dSr_r�rr r�s   r�gzTest.test7.<locals>.g~s&���
�
����#���
�
rc�4�|D]}|t|��z}�dSr��	bitsingler�s   r�hzTest.test7.<locals>.h�s-���
$�
$���Y�s�^�^�#���
$�
$rc��td��}t|||f��}t|��}|���|t	|��ksJ�|S�Nr)rQrKrrsr�)r{rBr��t�srngs     r�tmszTest.test7.<locals>.tms�sT������B��q�2�s�)�$�$�A���9�9�D��I�I�K�K�K������%�%�%�%��Hrc���|�t|��}t|d|���}t�||fd���\}}||ksJ�|S�Nr�rE)r8rQrK�r{ryr��eltr�r�s     �r�tmsluzTest.test7.<locals>.tmslu�sV����y���H�H����R�a�R��!�!�B��C�"�c���3�3�3�F�C����6�6�6�6��Jrc���|�t|��}t|d|���}t�||fd���\}}||ksJ�|Sr�)r8r�rKr�s     �r�tbsluzTest.test7.<locals>.tbslu�sT����y���H�H����B�Q�B����B��C�"�c���3�3�3�F�C����6�6�6�6��Jrc�2��d}d�}t�||f��S)Nrc� �|D]
}|d|zz}�dSr_rr�s   rrBz"Test.test7.<locals>.tlo.<locals>.f�s*��� � �C���a��K�A�A� � r�rK�r{�lorBr�s   �r�tlozTest.test7.<locals>.tlo�s-����B�
 �
 �
 ��!�b�#�Y�'�'�'rc�J��t��}d�}t�||f��S)Nc�4�|D]}|t|��z}�dSrr�r�s   rrBz"Test.test7.<locals>.tbs.<locals>.f�s-���&�&�C���1���%�A�A�&�&r)r�rKr�s   �r�tbszTest.test7.<locals>.tbs�s1������B�
&�
&�
&��!�b�#�Y�'�'�'rc�,��g}t�||f��Srr�)r{�lsrBs  �r�tlszTest.test7.<locals>.tls������B��!�b�#�Y�'�'�'rc�,��i}t�||f��Srr�)r{rnr�s  �r�tdszTest.test7.<locals>.tds�r�rc���|�t|��}td�|d|�D����}t�||fd���\}}||ksJ�|S)Nc��g|]}|df��Sr�r�rrHs  rrz-Test.test7.<locals>.tdslu.<locals>.<listcomp>�s��/�/�/�!��1�v�/�/�/rrr�)r8r�rK)r{ryrnr�r�r�s     �r�tdsluzTest.test7.<locals>.tdslu�se����y���H�H���/�/�s�2�A�2�w�/�/�/�0�0�B��C�"�c���3�3�3�F�C����6�6�6�6��Jrr�rw順rxi@�r�r)
r�r�rQr`�strrR�poprXr�r�rrr|)rUr�rr�r�r�r�r�r�r�r��stepr{rBr�r�r�s             @@@@r�test7z
Test.test7Rs9�������	�	�	��K�K�M�M���A�J�J��
�c�!�f�f�1�����	�������
�c�!�f�f�a�e�e�g�g�s�1�v�v�A�.�.�.�.�	�������
�c�!�f�f�a�e�e�B�i�i��Q���a�0�0�0�0�	�������
�c�!�f�f�a�e�e�A�h�h��A���Q�/�/�/�/�	�������	�������	�������
�c�!�f�f�a�e�e�g�g�s�1�v�v�A�.�.�.�.�
�c�!�f�f�a�e�e�A�h�h��A���Q�/�/�/�/�	�������
�c�!�f�f�1�����
�a�j�j�l�l�����z�z�|�|� �����	�	�	�
	�	�	�	�	�	�	$�	$�	$��	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	�	�	�	�	�	��D�K��M�!����q�%��.�.�/�/���q�&�$�/�/�0�0���u�b�"�T�'�2�2�3�3��U�E�$�+�e�*;�$;�<�<�>�	E�	E�C�
�#�#�c�(�(�C�C��H�H�c�c�#�h�h���C�����%��*�*�e�e�C�j�j�%�%��*�*��%��S�/�/�5�5��c�?�?�E�E�#�s�O�O�
E�
E�
E�
E��5��<�<� � ��
�c�c�#�h�h���C���!�!�!�!�!rc��t}|��|g��|dg��fD]Q}dgif}|D]}|�|���|D]}||vsJ��	|D]}|�|���|D]}||vsJ��	�RdS)Nrr)rMrRrX)rU�BSr2�os�os     r�test8z
Test.test8�s���
���2�4�4���B�����Q�C���)�		#�		#�B��b�"��B��
�
���	�	�!������
�
���B�w�w�w�w�w��
�
���	�	�!������
#�
#����{�{�{�{�{�
#�		#�		#rc�8�dD]�}tt|����}t|��}t|��|ksJ�t|||��}t|��}t	|��}t|��}t|��|ksJ���dS)N)r�rwr�)rrrQrrur�)rUrrF�m�la�lasr2s       r�test9z
Test.test9�s���&�		#�		#�A��U�1�X�X���A���
�
�A���7�7�a�<�<�<�<�%�q�b�!�Q�/�/�B�����A���*�*�C�����B���8�8�s�?�?�?�?�?�		#�		#rc�*�d�}ttd����}td��||��|���td��||��t	ddd��}td��||��dS)Nc	��dD]?}td|z��ttt|d|�f�����@dS)N)r�rwr��zeltime(bitset, (la[:%d],)))r`rKr�)rrs  r�testszTest.test10.<locals>.tests�sT��2�
1�
1���2�Q�6�7�7�7��f�V�b��!��f�Y�/�/�0�0�0�0�
1�
1rr
zla = range(400000)zla.reverse()��z/la=random_integers_list(-400000,400000,400000)))rrr`�reverser)rUrrs   r�test10zTest.test10�s���	1�	1�	1��%��-�-�
 �
 ��
�"�#�#�#�
��b�	�	�	�
�
�
����
�n����
��b�	�	�	�
!�'�6�6�
:�
:��
�?�@�@�@�
��b�	�	�	�	�	rc��tddd��}|dkrDtg��}d|_||z}td||j|j��|dz}|dk�BdSdS)Nrr
rr��test11r)rrQ�_splitting_sizer`�	_indisize�_num_seg)rUryrr�s    rrzTest.test11�sl��
!�'�6�6�
:�
:���!�e�e�����B�!$�B���"�H�B��(�A�r�|�R�[�9�9�9�
��F�A��!�e�e�e�e�e�erc
��dD�]@}t��}tt|����}||z}dD].}t|��D]}|�|���||z}�/|j}dD]�}td|dz|��D]�}g}t|��D]*}|�|�|�����+t|��gksJ�|dkr|���||ksJ�tt|||z����}||z}||jksJ�t|��|ksJ����Ԑ�BdS)N)
� �@��r��!�?�Arg�)r�rrr�r�)rQrrr�rrRr)	rUrDr�r{�popixr��indisizer�popss	         r�test12zTest.test12sz��>�	+�	+�A����B��u�Q�x�x�.�.�C��#�I�B� �
�
���q���"�"�A��F�F�5�M�M�M�M��c�	����|�H� �
+�
+���q�!�B�$��*�*�+�+�A��D�"�1�X�X�3�3�����B�F�F�5�M�M�2�2�2�2���8�8�r�>�>�>�>���{�{��������3�;�;�;�;��u�Q��!��}�}�-�-�C��#�I�B�#�r�|�3�3�3�3���8�8�s�?�?�?�?�?�+�
+�	+�	+rc�V�t��}|rJ�|dz}|sJ�|�d��|sJ�t|��dgksJ�	|�d��td���#t$rYnwxYw|�d��t|��gksJ�	|�d��td���#t$rYnwxYw|�d��	|���td���#t$rYdSwxYw)Nr�rzexpected ValueError for removezexpected ValueError for appendzexpected ValueError for pop)rQrXr�AssertionError�
ValueErrorrRr�)rUr�s  r�test13zTest.test13"sj��
�Y�Y���
�
�v�
�b����	�	�r�
�	�	�!�����	�	�r��R�C�y�y�Q�C�����	C��I�I�a�L�L�L�!�!A�B�B�B���	�	�	��D�	����	�	�	�!�����R�C�y�y�B�����	C��I�I�a�L�L�L�!�!A�B�B�B���	�	�	��D�	����
	�	�	�!����	@��F�F�H�H�H�!�!>�?�?�?���	�	�	��D�D�	���s6�
A1�1
A>�=A>�-C�
C�C�7D�
D(�'D(c
��d}|D]�}tt|����tt|����ksJ�|D]�}tt||����tt||����ksJ�dD]D}tt|||����}tt|||����|ksJ��E����dS)N)����i��������i��i��i����r�rrr�r�rrr�r�)
rr�r�r�r�r�r�r�rr)r�bitranger)rUr�r��hir�rFs      r�test14zTest.test14Es���2���	=�	=�B������%�%��e�B�i�i���8�8�8�8��
=�
=���H�R��,�,�-�-��e�B��m�m�1D�1D�D�D�D�D�=�=�=�D��U�2�r�4�0�0�1�1�A����R�� 6� 6�7�7�1�<�<�<�<�<�=�
=�	=�	=rc���tdd��D]�}t|dz|dz��D]�}tt||����}t||��}|d|ksJ�|d|dz
ksJ�t|��}|d|ksJ�|d|dz
ksJ�d}|rE||}||�|��ksJ�||�|��ksJ�d|z
}|�E�ƌ�dS)Nr*�"r�#rr�)rrr+rQr�)rUrr r{r2r�rrHs        r�test15zTest.test15Qs��
�s�B���	�	�A��1�Q�3��"��%�%�

�

���5��A�;�;�'�'���a��^�^���!�u��z�z�z�z��"�v��1��}�}�}�}��R�[�[���!�u��z�z�z�z��"�v��1��}�}�}�}������1��A�����q�	�	�>�>�>�>������
�
�?�?�?�?��Q��A�	���

�	�	rc	�l�td��D]I}td��D]7}tt|��|z��t|��|zksJ��8�Jtj}|dz
}tdg��}|||fD]}||zt|g��ksJ��d�}|t|g��d��|t|g��d��|t|g��dzd��dD]>\}}dD]6}dD]1}t|||��|zt||z||z|��ksJ��2�7�?dS)	Nrrrc�N�	||ztd���#t$rYdSwxYw)N�expected OverflowError)r%�
OverflowError)r2�shs  r�tsvzTest.test16.<locals>.tsvtsE��
?��b���%�%=�>�>�>��!�
�
�
����
���s��
$�$r�))rr�)rrw)r)r�)	i����i���i���r�rrrgrr�rr�r�)rr
r��sys�maxsizer+)	rUr6�v�maxint�minintr r7rr�s	         r�test16zTest.test16fs�����)�)�	<�	<�B��2�Y�Y�
<�
<���6�!�9�9��?�+�+�s�1�v�v��|�;�;�;�;�;�
<������1����A�3�K�K���F�7�F�+�	+�	+�B���7�f�b�T�l�l�*�*�*�*�*�	?�	?�	?�	��F�F�8���a� � � ���F�F�8���b�!�!�!���F�V�G�9���"�%�r�*�*�*�8�	*�	*�D�A�q�A�
*�
*��%�*�*�D�#�A�q�$�/�/�2�5���"��a��d�D�:*�:*�*�*�*�*�*�*�
*�	*�	*rc
�*�dddttd����ttd����ttd����t��fD�]�}dddttd����ttd����ttd����t��fD�]E}t|��t|��t	|��t	t|����fD]�}||t|��t|��t	|��t	t|����fD]�}||k}|||kksJ�|||z|kksJ�|t|��t|��zt|��kksJ�||k}|||kksJ�|||ko||kksJ�|||kot|��t|��kksJ�������G���dS)Nrrr�r�rr)rrrkr�rQr
)rUrr r1r2r�s      r�test17zTest.test17�s���Q��4��b�	�	�?�?�D��r���O�O�T�%��)�)�_�_�h�j�j�Y�	L�	L�A���A�t�E�"�I�I����U�2�Y�Y����e�B�i�i���RZ�R\�R\�]�
L�
L��"�1�I�I��q�	�	�z�7�1�:�:�w��q�	�	�z�?R�?R�S�
L�
L�C�"�S�D�&��)�)�f�Q�i�i�Z�����W�V\�]^�V_�V_�U_�M`�M`�a�	L�	L���2�I�� �R�3�Y�/�/�/�/� �c�B�h�3�%6�7�7�7�7� �c�#�h�h��R���&8�S��X�X�%E�F�F�F�F��"�H�� �R�#�X����� �c�R�i�%@�c�R�i�A�A�A�A� �c�R�i�%J�c�#�h�h�#�b�'�'�6I�K�K�K�K�K�	L�
L�
L�	L�	Lrc
��ttt������t��zttt������t��zttt������t��zttt������t��zzttt������t��zttt������t��zzg}tt
tdg��tt����tt����gd�|D��z}|d�|D��z}|D�]}t|cxkrt
ksnJ�|tztksJ�|t
zt
ksJ�|t
z|ksJ�|tz|ksJ�||ztksJ�||zt
ksJ�tt
ksJ�t
tksJ�||ksJ�t
|��|D�]?}||z||z
ksJ�t||��t||��t||��t||��|D]$}t|||��t|||���%||k||z|kcxkrB||z|kcxkr4||ztkcxkr ||kcxkr||zt
kksnJ�||z||zksJ�|D]'}||z|z|||zzksJ�t|||���(|tz|ksJ�||ztksJ�||z||z||zzksJ���A��dS)Nrc�0�g|]}|t��z��Srr��rrs  rrzTest.test18.<locals>.<listcomp>�s ��%B�%B�%B��a�(�*�*�n�%B�%B�%Brc�,�g|]}t|����Sr�rQrCs  rrzTest.test18.<locals>.<listcomp>����-�-�-�A�W�Q�Z�Z�-�-�-r)
r��absrkrr�r�r+r!r'r)r-r%r/)rU�anyrr r$s     r�test18zTest.test18�s1���c�(�*�*�o�o�&�&�'�)�)�3��c�(�*�*�o�o�&�&�'�)�)�3��c�(�*�*�o�o�&�&�'�)�)�3�f��x�z�z�?�?�7$�7$�'.�y�y�71�1��c�(�*�*�o�o�&�&�'�)�)�3�f��x�z�z�?�?�7$�7$�'.�y�y�71�1�	���e�V�Q�C�[�[��h�j�j�!�!��h�j�j�!�!�#�%B�%B�c�%B�%B�%B�C���-�-��-�-�-�-���(	4�(	4�A��A�&�&�&�&��&�&�&�&�&�&��u�9��%�%�%�%��u�9��%�%�%�%��u�9��>�>�>�>��u�9��>�>�>�>���r�6�U�?�?�?�?���r�6�U�?�?�?�?��6�U�?�?�?�?��6�U�?�?�?�?��R�5�A�:�:�:�:���N�N�N��
4�
4���A�2�v��Q�������1�a� � � ��A�q�!�!�!���A�����!�Q�����*�*�A���1�a�(�(�(� ��A�q�)�)�)�)��a��Q��U�a�Z�M�M�M�M�Q��U�a�Z�M�M�M�M��a�R��5��M�M�M�M�/0�b�Q�B�h�M�M�M�M�=>�B��F�e�O�M�M�M�M�M�M�
�1�u��A��~�~�~�~��&�&�A���E�Q�;�!�q�1�u�+�5�5�5�5��Q��1�%�%�%�%��5�y�A�~�~�~�~��1�u��~�~�~�~��1�u��a�R��A���F� 3�3�3�3�3�3�1
4�!(	4�(	4rc�Z�d}dgtd|d��z���}td|dzd��D]}|td|z||��z}�t|��}t|��dksJ�|dd�gd�ksJ�|ddksJ�|d	d
ksJ�|S)Ni�r�r�i&r�)
r�r�r�r���
����i�i�
i%i�)r+r�rr8)rUrD�primesrs    r�test19zTest.test19�s���
���#���A�q�)�)�)�2�2�4�4���!�Q�!�V�Q�'�'�	-�	-�A��x��A��q�!�,�,�,�,�F�F��f�����6�{�{�c�!�!�!�!��c�r�c�{�B�B�B�B�B�B�B��c�{�d�"�"�"�"��c�{�d�"�"�"�"��
rc
�:�tj}|dz
}gd�d�d�d�d�d�d�d	�d
�d�d�d
�d�d�d�|dz
|f�|dz
|df�|dz
|df�|dz
|df�|dz
|df�|dz
|f�|dz
|df�|dz
|df�|dz
|df�|dz
|df�d||f�d||f�d||f�|||f�|||dzf�|||dzf�|||dzf�|||dzf�RD]4}t|�}t|��tt	|���ksJ��5	t||d��td���#t$rYnwxYw|jstd��t	dddd|jzz��D]�}td|d���tj	�
��t	d d!dd|jzz��D]l}t	dddd|jzz��D]M}||z
||z
|f||z||z|ffD]4}t|�}t|��tt	|���ksJ��5�N�m��td"��dS)#Nr)r)r�)r)rL)rr)rrr�)rrr�)rrr)r�Qr)r�`r)r�ar)rrr)rr�)rrrW)rrUrWrr�r�rW�i@r�rr4z>bitrange testing many combinations, this may take some time...r/r�r� )�endr�i
�done)r9r:r+rrr%r5r�r`�stdout�flush)rUr<r=r�brrm�st�args        r�test20zTest.test20�s��������1���"
��"
��"
�
�"
�
�	"
�

�"
�
�
"
�
�"
�
�"
�
�"
�
�"
�
�"
�
�"
�
�"
�
�"
�
�"
� �B�Y���!"
�"�B�Y���"�#"
�$�B�Y���"�%"
�&�B�Y���#�'"
�(�B�Y���#�)"
�*�C�Z�� �+"
�,�C�Z���#�-"
�.�C�Z���#�/"
�0�C�Z���$�1"
�2�C�Z���$�3"
�4��� �5"
�6����7"
�8����9"
�:�V�V�$�;"
�<�V�V�R�Z�(�="
�>�V�V�S�[�)�?"
�@�V�v�r�z�]�+�A"
�B�V�v�s�{�^�,�C"
�"
�$	/�$	/�A�F�1��B���8�8�t�E�1�I���.�.�.�.�.�	;��V�V�Q�'�'�'�!�!9�:�:�:���	�	�	��D�	�����{�	T��R�S�S�S��q�"�a�!�D�K�-�/�0�0�	=�	=�A��#�q�c�"�"�"�"��J�������4��q�1�T�[�=�'8�9�9�
=�
=����2�q�1�T�[�=�'8�9�9�=�=�B�!'�!��V�a�Z�� <�!'�!��V�a�Z�� <� >�=�=��%�s�^��#�B�x�x�4��s��+<�+<�<�<�<�<�<�=�=�
=�	�f�
�
�
�
�
s�.D�
D�Dc���i}td��}td��}|}|}d||<d||<||||cxkrdksnJ�||||cxkrdksnJ�dS)Nrr��r+)rU�Drr r$ris      r�test21zTest.test21's������Q�K�K���Q�K�K��
�B��
�B����!����!����t�q��t� � � � �q� � � � � � ���t�q��t�!�!�!�!�r�!�!�!�!�!�!�!�!rc�H�d�td��D��}|d�dD��z}|d�|D��z}|d�|D��z}|D]X}dD]S}tj||��}tj|��}||ksJ�t	|��t	|��usJ��T�YdS)Nc�*�g|]}t����Sr�r�r�s  rrzTest.test22.<locals>.<listcomp>5s��+�+�+�A�v�x�x�+�+�+rr�c	�D�g|]}dD]}dD]}t|||������S))i�)rr�i,rc)rrHr��zs    rrzTest.test22.<locals>.<listcomp>6s`��+�+�+��%�+�+��)�+�+���a��A�&�&�+�+�+�+�+r)r)rr�c��g|]}|��Srrr�s  rrzTest.test22.<locals>.<listcomp>:s��%�%�%�A�a�R�%�%�%rc�,�g|]}t|����SrrEr�s  rrzTest.test22.<locals>.<listcomp>;rFr)rr)r�pickle�dumps�loads�type)rUrHr�bin�da�aas      r�test22zTest.test223s���+�+��r���+�+�+���+�+�.�+�+�+�+���%�%��%�%�%�%���-�-��-�-�-�-���	+�	+�A��
+�
+���\�!�S�)�)���\�"�%�%���Q�w�w�w�w��B�x�x�4��7�7�*�*�*�*�*�	
+�	+�	+rc�b�Gd�d��}ttd����}||��}t|��}t|��|ksJ�||dg��z}t|��|dgzksJ�t|��}||ksJ�||dg��z}||ksJ�dS)Nc��eZdZd�Zd�ZdS)�Test.test23.<locals>.Tc��||_dSr)�data)rUrys  r�__init__zTest.test23.<locals>.T.__init__Hs
�� ��	�	�	rc�*�t|j��Sr)�iterryr�s r�__iter__zTest.test23.<locals>.T.__iter__Ks���D�I���&rN)r[r\r]rzr}rrr�TrwGs2������
!�
!�
!�
'�
'�
'�
'�
'rr~r�r�)rrr�rQ)rUr~rmr�r �bo100r�s       r�test23zTest.test23Cs���	'�	'�	'�	'�	'�	'�	'�	'�
��r���O�O��
�A�a�D�D���1�I�I���A�w�w�!�|�|�|�|��A�A�s�e�H�H����E�{�{�a�3�%�i�'�'�'�'�
�Q�Z�Z���Q�w�w�w�w�
�a�a���h�h����U�{�{�{�{�{�{rc�D�d�}t|dd���\}}t|��|dksJ�td��}d�}t||fd���\}}t|��|dksJ�|���}d	�}t||fd���\}}t|��|d
ksJ�d�}d�}	||	fD]C}
|���}t|
|fd���\}}t|��|dksJ��D|���}d
�}t||fd���\}}t|��|d
ksJ�d�}d�}
d�}||
|fD]/}
t|
|fd���\}}t|��|dksJ��0||
|fD]�}
td��tdd��z}|���}|t	d��z}|jdksJ�td|j��t|
|fd���\}}t|��|dksJ���dS)Nc�P�t|�����dSr��r+r�)rys rr�zTest.test24.<locals>.f1`s���A�;�;�&�&�(�(��+�+r)逖�rr�rr�c�T�|���}|dz}|d|dfS�Nr�r�r�)r2r�s  r�f2zTest.test24.<locals>.f2is*�������B��"�H�B��a�5�"�Q�%�<�r)rrc�@�t|��}|d|dfSr�rh�r�r2s  r�f3zTest.test24.<locals>.f3vs������B��a�5�"�Q�%�=� r)rrc�J�t|��}|dz}|d|dfSr�rhr�s  r�f4zTest.test24.<locals>.f4~s(������B��"�H�B��a�5�"�Q�%�=� rc�T�|dz}t|��}|dz}|d|dfS)Nrrrhr�s  r�f4bzTest.test24.<locals>.f4b�s1���!�G�B�����B��!�G�B��a�5�"�Q�%�=� rc�J�|���}|d|dfSr�r��r��mcs  r�f5zTest.test24.<locals>.f5�s!�������B��a�5�"�Q�%�=� rc��|td��z}|���}|dgz}|dgz}|d|dfS)Nr�r�r�rr�r�s  r�f6zTest.test24.<locals>.f6�sI���8�B�<�<�-��B������B��1�#�I�B��1�#�I�B��a�5�"�Q�%�=� rc��|td��z}|���}|dgz}|dgz}|d|dfS)Nr�r�r�rr�r�s  r�f6azTest.test24.<locals>.f6a�sI���8�B�<�<�-��B������B��1�#�I�B��1�#�I�B��a�5�"�Q�%�=� rc��|td��z}|dgz}|���}|ddgz}|dgz}|td��z}|d|dfS)Nr�r�rr�r�r)r+r�r�r�s  r�f6bzTest.test24.<locals>.f6b�sj��
�8�B�<�<�-��B��1�#�I�B������B��1�a�&�L�B��1�#�I�B��9�Q�<�<�-��B��a�5�"�Q�%�=� r)r�r�r��@
����I�num_seg)rKr`r+r�r�r)rUr�r�r;r2r�r�r�r�r�rBr�r�r�r�s               r�test24zTest.test24\s���	,�	,�	,��b�+�A�.�.�.���1�
�a�����A�v�v�v�v�
�h�
�
��	 �	 �	 �
�b�2�%�a�(�(�(���1�
�a�����F�{�{�{�{�
�Z�Z�\�\��	!�	!�	!��b�2�%�a�(�(�(���1�
�a�����F�{�{�{�{�	!�	!�	!�
	!�	!�	!��c��	�	�A������B��!�b�U��+�+�+�D�A�q��!�H�H�H���;�;�;�;�;�
�Z�Z�\�\��	!�	!�	!��b�2�%�a�(�(�(���1�
�a�����F�{�{�{�{�
	!�	!�	!�	!�	!�	!�		!�		!�		!��c�3��	�	�A��!�b�U��+�+�+�D�A�q��!�H�H�H���;�;�;�;�;��c�3��	�	�A��&�!�!�H�V�V�$<�$<�<�B������B��)�F�#�#�#�B��;��?�?�?�?��)�R�[�)�)�)��!�b�U��+�+�+�D�A�q��!�H�H�H���;�;�;�;�;�	�	rc��tttj��dz��}t|��ttj��dzksJ�tttj����tjksJ�tttjdz
����tjdz
ksJ�dSr_)r�r
r9r:)rUr2s  r�test25zTest.test25�s���
�C���$�$�Q�&�
'�
'���2�w�w�#�c�k�*�*�1�,�,�,�,�,��6�#�+�&�&�'�'�3�;�6�6�6�6��6�3�;�,��*�+�+�,�,�#�+�
��0A�A�A�A�A�A�Arc�l�ddddddddtd	��f	D]�}|fd|d
zd
ffD]�}t|�}tt|fd���\}}|d
krt	||��||ksJ�t|��}tt|fd���\}}|d
krt	||��||ksJ�����dS)Nrr�rMr�ri�iig�cAr�rr�g{�G�z�?)r
r+rKr8r`rQ)rU�thelenrCr2r�r;s      r�test26zTest.test26�s����"�b�"�b�$��d�C��H�H�E�
	#�
	#�F� ��Q���
�A�$6�7�
#�
#���t�_���c�B�5�q�1�1�1���1��t�8�8��!�Q�K�K�K��F�{�{�{�{��R�[�[���c�B�5�q�1�1�1���1��t�8�8��!�Q�K�K�K��F�{�{�{�{�{�
#�
	#�
	#rc	��td��td��ttt������fD]�}||���fD]m}dD]h}|d|�tt|��d|���ksJ�||d�tt|��|d���ksJ��i�n��dS)Nr)rr�r��r�rrr/rrr)r�r+rGrkr�r)rUr r_rs    r�test27zTest.test27�s�����*�*�h�r�l�l�F�3�x�z�z�?�?�,C�,C�D�	:�	:�A��!�)�)�+�+�&�
:�
:��B�:�:�A��R�a�R�5�F�4��7�7�2�A�2�;�$7�$7�7�7�7�7��a�R�S�S�6�V�D��G�G�Q�B�C�C�L�%9�%9�9�9�9�9�9�:�
:�	:�	:rc�\�t��tt��tdg��z��fD]n}|�d��dksJ�|�d��dksJ�|�d��dksJ�|�d��dksJ��odS)N�rr)rQr��tas�tac)rUr�s  r�test28zTest.test28�s����)�)�W�f�h�h�Y�&�"��,�,��%>�?�?�@�	"�	"�A��5�5��9�9��>�>�>�>��5�5��9�9��>�>�>�>��5�5��9�9��>�>�>�>��5�5��9�9��>�>�>�>�>�		"�	"rc��d�}td��}||��tdd��tdd��z}|���}|td��z}|jdksJ�||��d	d
dddt��t��f}d
�|D��}|d�|D��z}|D]B}|���}|���}|D]}||z}||z}||ksJ���CdS)Nc��|���}|�d��||ksJ�|�d��||ksJ�|�d��||ksJ�|�d��||ksJ�|�d��||ksJ�||z
}|tg��ksJ�dS)NrMr�)r�rarR�discardrXrQ)r��qrFs   rr�zTest.test29.<locals>.ts����	�	���A�
�E�E�"�I�I�I���6�6�6�6�
�H�H�R�L�L�L���6�6�6�6�
�I�I�b�M�M�M���6�6�6�6�
�I�I�b�M�M�M���6�6�6�6�
�H�H�R�L�L�L���6�6�6�6��A��A������#�#�#�#�#�#ri90rXr�r�r�r�rrr�r�r�c�,�g|]}t|����SrrErCs  rrzTest.test29.<locals>.<listcomp>%s��'�'�'�a�w�q�z�z�'�'�'rc�,�g|]}t|����SrrErCs  rrzTest.test29.<locals>.<listcomp>&rFr)rQr+r�r�rrk)rUr�r�r2�allrrsr s        r�test29zTest.test29s8��
	$�	$�	$�"�U�^�^��	��"����
�b�&�
!�
!�H�V�V�$<�$<�
<��
�Z�Z�\�\��
�i�������{�Q�����	��"������Q��A�x�z�z�H�J�J�;�6��'�'�3�'�'�'���-�-��-�-�-�-���	�	�A��	�	���A������B��
�
���Q����q�b����B�w�w�w�w�w�
�	�	rc�0�t}t��}|}g}d}i}d}d}|�|��|�|��|||g��z}|�|��rJ�||gz}|||||||g��ksJ�||gz}||||||g��ksJ�|�|��sJ�|||||g��ksJ�|||g��z}||||g��ksJ�|�|��|||g��ksJ�|�|��||g��ksJ�|�|��t|��dksJ�|�	��|usJ�	|�	��td���#t$rYnwxYwt|��dksJ�||usJ�t|��}|||g��z}|||g��ksJ�||usJ�|}	|||g��z}||	usJ�||g��ksJ�tgd���}t|��dksJ�|���t|��dksJ�t|��gksJ�dS)Nrr�rzexpected ValueErrorr8r�)�
immnodeset�
mutnodesetrarRr�r�rXr�r8r�r%r&�clearr)
rU�nodeset�ns�ns0rr r$riro�ns1s
          r�test30zTest.test30/s����
�\�\����������
����	���q�	�	�	�
�	�	�!����
�g�g�q�c�l�l����6�6�!�9�9���}�
�q�c�	���W�W�a��A�q�!�_�-�-�-�-�-�-�	�q�c�	���W�W�a��A�q�\�*�*�*�*�*�*��v�v�a�y�y���y��W�W�a��A�Y�'�'�'�'�'�'�
�g�g�q�c�l�l����W�W�a��V�_�_�$�$�$�$�
�	�	�!�����W�W�a�S�\�\�!�!�!�!�
�
�
�1�
�
�
��W�W�R�[�[� � � � �	���q�	�	�	��2�w�w�!�|�|�|�|��v�v�x�x�1�}�}�}�}�	8��F�F�H�H�H�!�!6�7�7�7���	�	�	��D�	�����2�w�w�!�|�|�|�|��b�y�y�y�y�
��^�^��
�g�g�q�c�l�l����W�W�a�S�\�\�!�!�!�!���}�}�}�}���
�g�g�q�c�l�l���
��}�}�}�}��W�W�R�[�[� � � � ��	�	�	�
"�
"���2�w�w�!�|�|�|�|�
���
�
�
��2�w�w�!�|�|�|�|��B�x�x�2�~�~�~�~�~�~s�F)�)
F6�5F6c��t}ddlm}g}g}g}||��}||��}||��}|��}	|	�|��||	vsJ�||	vsJ�|	�|��||	vsJ�|	�|��dksJ�||	vsJ�|dz||��ksJ�|dz||��ksJ�|dz||��ksJ�|	�|��dksJ�|	�|��dksJ�|	�|��dksJ�|	�|��|	�|��	|	�|��td���#t$rYnwxYw|	�|��	|	�|��td���#t$rYnwxYw|||��ksJ�|||��ksJ�|||��ksJ�|	�|��|	�|��|	�|��d}	|||��ksJ�|||��ksJ�|||��ksJ�ddl}
|��}	|	�|��|	�|	��|	|	vsJ�d}	|
j��|||��ksJ�|��}	|	�|��|	�|��|�|	��d}	d}|
j��|||��ksJ�dS)Nr��getrefcountrzno exception from appendzno exception from remove)
r�r9r�rarRr�r�r�rXr%r&�gc�collect)rU�H�grc�e1�e2�e3�r1�r2�r3r�r�s           r�test31zTest.test31~s���
��*�*�*�*�*�*�
��
��
��
�S��W�W��
�S��W�W��
�S��W�W��
�A�C�C��	���b�	�	�	��Q�w�w�w�w���{�{�{�{�	��������Q�w�w�w�w��u�u�R�y�y�A�~�~�~�~��Q�w�w�w�w��A�v���R��� � � � ��A�v���R��� � � � ��A�v���R��� � � � ��u�u�R�y�y�A�~�~�~�~��u�u�R�y�y�A�~�~�~�~��u�u�R�y�y�A�~�~�~�~�	�	�	�"�
�
�
�	�������	=�
�H�H�R�L�L�L�!�!;�<�<�<���	�	�	��D�	����
	
�������	=�
�H�H�R�L�L�L�!�!;�<�<�<���	�	�	��D�	����
�S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}�	���b�	�	�	�	���b�	�	�	�	���b�	�	�	����S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}�	�	�	�	�
�A�C�C��	�������	��������A�v�v�v�v�����
�����S�S��W�W�}�}�}�}�
�A�C�C��	�������	�������
�	�	�!������
����
�����S�S��W�W�}�}�}�}�}�}s$�E8�8
F�F�G�
G�Gc�>��t�ddl}ddlm}|j��g}g}g}||��}||��}||��}�||g��}	||	vr||	vr||	vsJ��||g��}
|	|
z}	||	vsJ�||	vsJ�|	|
z}	||	vsJ�||	vsJ�g|g||g|||g|g||g|g||||gf}�fd�|D��}t|||��t
||��t||��t||��|D]?}
|D]:}dD]5}	t||
|d�i��td���#t$rY�2wxYw�;�@dx}x}	x}
x}x}
x}x}}|j��|j��|||��ksJ�|||��ksJ�|||��ksJ�dS)Nrr�c�&��g|]
}�|����Srr)rrHr�s  �rrzTest.test32.<locals>.<listcomp>�s!���
�
�
�q�a�a��d�d�
�
�
r)zassert list(b) | a == a | bzassert list(b) & a == a & brzExpected TypeError)r�r�r9r�r�r4r<r9r?�exec�	Exception�	TypeError)rUr�r�r�r�r�r�r�r�r��s3r�ssrr rHr$r�s                 @r�test32zTest.test32�s����
���	�	�	�*�*�*�*�*�*���
����
��
��
��
�S��W�W��
�S��W�W��
�S��W�W��
�A�r�2�h�K�K���Q�w�w�2��7�7�2��7�7�7�2�
�Q��B�x�[�[��	�R����Q�w�w�w�w��Q�w�w�w�w�	�R�����{�{�{�{��Q�w�w�w�w�
�"���B�x�"�b�"���t�b�"�X��t�b�"�b�RT�EU�
U��
�
�
�
�B�
�
�
���B��B�'�'�'��R������R�������R� � � ��
	>�
	>�A��
>�
>���	>�	>�A�>��Q�a�a� 0� 0�"�5�5�5�(�(<�=�=�=��%����������
	>�
>�,0�/��/�Q�/��/�b�/�1�/�q�/�1�q���
������
�����S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}��S�S��W�W�}�}�}�}�}�}s�D*�*
D7	�6D7	c�0�d}t��}t|��D]'}|t|dzdzdz|dzdzdz��z}�(|���}g}|jdksJ�t|dz
��D]W}|�|�����|t
|dzdzdzdz��z}|j|dzksJ��Xt|dz
��D].}|||ksJ�|t
|dzdzdzdz��z}�/dS)NrXr�r�rrx)r�rr+r�rrRr�)rU�numsegr2rr��msss      r�test33zTest.test33sE����
�X�X���v���	:�	:�A��(�1�Q�3�v�:�b�=�1�Q�3�q�5�&�.�9�9�9�B�B�
�Z�Z�\�\�����{�a������v�a�x���	&�	&�A��J�J�r�z�z�|�|�$�$�$��)�Q�q�S��U�F�N�5�0�1�1�1�B��;�!�A�#�%�%�%�%�%��v�a�x���	2�	2�A��q�6�R�<�<�<�<��)�Q�q�S��U�F�N�5�0�1�1�1�B�B�	2�	2rc��t}g}Gd�d|��}|��}||vsJ�|�|g��||vsJ�dS)Nc��eZdZd�ZdS)�Test.test34.<locals>.Xc�:�|D]}|�|���dSrr~)rUr�ros   r�extendzTest.test34.<locals>.X.extend6s,���#�#�A��K�K��N�N�N�N�#�#rN)r[r\r]r�rrr�Xr�5s#������
#�
#�
#�
#�
#rr�)�
MutNodeSetr�)rUr�r�r�r�s     r�test34zTest.test34/st��
��
��	#�	#�	#�	#�	#��	#�	#�	#�

�A�C�C����{�{�{�{�	���"������Q�w�w�w�w�w�wrc���td��D�]C}ttfD�]0�G�fd�d���}|��}|dd��}t|��ddgksJ���|��dksJ���|td����dksJ���|t
d����d	ksJ���|d
��dksJ���|d��d
ksJ��turB|dd��}ddl}t|j	j
�|����dksJ���2��EdS)Nr�c�8��eZdZgd�Z�fd�Z�fd�Zd�Zd�ZdS)�Test.test35.<locals>.X)�red�green�bluec�J�������fd�|D����S)Nc�D��g|]}�j�|����Sr)�bitnames�index)rrH�class  �rrz2Test.test35.<locals>.X.__new__.<locals>.<listcomp>Js)���/U�/U�/U�1��
�0C�0C�A�0F�0F�/U�/U�/Ur)�__new__)r�rCr�s` �rr�zTest.test35.<locals>.X.__new__Is.���� �y�y��/U�/U�/U�/U�PT�/U�/U�/U�V�V�Vrc3�Z�K���|��D]}|j|V��dSr)r}r�)rUr�r�s  �rr}zTest.test35.<locals>.X.__iter__LsB�����#$�:�:�d�#3�#3�5�5�C�"&�-��"4�4�4�4�4�5�5rc�2�dd�|��zS)Nz{%s}z, )�joinr�s r�__str__zTest.test35.<locals>.X.__str__Ps��%����4���9�9rc�B�t|��t|��kSr)r�)rU�others  r�__eq__zTest.test35.<locals>.X.__eq__Ss��"�4�y�y�C��J�J�6�6rN)r[r\r]r�r�r}r�r�)r�s�rr�r�Fsu�������7�7�7�H�W�W�W�W�W�5�5�5�5�5�:�:�:�7�7�7�7�7rr�r�r�z{}rz{red}z{green}r�z{red, green}r�z{blue}rz(~ImmBitSet(['red', 'blue'])))r�	ImmBitSet�	MutBitSetrr��	immbitset�	mutbitset�guppy.sets.setscr��sets�setsc�	CplBitSet)rUrr�rH�guppyr�s     @r�test35zTest.test35?s�����q���%	?�%	?�A��	�)�"
?�"
?��7�7�7�7�7�7�7��7�7�7� �A�C�C���A�e�V�$�$���A�w�w�5�&�/�1�1�1�1��	�	�!���4�/�/�/�/��	�	�!�Y�q�\�\�2�2�w�>�>�>�>��	�	�!�Y�q�\�\�2�2�y�@�@�@�@��	�	�!�Q���N�:�:�:�:��	�	�!�Q���H�4�4�4�4��	�>�>���%��(�(�A�+�+�+�+��u�z�/�9�9�!�<�<�=�=�=�>�>�>�>��C"
?�%	?�%	?rNr�)(r[r\r]r�r�r�r�r�r�r�r�rrr
rrr#r'r-r1r>r@rIrRrarertr�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r��sd������
�F�
�
�
�f�f�f�P+�+�+�:"#�"#�"#�H=�=�=�*L%�L%�L%�\?�?�?�,w"�w"�w"�r#�#�#�#�#�#����$����+�+�+�@!@�!@�!@�F
=�
=�
=����**�*�*�@L�L�L�"<4�<4�<4�|���"?�?�?�B
"�
"�
"�+�+�+� ���2p�p�p�dB�B�B�&#�#�#�$:�:�:�"�"�"�*�*�*�XM�M�M�^R�R�R�h:�:�:�x2�2�2�B��� (?�(?�(?�(?�(?rr�c� �eZdZd�Zd�Zd�ZdS)�MemStatc���i|_ddlm}|��x|_}|jjj|_|jjj|_|jjj	j
|_
dS)Nr)�Root)�nrefsr�r�R�heapy�View�V�Path�P�heapyc�	xmemstats)rUrrs   rrzzMemStat.__init__ks^����
��������T�V�V��������#������#������-�7����rc���|jj���|j���}|�tj����||_dSr)rr�r�r�horizon�update�get_objectsr�)rUr�s  r�markzMemStat.markvsN����	�������F�N�N����	�����!�!�"�"�"�����rc���tj��|���|j}|j}|j}|j}	tj��}|D]?\}}}}	||z
}
||vs|
||kr#t||
fdtj
���|
||<�@ttj
���n#t$rYnwxYwdx}x|_x}x}x}x}x}x}	x}
}tj��dS)NrY)rZr�r�)
r�r�r	rrrrr9�	getcountsr`�stderr�AttributeErrorr�)rUrrrr�co�name�allo�free�max�nrefr�ryrmrs               r�dumpzMemStat.dump|s+��
�
�����������F���F���F���
��
	#�����B�,.�
'�
'�'��t�T�3��d�{���u�$�$���d��(;�(;��4��,�C�c�j�A�A�A�A�"&�E�$�K���s�z�"�"�"�"�"���	�	�	��D�	����BF�E��E�D�F�E�Q�E��E�d�E�T�E�D�E�3�E��Q�	�
�����s�B5�5
C�CN)r[r\r]rzrrrrrr�r�jsA������8�8�8��������rr�c	���g}|D]/}|�|ttd|z��f���0|D]-\}}td|z��|��|�
|���.dS)Nztest%dzTest #%d)rR�getattrr�r`)�numbersr�enufuncsryrBs     r�	test_numsr�s����H�
�7�7������G�A�x�!�|�4�4�5�6�6�6�6������1�
�j�1�n����	��������D�F�F�F��	�rc���ddl}ttd����}|�d��t	��}d}	t||j��|j��|dz
}�*)Nr�$r/r)r�rrrXr�rrr�)r��numsr�rs    r�	test_leakr"�sk��
�I�I�I���b�	�	�?�?�D��K�K��O�O�O�	���B�	�A���$��� � � ���
����	�Q���rc�X�tttd������dS)Nr )rrrrrr�	test_mainr$�s"��
�d�5��9�9�o�o�����r�__main__r)rrr)rb)3�
guppy.setsrm�timerrAr�rr9�numpy.randomr�	has_numpy�ImportErrorrr�r�r�r�rQr��immbitranger+�immbitr�r!r%r'r)r+r-r/r4r9r<r?rKrMrarrkrprur|r�r�r�r�rr"r$r�r[rrr�<module>r-s������
�
�
�
�&�&�&�&�&�&�	�	�	�	�
�
�
�
�
�
�
�
�������I�I�������I�I�I�����

�B�Q�Q�Q�Q�B�B�B�	�	����	���
��	�����	����
&�&�&�
���
0�0�0�0����
���?�?�?�
"�
"�
"�D�D�D�
2�
2�
2� )�)�)�
�
�
�
�
�7�7�7�7�7�G�7�7�7��
�
�
�,�,�,�,�

�
�
����������
��������~?�~?�~?�~?�~?�~?�~?�~?�B,*�*�*�*�*�*�*�*�\����
�
�
����	�D�F�F���z����I�K�K�K�K�K�	�s�#�-�-