a
    �ù»jR  ã                   @   sd   d dl Zd dlmZ d dlmZmZ d dlmZ dd„ Z	dd„ Z
d	d
„ Zdd„ Zdd„ Zdd„ ZdS )é    N)Úassert_array_equal)Úattach_uniqueÚcached_unique)Úcheck_arrayc                  C   s@   t  g d¢¡} t| ƒ}t|jjd t  g d¢¡ƒ t|| ƒ d S )N©é   é   r   é   é   r
   é   Úunique©r   r   r	   r
   r   )ÚnpÚarrayr   r   ÚdtypeÚmetadata©ÚarrZarr_© r   úEE:\soccer\ml_env\Lib\site-packages\sklearn/utils/tests/test_unique.pyÚ+test_attach_unique_attaches_unique_to_array   s    r   c                  C   sL   t jt jdt  ddg¡id�} t jg d¢| d�}tt|ƒt  ddg¡ƒ d S )Nr   r   r   )r   r   )r   )r   r   Zfloat64r   r   r   )Zmy_dtyper   r   r   r   Ú(test_cached_unique_returns_cached_unique   s    r   c                  C   s    g d¢} t | ƒ}|| u sJ ‚dS )z8Test that when not np.ndarray, we don't touch the array.r   N)r   r   r   r   r   Útest_attach_unique_not_ndarray   s    r   c                  C   s(   t  g d¢¡} t| ƒ}|j| u s$J ‚dS )z4Test that attach_unique returns a view of the array.r   N)r   r   r   Úbaser   r   r   r   Útest_attach_unique_returns_view   s    r   c                  C   sp   t  g d¢¡} t| dd�}t|tƒs(J ‚t|ƒdks8J ‚t|d | ƒ t| dd�}t|t jƒsbJ ‚t|| ƒ dS )z+Test return_tuple argument of the function.r   T)Zreturn_tupler   r   FN)r   r   r   Ú
isinstanceÚtupleÚlenr   Zndarray)r   Z	arr_tupleZ
arr_singler   r   r   Útest_attach_unique_return_tuple#   s    r   c                  C   sJ   t  g d¢g¡} t| ƒ}t|ƒ}t|jjd t  g d¢¡ƒ t|| ƒ dS )z0Test that check_array keeps the unique metadata.r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   Útest_check_array_keeps_unique0   s
    r   )Únumpyr   Znumpy.testingr   Zsklearn.utils._uniquer   r   Zsklearn.utils.validationr   r   r   r   r   r   r   r   r   r   r   Ú<module>   s   