403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/numpy/lib/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/numpy/lib/tests/__pycache__/test_arraysetops.cpython-312.pyc
�

	�go����dZddlZddlmZmZmZmZmZmZm	Z	ddl
mZddlm
Z
mZmZmZddlZGd�d�ZGd�d	�Zy)
z-Test functions for 1D array set operations.

�N)�ediff1d�intersect1d�setxor1d�union1d�	setdiff1d�unique�isin)�	AxisError)�assert_array_equal�assert_equal�
assert_raises�assert_raises_regexc
�	�eZdZd�Zd�Zd�Zd�Zd�Zd�Ze	jjdejgd�ej�	�d
ejdfejgd�ej�	�ejgd�ej �	�d
d
fejgd�ej"�	�ejejd
fg�d��Ze	jjdejgd�ej&�	�ddejgd�ej&�	�fejgd�ej �	�ejdgej(�	�d
ejgd�ej �	�fejgd�ej*�	�ddejgd�ej*�	�fejgd�ej�	�ddejgd�ej�	�fg�d��Ze	jjdgd��d��Ze	jjdgd��d��Zd �Ze	jjdgd��d!��Zd"�Ze	jjdgd��d#��Ze	jjdd
d$g�d%��Zd&�Ze	jjd'ej"ej&fej&ej"fej>ej@fej@ej>fej>ej&fej&ej>fejBejfg�e	jjdgd��d(���Z"e	jjd)ejd*d+gejB�	�ejd,d-gej�	�g�e	jjdgd��d.���Z#e	jjdgd��d/��Z$d0�Z%d1�Z&d2�Z'd3�Z(d4�Z)d5�Z*d6�Z+d7�Z,d8�Z-d9�Z.d:�Z/y
);�
TestSetOpsc��tjgd��}tjgd��}tjgd��}t||d��}t||�tjgd��}tjgd��}tjgd��}t||�}t||�tgtgg��y)N������r��rr)rrrT��
assume_unique)rrrrr)rrrrrrr)�np�arrayrr)�self�a�b�ec�c�eds      �BC:\Python312\Lib\site-packages\numpy/lib/tests/test_arraysetops.py�test_intersect1dzTestSetOps.test_intersect1ds����H�H�\�"���H�H�_�%��
�X�X�i�
 ����1�D�1���1�b�!�
�H�H�_�%���H�H�*�+��
�X�X�i�
 ����1����1�b�!��2�{�2�r�2�3�c��Gd�d�}|�}t||�}t||�tgd�gd��}t|gd��y)Nc��eZdZdd�Zy)�4TestSetOps.test_intersect1d_array_like.<locals>.TestNc�,�tjd�S)Nr)r�arange)r�dtype�copys   r$�	__array__z>TestSetOps.test_intersect1d_array_like.<locals>.Test.__array__&s���y�y��|�#r&)NN)�__name__�
__module__�__qualname__r.�r&r$�Testr)%s��
$r&r3�rrr)rr)rr3r�ress    r$�test_intersect1d_array_likez&TestSetOps.test_intersect1d_array_like#sA��	$�	$�
�F���!�Q����3��"��)�Y�/���3�	�*r&c��tjgd��}tjgd��}t||dd��\}}}tjgd��}t||�t|||�t|||�tjgd��}tjgd��}t||d��\}}}tjgd��}t||�t|||�t|||�tjgd	�gd
�g�}tjgd�gd�g�}t||dd��\}}}tj||j
�}tj||j
�}	tjgd
��}
t|
||�t|
||	�tjgd�gd�g�}tjgd�gd�g�}t||d��\}}}tj||j
�}tj||j
�}	tjgd��}
t|
||�t|
||	�y)N�rrrr)rrr�T)r�return_indices)rrr)rrrrrrr)r�rrrrrr)r:)rrrr9)rr;r�)rrrr9)�
�r;�	)rr9rr;)rrrr9r9)rrr;rr)rrrr)r=r>r;r)rrr;)rrrr�
unravel_index�shape)rrr r"�i1�i2�ee�ef�ui1�ui2�eas           r$�test_intersect1d_indicesz#TestSetOps.test_intersect1d_indices/s����H�H�\�"���H�H�\�"����1�D��N�	��2�r�
�X�X�i�
 ���1�b�!��1�R�5�"�%��1�R�5�"�%�
�H�H�*�+���H�H�-�.����1�T�:�	��2�r�
�X�X�l�
#���1�b�!��1�R�5�"�%��1�R�5�"�%�
�H�H�l�M�2�3���H�H�l�N�3�4����1�D��N�	��2�r����r�1�7�7�+�����r�1�7�7�+��
�X�X�l�
#���2�q��v�&��2�q��v�&�
�H�H�o��7�8���H�H�l�N�3�4����1�T�:�	��2�r����r�1�7�7�+�����r�1�7�7�+��
�X�X�i�
 ���2�q��v�&��2�q��v�&r&c�^�tjgd��}tjgd��}tjgd��}t||�}t||�tjgd��}tjgd��}tjgd��}t||�}t||�tjgd��}tjgd��}tjgd��}t||�}t||�tgtgg��y)	Nrr)rrrr4)r9rr�rrrrrr9�rr;rr�r9rrr;�rrrr�rrr r!r"s     r$�
