o
    ?Hh                     @   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arrarr_ r   _/home/air/sanwanet/gpt-api/venv/lib/python3.10/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   float64r   r   r   )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sJ t|d |  t| dd}t|t js1J t||  dS )z+Test return_tuple argument of the function.r   T)return_tupler   r   FN)r   r   r   
isinstancetuplelenr   ndarray)r   	arr_tuple
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   numpy.testingr   sklearn.utils._uniquer   r   sklearn.utils.validationr   r   r   r   r   r%   r&   r   r   r   r   <module>   s    