
    h$,fZ                        d dl Zd dlZd dlmZ d dlmZmZmZ ej                  j                  dedgedgedgf      d        Zd Zej                  j                  d	i ej                  fd
 ej                   ej                        j"                  iej                  fd
 ej                   ej                        j"                  dz   iej$                  fg      d        Zej                  j                  d	d ej(                  ddgej$                        iej$                  fd ej(                  ddgej                         ej(                  ddgej$                        fiej$                  fd ej(                  ddgej                         ej(                  ddgej                        fiej                  fd ej(                  ddgej*                        iej                  f ej(                  ddgej                         ej                   ej                        j"                  dz   dej$                  fg      d        Zej                  j                  d	 ej(                  g ej$                         ej(                  g ej$                        fddej                  f ej(                  dgej$                        ddej                  f ej(                   ej                   ej                        j"                  dz   gej.                        ddej$                  f ej(                  dgej                        d ej                   ej                        j"                  dz   dej$                  f ej(                   ej                   ej                        j"                  dz   gej.                        dddej$                  fg      d        Zej                  j                  dd
 ej                   ej$                        j"                  dz   iedfd ej(                  ddgej4                        iedfdddgiedfg      d        Zy)    N)assert_array_equal)_object_dtype_isnan _smallest_admissible_index_dtypedelayedz
dtype, val   ac                     t        j                  |t         j                  gt         j                  |gg|       }t        j                  ddgddgg      }t        |      }t	        ||       y )NdtypeFT)nparraynanr   r   )r   valXexpected_maskmasks        >lib/python3.12/site-packages/sklearn/utils/tests/test_fixes.pytest_object_dtype_isnanr      sV    
3-"&&#/u=AHHudmdE];<Mq!Dt]+    c                      d } d}t        j                  t        |      5  t        |        ddd       y# 1 sw Y   yxY w)zKCheck that we issue the FutureWarning regarding the deprecation of delayed.c                     | S )N )xs    r   funcz&test_delayed_deprecation.<locals>.func   s    r   z@The function `delayed` has been moved from `sklearn.utils.fixes`matchN)pytestwarnsFutureWarningr   )r   warn_msgs     r   test_delayed_deprecationr!      s9     RH	m8	4   s   6?zparams, expected_dtypemaxvalc                 $    t        di | |k(  sJ y)zlCheck the behaviour of `smallest_admissible_index_dtype` depending only on the
    `max_val` parameter.
    Nr   r   paramsexpected_dtypes     r   ,test_smallest_admissible_index_dtype_max_valr(   '   s     ,5f5GGGr   arrays   r
   )r)   r"   c                 $    t        di | |k(  sJ y)zCheck the behaviour of `smallest_admissible_index_dtype` using the passed
    arrays but without checking the contents of the arrays.
    Nr   r$   r%   s     r   >test_smallest_admissible_index_dtype_without_checking_contentsr,   6   s    \ ,5f5GGGr   T)r)   check_contents)r)   r-   r"   c                 $    t        di | |k(  sJ y)zyCheck the behaviour of `smallest_admissible_index_dtype` using the dtype of the
    arrays but as well the contents.
    Nr   r$   r%   s     r   9test_smallest_admissible_index_dtype_by_checking_contentsr/   g   s    h ,5f5GGGr   zparams, err_type, err_msgz)is to large to be represented as np.int64z$Array dtype float64 is not supportedz#Arrays should be of type np.ndarrayc                 r    t        j                  ||      5  t        di |  ddd       y# 1 sw Y   yxY w)z-Check that we raise the proper error message.r   Nr   )r   raisesr   )r&   err_typeerr_msgs      r   *test_smallest_admissible_index_dtype_errorr4      s2    $ 
xw	/ 3(2623 3 3s   -6)numpyr   r   sklearn.utils._testingr   sklearn.utils.fixesr   r   r   markparametrizeobjectfloatr   r!   int32iinfomaxint64r(   r   int8r,   uint32r/   
ValueErrorfloat64	TypeErrorr4   r   r   r   <module>rE      s[     5  fc]UAJ'OP, Q, 	RXX
HBHHRXX&**	+RXX6
HBHHRXX&**Q.	/:HH  HBHHaV2884	5rxx@
 BHHaV2884BHHaV2884 HH	
 BHHaV2884BHHaV2884 HH	
 HBHHaV2773	4bhh?
 #"((Aq6:""((288,0014 HH	
;$'PHQ'PH 
 $288Bbhh7"BHH9UV"& HH	
  rxx2884MHH	
 #"((HBHHRXX$6$:$:Q$>#?ryyQ"& HH	
 #"((A3bhh7"&""((288,0014
 HH	
 #"((HBHHRXX$6$:$:Q$>#?ryyQ"&
 HH	
I,/`Ha/`H  xrxx)--127	
 xrxxAbjj9:2	

 QF	Y(MN 3! 3r   