test_setxor1dzTestSetOps.test_setxor1dVs����H�H�\�"���H�H�_�%��
�X�X�i�
 ���Q��N���1�b�!��H�H�Y����H�H�Y���
�X�X�(�
)���Q��N���1�b�!��H�H�\�"���H�H�\�"��
�X�X�(�
)���Q��N���1�b�!��2�x��B�/�0r&c��tjgd��}tjgd��}tjgd��}t||d��}t||�tjdgdgdgd	gg�}tjd
dgddgg�}tjgd��}t||d��}t||�y)
NrLrMrKTrrr;rrr9rrrNrOs     r$�test_setxor1d_uniquezTestSetOps.test_setxor1d_uniquens����H�H�\�"���H�H�\�"��
�X�X�(�
)���Q���.���1�b�!��H�H�q�c�A�3���a�S�)�*���H�H�q�!�f�q�!�f�%�&��
�X�X�(�
)���Q���.���1�b�!r&c	���tjg�}tjdg�}tjddg�}tgt|��tdgt|d���tdgt|d���tddgt|dd���tgt|��tdgt|��tgd�t|d	d
���tgd�t|dd
gd	dg���tdd
gt|d
���tgd�t|d	dg���td	dgt|d	���tgd�t|dd
g���y)Nrrr)�to_begin)�to_end���)rTrU)rrr?rr?)rr9rrr;rr9r;)rrr;)rr9r)rrrr)r�	zero_elem�one_elem�two_elems    r$�test_ediff1dzTestSetOps.test_ediff1d}s"���H�H�R�L�	��8�8�Q�C�=���8�8�Q��F�#���2�w�y�1�2��A�3��	�A� >�?��A�3��	�!� <�=��B��7�G�I��1�$M�N��2�w�x�0�1��A�3��� 1�2��9�g�h��1�&M�N��?�"�8�q�!�f�a��V�L�	N��A�q�6�7�8�A�#>�?��9�g�h��1�v�&F�G��A�q�6�7�8�a�#@�A��9�g�h�!�Q��&H�Ir&zary, prepend, append, expectedr4�r,NrU)rrrrT)��?g@g"@c��dj|�}tt|�5t|||��ddd�y#1swYyxYw)Nz dtype of `{}` must be compatible��aryrUrT)�formatr�	TypeErrorr)rr_�prepend�append�expected�msgs      r$�!test_ediff1d_forbidden_type_castsz,TestSetOps.test_ediff1d_forbidden_type_casts�sC��:1�7�7��A��
 ��C�
0�	&���!�$�
&�	&�	&�	&�s	�:�Azary,prepend,append,expectedii)rrrrr)rrrr)rrrrr���)rrrrgc��tj|||��}t||�|j|jk(sJ�y)Nr^)rrrr,)rr_rbrcrd�actuals      r$�test_ediff1d_scalar_handlingz'TestSetOps.test_ediff1d_scalar_handling�s<��:����#)�%,�.��	�V�X�&��|�|�x�~�~�-�-�-r&�kind)N�sort�tablec���
�d�}tj|tgdh���
�
�fd�}tjd�j	gd��}tj
gd�gd�gd	�g�}|||�d
dg}d}|||�tj
d
�}|||�|||�|||�|d|�||d�|dd��dk7rg}	||	|�|||	�||	|	�ttjtjfD]�}
�dk(r|
tjk(r�|
tjtjhvrtj
gd�|
��}n |
thvrtj
gd��}tj
g|
��}||�|||�|||���y)Nc�l�tj|�j�j�}||vS)N)r�asarray�flatten�tolist)rr s  r$�
_isin_slowz(TestSetOps.test_isin.<locals>._isin_slow�s*���
�
�1�
�%�%�'�.�.�0�A���6�Mr&r)�otypes�excludedc�L��t||���}�||�}t||�y)N�rk)r	r)rr �x�y�	isin_slowrks    ��r$�assert_isin_equalz/TestSetOps.test_isin.<locals>.assert_isin_equal�s&����Q���%�A��!�Q��A��q�!�$r&��rrr)r=��)rrr)���!)r?r;)rr9)r?rrrr9rmr[�TFF)r�	vectorize�boolr+�reshaper�int64�float64)rrkrsr{rr r"�d�frxr,�ar�empty_arrayrzs `           @r$�	test_isinzTestSetOps.test_isin�s����	��L�L��T�F�a�S�I�	�	%�
�I�I�b�M�!�!�)�,���H�H�l�I�|�<�=���!�Q���V������!�Q��
�H�H�Q�K���!�Q���!�Q���!�Q��	�!�Q���!�Q���!�Q���7�?��A��a��#��a��#��a��#��B�H�H�b�j�j�1�
	8�E��w��5�B�J�J�#6������2�:�:�.�.��X�X�l�%�8���4�&���X�X�2�3���(�(�2�U�3�K��k�2�.��b�+�.��k�;�7�
	8r&c�~�dD�]>}gd�}gd�|z}tjgd��}t||d|��}t||�d|d<tjgd	��}t||d|��}t||�d
