a
    h                     @   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   [/var/www/html/assistant/venv/lib/python3.9/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   