\|d<|d<tjgd��}t||d|��}t||�tjgd
��}gd�|z}gd�}t|||��}t||�|gd�|zz}gd�}t|||��}t||�tjgd��}tjgd�|z�}tjgd��}t|||��}t||�tjgd��}tjgd�|z�}tjgd��}t|||��}t||�tjddg�}tjddg|z�}tjddg�}t|||��}t||���Atjdg�}tjdg�}tjdg�}t|||��}t||�|dvrttgg|��g�yy)N�rr=rr�TFTTT)rrkr;r)FFTT)rr;r)TFTF�rrrrrrrrrrrrrrr})FTFTTTTTTFTFFFrw)rrr)TTTTTTTTTTTFTT)rrrrr)rrrrrr)TFTTTrrF>Nrl�rrr	r)rrk�multrr r!r"s       r$�test_isin_additionalzTestSetOps.test_isin_additionalsj���/	&�D��A��$�&�A����3�4�B��Q���D�9�A��q�"�%��A�a�D����4�5�B��Q���D�9�A��q�"�%��J�A�a�D�!�A�$����4�5�B��Q���D�9�A��q�"�%����C�D�A��D� �A�4�B��Q���%�A��q�"�%��I��$�$�A�+�B��Q���%�A��q�"�%�����&�A�����4�/�0�A����3�4�B��Q���%�A��q�"�%�����)�A����+�d�2�3�A����9�:�B��Q���%�A��q�"�%����!�Q�� �A����!�Q��$��'�A����5�%�.�)�B��Q���%�A��q�"�%�_/	&�b
�H�H�a�S�M���H�H�a�S�M��
�X�X�u�g�
����A�D�!���1�b�!��>�!��t�B���6��;�"r&c��tjgd��}tjddg�}tjgd��}t||�}t||�y)N)rr r"r��er"r�r rr")TFTFFTFFr�rOs     r$�test_isin_char_arrayzTestSetOps.test_isin_char_arrayNsG���H�H�=�>���H�H�c�3�Z� ��
�X�X�K�
L����A�J���1�b�!r&c
���dD]X}tjgd��}gd�|z}ttjt	|||���t	||d|����Z|dvr�dD]�}tjgd�tj
��}gd�|z}tj|tj
��}ttjt	|||���t	||d|�����y	y	)
zTest isin's invert parameterr�r�r}rwT��invertrk>Nrlr[N)rrrr�r	�float32)rrkr�rr s     r$�test_isin_invertzTestSetOps.test_isin_invertWs���
�	C�D����C�D�A��D� �A��r�y�y��a���)>�?�#�A�q��D�A�
C�	C��>�!��
G���H�H�G�"$�*�*�.����$���H�H�Q�b�j�j�1��"�2�9�9�T�!�Q�T�-B�#C�#'��1�T��#E�G�
G�"r&c�Z�tjgd�tj��}tjgd�tj��}tjgd�t��}t	|t||��t	tj|�t||d���tjgd�tj��}tjgd�tj��}tjgd	��}t||d�
�}t	||�y)z(Hit the standard isin code with integers)rrrrrr�e��Ar[)rrrr�)rrrrrrrT�r�r)rrrrrr�r�rN)rrr�r�rr	r�)rrr rdr!r"s      r$�!test_isin_hit_alternate_algorithmz,TestSetOps.test_isin_hit_alternate_algorithmls���
�H�H�,�B�H�H�=���H�H�^�2�8�8�4���8�8�1��>���8�T�!�Q�Z�0��2�9�9�X�.��Q��$�0G�H��H�H�\����2���H�H�)����:��
�X�X�/�
0����A�T�*���1�b�!r&c	��tjddg�}tjgd��}tjddg�}t|t|||���ttj|�t||d|���y)z&Test that isin works for boolean inputTF)FFFrwr�N)rrrr	r�)rrkrr rds     r$�test_isin_booleanzTestSetOps.test_isin_boolean|sn��
�H�H�d�E�]�#���H�H�*�+���8�8�U�D�M�*���8���1�4�0�	2��2�9�9�X�.���1�T��=�	?r&rlc��tjjd�}|jddd��}|jddd��}t	||�}|jd�}|jd�}t
|t	|||���y)z(Test that isin works for timedelta inputr�dr=)�size�timedelta64[s]rwN)r�random�RandomState�randintr	�astyper)rrk�rstaterr �truth�a_timedelta�b_timedeltas        r$�test_isin_timedeltazTestSetOps.test_isin_timedelta�s|�����&�&�q�)���N�N�1�c��N�+���N�N�1�c��N�+���Q��
���h�h�/�0���h�h�/�0���5�$�{�K�d�"K�Lr&c��tjgd�d��}|}tjt�5t||d��ddd�y#1swYyxYw)N�rrrr�r[rmrw)rr�pytest�raises�
ValueErrorr	�rrr s   r$�test_isin_table_timedelta_failsz*TestSetOps.test_isin_table_timedelta_fails�sE���H�H�Y�&6�7��
��
�]�]�:�
&�	%���A�G�$�	%�	%�	%�s�A
�
Az
dtype1,dtype2c�&�tj|tj�}tjgd�|��}|rtjgd�|��}ntjgd�|��}tjgd��}|dk(xr(|tjk(xr|tj
k(}|r3t
jtd��5t|||�	�d
d
d
�y
tt|||�	�|�y
#1swYy
xYw)z7Test that isin works as expected for mixed dtype input.)rrrrr[)i����r�)r�r�)TTFFrmzexceed the maximum)�matchrwN)r�
issubdtype�
signedintegerr�int16�int8r�r��RuntimeErrorr	r)	r�dtype1�dtype2rk�is_dtype2_signed�ar1�ar2rd�expect_failures	         r$�test_isin_mixed_dtypez TestSetOps.test_isin_mixed_dtype�s����=�=���1A�1A�B���h�h�|�6�2����(�(�>��8�C��(�(�=��7�C��8�8�6�7�����6��b�h�h��4�6�R�W�W�#4�	�����|�3G�H�
*��S�#�D�)�
*�
*�
�t�C��4�8�(�C�
*�
*�s�D�D�datalll����l����c���|d}tj|||��}t|ddg�|jtj�}tj|||��}t|ddg�y)z>Test values outside intp range (negative ones if 32bit system)rrwFTN)rr	rr��int32)rrkr��queryr5s     r$�test_isin_mixed_huge_valsz$TestSetOps.test_isin_mixed_huge_vals�sa���Q����g�g�d�E��-���3���
�.��{�{�2�8�8�$���g�g�d�E��-���3����/r&c�|�tjdD]�}tjgd�t��}tjgd�|��}tjgd�t��}t	t|||��|�||}}tjgd�t��}t	t|||��|���y)	z4Test that isin works as expected for bool/int input.�
AllIntegerr�r[�rrrr)FTTrw)TTTTN)r�	typecodesrr�rr	)rrkr,rr rds      r$�test_isin_mixed_booleanz"TestSetOps.test_isin_mixed_boolean�s����\�\�,�/�	@�E����-�T�:�A�����U�3�A��x�x� 3�4�@�H��t�A�q�t�4�h�?��a�q�A��x�x� 8��E�H��t�A�q�t�4�h�?�	@r&c��dg}tjdgdz�}tjdg�}tj||�}t||�y�Nrr=Fr��rr�r�rd�results     r$�test_isin_first_array_is_objectz*TestSetOps.test_isin_first_array_is_object�sG���f���h�h��s�2�v����8�8�U�G�$������c�"���6�8�,r&c��d}tjdgdz�}tjdg�}tj||�}t||�yr�r�r�s     r$� test_isin_second_array_is_objectz+TestSetOps.test_isin_second_array_is_object�sE�����h�h��v�b�y�!���8�8�U�G�$������c�"���6�8�,r&c��dg}tjdgdz�}tjdg�}tj||�}t||�y)Nr=Tr�r�s     r$� test_isin_both_arrays_are_objectz+TestSetOps.test_isin_both_arrays_are_object�sG���f���h�h��v�b�y�!���8�8�T�F�#������c�"���6�8�,r&c� �tjdtfdtfg�}tjdg|��}tjdgdz|��}tjdg�}tj
||�}t
||�y)N�field1�field2)rNr[r=T)rr,�int�objectrr	r)r�dtr�r�rdr�s      r$�+test_isin_both_arrays_have_structured_dtypez6TestSetOps.test_isin_both_arrays_have_structured_dtype�sr���X�X��#���6�(:�;�
<���h�h�	�{�"�-���h�h�	�{�2�~�R�0���8�8�T�F�#������c�"���6�8�,r&c��tjddgt��}tjddgt��}tjddg�}tj||�}t	||�tj||d��}t	|tj
|��tjgd�t��}|dd}tjgd�t��}|dd}tjddg�}tj||�}t	||�tj||d��}t	|tj
|��tjgd�t��}|dd}tjddgt��}tjdd	g�}tj||�}t	||�tj||d��}t	|tj
|��y)
N�rrr[Tr�)r�)rrrrV)r��rrrF)rrr�r	rr�r�s     r$�'test_isin_with_arrays_containing_tuplesz2TestSetOps.test_isin_with_arrays_containing_tuples�s����h�h��a�y��/���h�h��a�y��/���8�8�T�4�L�)������c�"���6�8�,�����c�$�/���6�2�9�9�X�#6�7��h�h�(��7���#�2�h���h�h�(��7���#�2�h���8�8�T�4�L�)������c�"���6�8�,�����c�$�/���6�2�9�9�X�#6�7��h�h�(��7���#�2�h���h�h��a�y��/���8�8�T�5�M�*������c�"���6�8�,�����c�$�/���6�2�9�9�X�#6�7r&c��tjgd��}tjgd��}ttt||d��tjgd�t
��}tjgd�t
��}ttt||d��tjtjfD]�}tjgd�|��}tjd	tj|�jg|��}ttt||d��tj||d
��}t|dgdgd
zz�tj||d��}t|dgdgd
zz���y
)z&Test that isin raises expected errors.)rrrrr)rrr9r;r=�	quicksortrw)rrrr rr[rm)rVrrrrrVNTFrrl)rrr
r�r	r�r�r��iinfo�maxr�r)rr�r��obj_ar1�obj_ar2r,�overflow_ar2r�s        r$�test_isin_errorszTestSetOps.test_isin_errorss���h�h��'���h�h�'�(���j�$��S�{�C��(�(�.�f�=���(�(�.�f�=���j�$���w�G��h�h����)�	=�E��(�(�+�5�9�C��8�8�R����%��)<�)<�$=�U�K�L�

���c�<�g�
��W�W�S�,�T�:�F��v��v���!��';�<��W�W�S�,�V�<�F��v��v���!��';�<�'	=r&c��tjgd��}tjgd��}tjgd��}t||�}t||�tjgd�gd�g�}tjgd��}tjgd��}t||�}t||�tgtgg��y)N)rrrrr�rrrrrrr)rrrrrrr�)rrr)rrrrr)rrrrrr)rrrr)	rrr r!r"rxry�ez�zs	         r$�test_union1dzTestSetOps.test_union1d:s����H�H�_�%���H�H�*�+��
�X�X�(�
)���A�q�M���1�b�!�
�H�H�i��+�,���H�H�_�%��
�X�X�(�
)���A�q�M���1�b�!��2�w�r�2��/r&c�@�tjgd��}tjgd��}tjddg�}t||�}t||�tjd�}tjd�}tjddg�}t||�}t||�tgtgg��tjdtj
�}t
t|g�jtj
�y)	N)r9rrrrrrrr�r9r��r~r2)rrrrr+�uint32rr,rOs     r$�test_setdiff1dzTestSetOps.test_setdiff1dLs����H�H�-�.���H�H�*�+��
�X�X�q�!�f�
���a��O���1�b�!��I�I�b�M���I�I�b�M��
�X�X�r�2�h�
���a��O���1�b�!��2�y��R�0�1��H�H�R����#���Y�q�"�%�+�+�R�Y�Y�7r&c���tjgd��}tjgd��}tjddg�}t||d��}t||�y)N)rrr)rrrrrTr)rrrr)rrr rdris     r$�test_setdiff1d_uniquez TestSetOps.test_setdiff1d_unique^sH���H�H�Y����H�H�Y����8�8�Q��F�#���1�a�t�4���V�X�&r&c��tjgd��}tjgd��}tt||�tjdg��y)N)rr r")rr �sr")rrrrr�s   r$�test_setdiff1d_char_arrayz$TestSetOps.test_setdiff1d_char_arrayes8���H�H�_�%���H�H�_�%���9�Q��?�B�H�H�c�U�O�<r&c���tjgd��}tjgd��}t||�}t||�}t	||�}t||�}t
||�y)N)rrrrr;)r?r;rrrrr)rrrrrrr)rrr �c1�aux1�aux2�c2s       r$�
test_manywayszTestSetOps.test_manywaysjsW���H�H�_�%���H�H�*�+��
�a��^���1�a� ���q�!�}��
�t�T�
"���2�r�"r&)0r/r0r1r%r6rIrPrRrZr��mark�parametrizerrr��nanr�r�rfr�r�r�rjr�r�r�r�r�r�r�r��uint8�uint16�uint64r�r�r�r�r�r�r�r�r�r�r�r�r�rr2r&r$rrsO��4�$
+�%'�N1�0
"�J�&�[�[���=�
����)�2�8�8�	,�	
�	���	�	�
����)�2�8�8�	,�	����)�2�:�:�	.�	
�	�	�
����,�b�g�g�	.�	���	���	�	�%@��.
&�/�.
&��[�[���%�
�"�(�(�9�B�H�H�
-�
�
�
�"�(�(�<�r�x�x�
0�
2��"�(�(�9�B�J�J�
/�
�"�(�(�A�3�b�j�j�
)�
�
�"�(�(�9�B�J�J�
/�
1��"�(�(�9�B�H�H�
-�
�
�
�"�(�(�<�r�x�x�
0�
2��"�(�(�9�B�H�H�
-�
�
�
�"�(�(�=����
1�
3�	
��*.�+�*.��[�[���V�%<�=�78�>�78�r�[�[���V�%<�=�;<�>�;<�z"��[�[���V�%<�=�G�>�G�("� �[�[���V�%<�=�?�>�?��[�[���V�d�F�^�4�M�5�M�%��[�[����
�W�W�b�h�h��
�X�X�r�w�w��
�X�X�r�y�y�!�
�Y�Y����!�
�X�X�r�x�x� �
�X�X�r�x�x� �
�Y�Y����!�	
���[�[���V�%<�=�D�>��D�*�[�[���V�����%��!����3�����&�(�#�2�8�8�4�&���[�[���V�%<�=�	0�>�	�
	0��[�[���V�%<�=�
@�>�
@�-�-�-�-�8�B =�D0�$8�$'�=�
#r&rc���eZdZd�Zd�Zd�Zd�Zejjdddg�d��Z
ejjdgd	��d
��Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zy)�
TestUniquec	��d�}gd�dz}gd�}gd�}gd�dz}tjgd�d�}g}|jtjd�|jtjd	�|j	d
�|j	d�|D];}tj
||�}	tj
||�}
||	|
||||��=d}tjt|�|�}	||	ddtjt|�|�}
||
dd||	|
||||�d
d
g}tj
tt||��|�}	tj
tt||��|�}
||	|
||||�gd�}	ttj|	�ddg�gd�}gd�}ddgddgddgg}t|�}
t|
|�t|d��\}}t||�t||�tjjd�}d|d<tj|d��\}}t|tjd��g}tj|d��d}tj|d��d}tj|dd��dd\}}t|j tj"�t|j tj"�t|j tj"�t|j tj"�dtj$dtj$g}ddtj$g}gd�}gd �}gd!�}ttj|�|�ttj|d��||f�ttj|d��||f�ttj|d�"�||f�d#tj$d$t'd%tj$�t'dtj$�g}d$d#t'd%tj$�g}gd&�}gd'�}gd(�}ttj|�|�ttj|d��||f�ttj|d��||f�ttj|d�"�||f�tj(d)�}tj(d*�|tj(d+�|g}tj(d+�tj(d*�|g}gd�}gd �}gd!�}ttj|�|�ttj|d��||f�ttj|d��||f�ttj|d�"�||f�tj*d)�}tj*dd,�|tj*dd-�|g}tj*dd-�tj*dd,�|g}gd�}gd �}gd!�}ttj|�|�ttj|d��||f�ttj|d��||f�ttj|d�"�||f�tj$gd.z}tj$g}dg}gd/�}d.g}ttj|�|�ttj|d��||f�ttj|d��||f�ttj|d�"�||f�y)0Nc�>�d}|jd|�}t|�}t|||�|jd|�}t|ddd�\}}	t|||�t|	||�|jd|�}t|ddd�\}}	t|||�t|	||�|jd|�}t|ddd�\}}	t|||�t|	||�|jd|�}t|ddd�\}}
}t|||�t|
||�t|||�|jd	|�}t|ddd�\}}
}t|||�t|
||�t|||�|jd
|�}t|ddd�\}}
}t|||�t|
||�t|||�|jd|�}t|ddd�\}}
}}t|||�t|
||�t|||�t|||�y)Nzcheck {0} failed for type {1}�values�return_indexTF�return_inverse�
return_countszreturn_index and return_inversezreturn_index and return_countsz return_inverse and return_countsz.return_index, return_inverse and return_counts)r`rr)
rr rBrCr"r��base_msgre�v�j�j1�j2�j3s
             r$�	check_allz,TestUnique.test_unique_1d.<locals>.check_allys ��6�H��/�/�(�B�/�C��q�	�A��q�!�S�)��/�/�.�"�5�C��!�T�5�%�0�D�A�q��q�!�S�)��q�"�c�*��/�/�"2�B�7�C��!�U�D�%�0�D�A�q��q�!�S�)��q�"�c�*��/�/�/�2�6�C��!�U�E�4�0�D�A�q��q�!�S�)��q�!�S�)��/�/�"C�R�H�C��q�$��e�4�I�A�r�2��q�!�S�)��r�2�s�+��r�2�s�+��/�/�"B�B�G�C��q�$��t�4�I�A�r�2��q�!�S�)��r�2�s�+��r�1�c�*��/�/�"D�b�I�C��q�%��t�4�I�A�r�2��q�!�S�)��r�2�s�+��r�1�c�*��/�/�$7�9;�=�C�"�1�d�D�$�7�M�A�r�2�r��q�!�S�)��r�2�s�+��r�2�s�+��r�1�c�*r&)rrrrrrrr=)rrrr)rrrr)rrrrrrr)rrrrr��AllFloat�
datetime64[D]�timedelta64[D]�O)��i)��?��?�rrr)�rrrr�r4rrrT�rrr.)r
)r
rg@r\)rrr)rrrr)rrr)ry@�y�?�?�)rrr)rrrrr)rrr�natz
2020-12-26z
2020-12-24�D�hrr�)r�multiply�extendr�rcr�empty�len�list�ziprr�char�	chararray�zerosrr,�intpr�complex�
datetime64�timedelta64)rrrr rBrCr"�typesr��aa�bb�unq�inv�a1�a2�a2_inv�a1_idx�a3_idx�a3_inv�ua�ua_idx�ua_inv�ua_cntr"�all_nanss                         r$�test_unique_1dzTestUnique.test_unique_1dws��.	+�`
"�"�$����
��
"�2�
%���K�K��b�)����
���R�\�\�,�/�0�
���R�\�\�*�-�.�
���_�%�
���%�&��	-�B����!�R��B����!�R��B��b�"�b�"�a��,�	-���
�X�X�c�!�f�b�
!����1��
�X�X�c�!�f�b�
!����1���"�b�"�b�!�R�(���
#��
�X�X�d�3�q�!�9�o�r�
*��
�X�X�d�3�q�!�9�o�r�
*���"�b�"�b�!�R�(�$���2�9�9�R�=�8�X�*>�?�
%�����1�v��1�v��1�v�&��
�A�Y���2�s�#��A�d�3�
��F��2�s�#��6�3�'�
�G�G���a� ����#���Y�Y�q��6�
��F��6�2�8�8�A�;�/�
�����1�4�0��3�����1�T�2�1�5�����1�4�26�8�89��<�����V�\�\�2�7�7�+��V�\�\�2�7�7�+��V�\�\�2�7�7�+��V�\�\�2�7�7�+��"�&�&�#�r�v�v�&���3����
���������R�Y�Y�q�\�2�&��R�Y�Y�q�t�4�r�6�l�C��R�Y�Y�q��6��V��E��R�Y�Y�q��5��F�|�D��R�V�V�V�W�S�"�&�&�%9�7�3����;O�P���f�g�c�2�6�6�2�
3���� �����R�Y�Y�q�\�2�&��R�Y�Y�q�t�4�r�6�l�C��R�Y�Y�q��6��V��E��R�Y�Y�q��5��F�|�D��m�m�E�"��
�]�]�<�
(�#�r�}�}�\�/J�C�P���m�m�L�)�2�=�=��+F��
L���������R�Y�Y�q�\�2�&��R�Y�Y�q�t�4�r�6�l�C��R�Y�Y�q��6��V��E��R�Y�Y�q��5��F�|�D��n�n�U�#��
�^�^�A�s�
#�S�"�.�.��C�*@�#�F���n�n�Q��$�b�n�n�Q��&<�c�
B���������R�Y�Y�q�\�2�&��R�Y�Y�q�t�4�r�6�l�C��R�Y�Y�q��6��V��E��R�Y�Y�q��5��F�|�D��F�F�8�a�<���f�f�X�����������R�Y�Y�x�(�"�-��R�Y�Y�x�d�;�b�&�\�J��R�Y�Y�x��=��F�|�L��R�Y�Y�x�t�<�r�6�l�Kr&c�<�tt|jt�tt|jdtfdtfg�tt
ttjd�d��tt
ttjd�d��y)Nrr r=r��axis���)	r
ra�_run_axis_testsr�r�r
rrr+)rs r$�test_unique_axis_errorsz"TestUnique.test_unique_axis_errors sd���i��!5�!5�v�>��i��!5�!5��S�z�C��=�1�	3�	�i�����2��Q�?��i�����2��R�@r&c���d}gd�gd�g}tj|�}tt|d��t|d��|�tt|d��t|d��|�y)NzUnique failed on list of lists�rrrrrDr)rrprr)rre�inp�inp_arrs    r$�test_unique_axis_listz TestUnique.test_unique_axis_list(sR��.���)�$���*�*�S�/���6�#�A�.��w�Q�0G��M��6�#�A�.��w�Q�0G��Mr&c�,�g}|jtjd�|jtjd�|jd�|jd�|jdtfdtfg�|jdtfdt
fg�|D]}|j
|��d}tjdtj�	�jd
d�jt�}tjdd
gd
d
ggt�	�}tt|d��||�d}tjddgddgddgddgg�}tjddgg�}tt|d��||�y)Nr�rrrrr z&Non-bitwise-equal booleans test failedr=r[rVrFTrrDz"Negative zero equality test failedg�r!)r&rr�rcr��floatrGr+rr��viewr�rrr)rr2r,rer�r�s      r$�test_unique_axiszTestUnique.test_unique_axis/sO����
���R�\�\�,�/�0�
���R�\�\�*�-�.�
���_�%�
���%�&�
���s�C�j�3��*�-�.�
���s�C�j�3��,�/�0��	(�E�� � ��'�	(�7���y�y��2�8�8�,�4�4�R��;�@�@��F�����E�4�=�4��,�7�t�D���6�$�Q�/���=�2���x�x�$���s�D�k�D�#�;��d��L�M�����D�#�;�-�(���6�$�Q�/���=r&rErrVc�h�tjgd��}t||��}t|gd��y)N)rrrrrrrrrDr8�rrrr)rrErx�uniqs    r$�test_unique_1d_with_axisz#TestUnique.test_unique_1d_with_axisEs'���H�H�-�.���a�d�#���4��.r&)NrrVc���tjgd�gd�gd�gd�g�}t|d|��\}}t|j|�|jnd�t|tj|||���y)N)rrr)rrrT)rrErrD)rrrr�ndimr�take)rrErxrTr6s     r$�test_unique_inverse_with_axisz(TestUnique.test_unique_inverse_with_axisKsZ���H�H�i��I�y�A�B���1�T��=�	��c��S�X�X���q�v�v�1�=��1�b�g�g�d�C�d�;�<r&c��tjdtj��}t|dddd��\}}}}t	|j
|j
�t
|tjd���t
|tjdg��t
|tjddg��t
|tjdg��t|d	ddd��\}}}}t	|j
|j
�t
|tjd���t
|tjg��t
|tjg��t
|tjg��d
}tj|��}tt|��D]K}t|�}	||dk(rd|	|<nd	|	|<t
t||��tj|	����My)N)rr)rAr,rT�rEr
rr)rr)rArr)rrrrrrrrD)rr'r�rrr,rr�ranger(r))
r�single_zerorT�idxr6�cntrA�multiple_zerosrE�expected_shapes
          r$�test_unique_axis_zerosz!TestUnique.test_unique_axis_zerosRs����h�h�V�2�7�7�;��$�[�q�t�48��N���c�3��	�T�Z�Z��!2�!2�3��4�����!7�8��3����!��
�.��3����!�Q�� 0�1��3����!��
�.�%�[�q�t�48��N���c�3��	�T�Z�Z��!2�!2�3��4�����!7�8��3������-��3������-��3������-�&������.���#�e�*�%�	?�D�!�%�[�N��T�{�a��'(��t�$�'(��t�$��v�n�4�@�!�x�x�n�=�
?�	?r&c�`�tjgd�d��}tjj|d�}tj|�}tj|dd��\}}}d}t|j|j|�t|j|j|�y)N)�@rrrr�?rerrrrrrrerrr[rT)r
rz6Unique returned different results when asked for index)rr�ma�masked_equalrrr��mask)rrxryr�v2rr"res        r$�test_unique_maskedzTestUnique.test_unique_maskedvs~���H�H�F�"�
$���E�E���q�!�$���I�I�a�L���9�9�Q�T��F���A�q�F���1�6�6�2�7�7�C�0��1�6�6�2�7�7�C�0r&c��d}dD]C}tjdgdgg|�}tj|d��}t||||z��Ey)Nz*sort order incorrect for integer type '%s'�bhilqrVrrDrS)r�fmtr�rr s     r$� test_unique_sort_order_with_axisz+TestUnique.test_unique_sort_order_with_axis�sP��;���	/�B����2�$����b�)�A��	�	�!�!�$�A��q�!�S�2�X�.�	/r&c��tjgd�gd�gd�gd�g�j|�}d}tjddg�}tt	|�|j|�|�d}tjgd�gd�g�}tt	|d��|j|�|�d}tjgd	�gd
�gd	�gd
�g�}tt	|d��|j|�|�d}tjddgddggddgddggg�j|�}tj
|ddgd��}tt	|d��||�t	|dd
d
d
��\}}}}	d}t||||�d}ttj
||d��|�d}t|	tjddg�|�t	|dd
d
d
��\}}}}	d}t|dd�|f|�d}ttj
||d��|�d}t|	tjgd��|�y)N)rrrr)rrrrz&Unique with 1d array and axis=0 failedrrz&Unique with 2d array and axis=0 failedrDz&Unique with 2d array and axis=1 failed)rrrrJz&Unique with 3d array and axis=2 failedrTr[z-Unique's return_index=True failed with axis=0z/Unique's return_inverse=True failed with axis=0z.Unique's return_counts=True failed with axis=0z-Unique's return_index=True failed with axis=1z/Unique's return_inverse=True failed with axis=1z.Unique's return_counts=True failed with axis=1)rrr)rrr�rrrX)
rr,r�rer��data3drTr^r6r_s
          r$rGzTestUnique._run_axis_tests�s���x�x��%�%�%�'�(�)/��u�
�	
�
7�����1�a�&�!���6�$�<����u�)=�s�C�6�����<��6�7���6�$�Q�/����u�1E�s�K�6�����9�i��I�F�G���6�$�Q�/����u�1E�s�K�6�����Q��F���F�$���F���F�$�%�&�'-�f�U�m�	�����!�Q��a�0���6�&�q�1�6�3�?�$�T���48��N���c�3��=���4��9�d�C�0�?���2�7�7�4��1�5�t�<�>���3����!�Q�� 0�#�6�$�T���48��N���c�3��=���4��3��<��.�?���2�7�7�4��1�5�t�<�>���3����� 3�S�9r&c	���tjddtjtjtjg�}tj|�}tj|d��}t	|tjdtjg��t	|tjdtjtjtjg��y)NrF��	equal_nan)rrrrr)rrr5�not_unqs    r$�test_unique_nanequalsz TestUnique.test_unique_nanequals�s����H�H�a��B�F�F�B�F�F�B�F�F�3�4���i�i��l���)�)�A��/���3����!�R�V�V�� 5�6��7�B�H�H�a����������-H�$I�Jr&c�`�tjtjdddddtjddg	�}tj|�tj|d��ftj
|�tj|dd��ftj|�tj|dd�	�ftj|�tj|dddd�
�ffD]>\}}t|�t|�k(sJ�t||�D]\}}t||���@y)NrrrrFrrT)rrs)rrs)r
rrrs)rrr�
unique_valuesr�
unique_counts�unique_inverse�
unique_allr(r*r)r�arr�res_unique_array_api�
res_uniquerirds      r$�test_unique_array_api_functionsz*TestUnique.test_unique_array_api_functions�s���h�h�����1�a��A�r�v�v�q�!�<�=��� � ��%��	�	�#��/�
�
� � ��%��	�	�#�T�U�C�
�
�!�!�#�&��	�	�#�d�e�D�
�
�
�
�c�"��	�	��!%�#'�"&�#��	
�1
�	5�,� �*�0�+�,��J��?�?�?�$'�(<�j�$I�
5� ���"�6�8�4�
5�3	5r&c��tjgd�gd�g�}tj|d��\}}|j|j�}tj
tjfD]Y}||�}t||j�t||j�t||j|j��[y)Nr4)rrrTr )
rrrr�rAryrzrr�inverse_indices)rr{�expected_values�expected_inverse�funcr�s      r$�test_unique_inverse_shapez$TestUnique.test_unique_inverse_shape�s����h�h�	�9�-�.��,.�I�I�c�$�,O�)��)�+�3�3�C�I�I�>���%�%�r�}�}�4�	K�D��#�Y�F����
�
�>��/��1G�1G�H��s�F�M�M�&�2H�2H�$I�J�		Kr&N)r/r0r1rBrHrMrQr�rrrUrYrbrjrnrGrur~r�r2r&r$r	r	us���gL�RA�N�>�,�[�[���V�a��W�-�/�.�/�
�[�[���V�]�3�=�4�=�"?�H1�/�*:�XK�5�>	Kr&r	)�__doc__�numpyrrrrrrrr	�numpy.exceptionsr
�
numpy.testingrrr
rr�rr	r2r&r$�<module>r�sK�������'�?�?�
�c	#�c	#�LsK�sKr&

Youez - 2016 - github.com/yon3zu
LinuXploit