
    -i_                     h   S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	  S SK
Jr  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SKJr  S SKJrJ r J!r!  S SK"J#r#  S	 r$\RJ                  RM                  S
\ 5      S 5       r'S r(S r)S r*S r+S r,S r-S r. " S S5      r/ " S S5      r0 " S S5      r1\S 5       r2S r3S r4S r5\S 5       r6\\RJ                  RM                  S\3\4/S/S /S!.S"4\3\4/S#S$/S%.S&4/5      S' 5       5       r7\\RJ                  RM                  S(\Rp                  " \3\4/S)S/0S*S*S+S,9\Rp                  " \3\4/S-S.0S*S*S/S,9\Rp                  " \3\4\5/S)S/0S0S*S1S,9\Rp                  " \3\4\5/S)S /0S2S*S3S,9\Rp                  " \4\5/S)S4/0S5S*S6S,9\Rp                  " \3\4/S.S /S!.S*S7S8S,9/5      S9 5       5       r9S: r:S; r;S< r<\S= 5       r=\S> 5       r> " S? S@5      r?SlSA jr@SB rASC rB\RJ                  RM                  SDSE\C4SF\D4SG\R                  4SH\R                  4/\G" SISJ/\!5      Q\G" SKSL/\ 5      QSMSN 4PSOSP 4PSQSR 4PSSST 4PSUSV 4PSWSX 4PSYSZ 4PS[\H4P5      \RJ                  RM                  S\\R                  \R                  4\R                  \R                  4\R                  \R                  4\R                  \R                  4/5      S] 5       5       rOS^ rPS_ rQS` rRSa rSSb rT\RJ                  R                  \ScSd9Se 5       rV\RJ                  RM                  SfSISK\Rp                  " SJ5      \Rp                  " SL5      /5      Sg 5       rWSh rX\RJ                  RM                  Si\" 5       5      Sj 5       rY\RJ                  RM                  Si\" 5       5      Sk 5       rZg)m    N)sparse)LinearDiscriminantAnalysis)DecisionTreeClassifier)
TempMemmap_convert_container_delete_folder_get_warnings_filters_info_listassert_allcloseassert_allclose_dense_sparseassert_docstring_consistency'assert_run_python_script_without_outputcheck_docstring_parameterscreate_memmap_backed_dataignore_warningsraisesset_random_stateskip_if_no_numpydocturn_warnings_into_errors)
deprecated)_IS_WASMCSC_CONTAINERSCSR_CONTAINERS)available_ifc                      [        5       n [        5       n[        U S5        [        US5        UR                  S:X  d   eg )N   )r   r   r   random_state)ldatrees     S/var/www/html/venv/lib/python3.13/site-packages/sklearn/utils/tests/test_testing.pytest_set_random_stater    %   s:    
$
&C!#DS!T1!!!    csr_containerc                    [         R                  " S5      R                  SS5      nSnU " U5      nX4 H>  n[        R                  " [
        US9   [        XDS-  5        S S S 5        [        XD5        M@     [        R                  " [        SS9   [        X5        S S S 5        [        R                  " [         R                  " S5      SS	9R                  5       nU " [         R                  " S
5      5      n[        R                  " [
        SS9   [        Xe5        S S S 5        g ! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g = f)N	   r   zNot equal to tolerance match   zCan only compare two sparse   r   )offsets)   r(   zArrays are not equal)nparangereshapepytestr   AssertionErrorr   
ValueErrorr   diagsonestocsr)r"   xmsgyXABs          r   !test_assert_allclose_dense_sparser:   .   s    
		!Q"A
#CaAV]]>5(E2 6$Q*	  
z)F	G$Q* 
H 	RWWQZ+113Abggfo&A	~-C	D$Q* 
E	D 65 
H	G
 
E	Ds$   D$D5E$
D2	5
E
Ec                  
  ^^ S mS m[         R                  " 5          [         R                  " S5        [        T5        [        T[        S9  S S S 5        [
        R                  " [        5         [        T[        S9" 5         S S S 5        [
        R                  " 5        n [        T[        S9" 5         S S S 5        [        W 5      S:X  d   e[        U S   R                  [        5      (       d   e[        U S   R                  [        5      (       d   e[
        R                  " 5        n [        T[        S9" 5         S S S 5        [        U 5      S:X  d   e[        U S   R                  [        5      (       d   e[         R                  " 5          [         R                  " S5        [        T[        [        4S9  S S S 5        [        UU4S j5       n[        [        [        4S9U4S	 j5       n[        [        S9U4S
 j5       n[        [        S9U4S j5       n[        [        S9U4S j5       n[        [        S9U4S j5       n[         R                  " 5          [         R                  " S5        U" 5         U" 5         U" 5         S S S 5        [
        R                  " [        5         U" 5         S S S 5        [
        R                  " [        5         U" 5         S S S 5        [
        R                  " [        5         U" 5         S S S 5        U4S jnU4S jnU4S jn	U4S jn
U4S jnU4S jn[         R                  " 5          [         R                  " S5        U" 5         U" 5         U	" 5         S S S 5        [
        R                  " [        5         U
" 5         S S S 5        [
        R                  " [        5         U" 5         S S S 5        [
        R                  " [        5         U" 5         S S S 5        [        nSn[
        R                  " [        US9   [        U5      " T5      nU" 5         S S S 5        [
        R                  " [        US9   [        U5      S 5       nS S S 5        g ! , (       d  f       GN)= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GNn= f! , (       d  f       GN= f! , (       d  f       GNH= f! , (       d  f       GN0= f! , (       d  f       GN= f! , (       d  f       GN = f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GNu= f! , (       d  f       GN]= f! , (       d  f       GN-= f! , (       d  f       g = f)Nc                  :    [         R                  " S[        5        g Nzdeprecation warningwarningswarnDeprecationWarning r!   r   _warning_function.test_ignore_warning.<locals>._warning_functionE   s    +-?@r!   c                  f    [         R                  " S[        5        [         R                  " S5        g r=   r>   rB   r!   r   _multiple_warning_function7test_ignore_warning.<locals>._multiple_warning_functionH   s    +-?@+,r!   errorcategoryr'   r   r*   c                  "   > T" 5         T " 5         g NrB   )rF   rC   s   r   decorator_no_warning1test_ignore_warning.<locals>.decorator_no_warningg   s    "$r!   c                     > T " 5         g rL   rB   rF   s   r   decorator_no_warning_multiple:test_ignore_warning.<locals>.decorator_no_warning_multiplel   	    "$r!   c                     > T " 5         g rL   rB   rC   s   r    decorator_no_deprecation_warning=test_ignore_warning.<locals>.decorator_no_deprecation_warningp   	    r!   c                     > T " 5         g rL   rB   rU   s   r   decorator_no_user_warning6test_ignore_warning.<locals>.decorator_no_user_warningt   rX   r!   c                     > T " 5         g rL   rB   rP   s   r   )decorator_no_deprecation_multiple_warningFtest_ignore_warning.<locals>.decorator_no_deprecation_multiple_warningx   rS   r!   c                     > T " 5         g rL   rB   rP   s   r   "decorator_no_user_multiple_warning?test_ignore_warning.<locals>.decorator_no_user_multiple_warning|   rS   r!   c                  \   > [        5          T " 5         S S S 5        g ! , (       d  f       g = frL   )r   rU   s   r   context_manager_no_warning7test_ignore_warning.<locals>.context_manager_no_warning   s     s   
+c                  n   > [        [        [        4S9   T " 5         S S S 5        g ! , (       d  f       g = fNrI   )r   rA   UserWarningrP   s   r   #context_manager_no_warning_multiple@test_ignore_warning.<locals>.context_manager_no_warning_multiple   s$    '9;&GH&( IHHs   &
4c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frf   r   rA   rU   s   r   &context_manager_no_deprecation_warningCtest_ignore_warning.<locals>.context_manager_no_deprecation_warning   s    &89 :99    
.c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frf   r   rg   rU   s   r   context_manager_no_user_warning<test_ignore_warning.<locals>.context_manager_no_user_warning   s    k2 322rn   c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frf   rk   rP   s   r   /context_manager_no_deprecation_multiple_warningLtest_ignore_warning.<locals>.context_manager_no_deprecation_multiple_warning   s    &89&( :99rn   c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frf   rp   rP   s   r   (context_manager_no_user_multiple_warningEtest_ignore_warning.<locals>.context_manager_no_user_multiple_warning   s    k2&( 322rn   zA'obj' should be a callable.+you should use 'category=UserWarning'r%   c                      g rL   rB   rB   r!   r   test!test_ignore_warning.<locals>.test   s    r!   )r?   catch_warningssimplefilterr   rA   r.   warnsrg   FutureWarninglen
isinstancemessager   r0   )recordrM   rQ   rV   rZ   r]   r`   rc   rh   rl   rq   rt   rw   warning_classr&   silence_warnings_funcrz   rF   rC   s                    @@r   test_ignore_warningr   B   s   A-
 
	 	 	"g&)*)4FG	 
# 
(	))K@B 
* 
62]KM 
v;!fQi'');<<<<fQi''5555	62[IK 
v;!fQi'');<<<<		 	 	"g&)5G4UV 
# % % 1;?@% A% 01 2 k* + 01% 2% k*% +% 
	 	 	"g&%'(* 
# 
(	)!# 
*	k	"13 
#	(	)*, 
* )  )) 
	 	 	"g&"$+-.0 
# 
(	)') 
*	k	"79 
#	(	)02 
*  MOE	z	/ / >?P Q 
0 
z	/		'	 
(	 
0	/a 
#	" 
*	) 
 

 
#	"> 
#	" 
*	)	"	"	)	)8 
#	" 
*	)	"	"	)	) 
0	/ 
0	/s   0Q00R!R+R&+R8,S
+SS.?T ,TT$ T6*UUU,0
Q?
R
R#&
R58
S

S
S+.
S= 
T
T!$
T36
U
U
U),
U:c                     X-   nU$ z~Function f

Parameters
----------
a : int
    Parameter a
b : float
    Parameter b

Returns
-------
c : list
    Parameter c
rB   abcs      r   f_okr           	
AHr!   c                     X-   nU$ )z~Function f

Parameters
----------
a : int
    Parameter a
b : float
    Parameter b

Results
-------
c : list
    Parameter c
rB   r   s      r   f_bad_sectionsr      r   r!   c                     X-   nU$ r   rB   )r   r   r   s      r   f_bad_orderr      r   r!   c                     X-   nU$ )zFunction f

Parameters
----------
a : int
    Parameter a
b : int
    Parameter b
c : int
    Parameter c

Returns
-------
d : list
    Parameter c
rB   )r   r   ds      r   f_too_many_param_docstringr      s    " 	
AHr!   c                     X-   nU$ )zdFunction f

Parameters
----------
a : int
    Parameter a

Returns
-------
c : list
    Parameter c
rB   r   s      r   	f_missingr     s     	
AHr!   c                     X-   U-   U-   $ )zFunction f

Parameters
----------
a: int
    Parameter a
b:
    Parameter b
c :
    This is parsed correctly in numpydoc 1.2
d:int
    Parameter d
e
    No typespec is allowed without colon
rB   )r   r   r   r   es        r   f_check_param_definitionr   &  s      519q=r!   c                        \ rS rSrS rS rSrg)Klassi9  c                     g rL   rB   selfr7   r6   s      r   r   Klass.f_missing:  s    r!   c                     g)z|Function f

Parameter
---------
a : int
    Parameter a
b : float
    Parameter b

Results
-------
c : list
    Parameter c
NrB   r   s      r   r   Klass.f_bad_sections=  s     	r!   rB   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__rB   r!   r   r   r   9  s    r!   r   c                   2    \ rS rSrS rS rS rS rS rSr	g)	MockEstiO  c                     g)MockEstimatorNrB   r   s    r   __init__MockEst.__init__P      r!   c                     U$ rL   rB   r   s      r   fitMockEst.fitS      r!   c                     U$ rL   rB   r   r7   s     r   predictMockEst.predictV  r   r!   c                     U$ rL   rB   r   s     r   predict_probaMockEst.predict_probaY  r   r!   c                     g)N      ?rB   r   s     r   scoreMockEst.score\  s    r!   rB   N)
r   r   r   r   r   r   r   r   r   r   rB   r!   r   r   r   O  s    r!   r   c                       \ rS rSrS r\" S 5      S 5       r\" S 5      \" S5      S 5       5       r\" S 5      S	 5       r	\" S
5      S 5       r
Srg)MockMetaEstimatori`  c                     Xl         g)zMetaEstimator to check if doctest on delegated methods work.

Parameters
---------
delegate : estimator
    Delegated estimator.
Ndelegate)r   r   s     r   r   MockMetaEstimator.__init__a  s	     !r!   c                 .    [        U R                  S5      $ )Nr   hasattrr   r   s    r   <lambda>MockMetaEstimator.<lambda>k  s    wt}}i@r!   c                 8    U R                   R                  U5      $ )zcThis is available only if delegate has predict.

Parameters
----------
y : ndarray
    Parameter y
)r   r   r   s     r   r   MockMetaEstimator.predictk  s     }}$$Q''r!   c                 .    [        U R                  S5      $ )Nr   r   r   s    r   r   r   v  s    wt}}g>r!   z%Testing a deprecated delegated methodc                     g)z`This is available only if delegate has score.

Parameters
---------
y : ndarray
    Parameter y
NrB   r   s     r   r   MockMetaEstimator.scorev  r   r!   c                 .    [        U R                  S5      $ )Nr   r   r   s    r   r   r     s    wt}}oFr!   c                     U$ )zhThis is available only if delegate has predict_proba.

Parameters
---------
X : ndarray
    Parameter X
rB   r   s     r   r   MockMetaEstimator.predict_proba  s	     r!   z-Testing deprecated function with wrong paramsc                     g)z,Incorrect docstring but should not be testedNrB   r   s      r   r   MockMetaEstimator.fit  r   r!   r   N)r   r   r   r   r   r   r   r   r   r   r   r   rB   r!   r   r   r   `  s    ! @A( B( >?78 9 @ FG H ?@; A;r!   r   c                     [        [        5      n U / :X  d   e[        [        S/S9n U / :X  d   e[        [        S/S9n U / :X  d   e[        R                  " [
        SS9   [        [        5        S S S 5        [        R                  " [
        SS9   [        [        R                  5        S S S 5        [        [        5      n [        [        5       S9nUR                  R                  nU / SQ:X  d   e/ SQ/ S	Q/ S
Q/ SQSU S3SSSSSS/SU S3SSS/SU S3SSS/SU S3SSSS//n[        U[        [        [        [        R                  UR                   UR"                  UR$                  UR&                  /5       H%  u  pE[        U5      n X@:X  a  M   SU< SU < S35       e   g ! , (       d  f       GN@= f! , (       d  f       GN= f)Nr   )ignorezUnknown section Resultsr%   zUnknown section Parameterr   )zxsklearn.utils.tests.test_testing.f_check_param_definition There was no space between the param name and colon ('a: int')ztsklearn.utils.tests.test_testing.f_check_param_definition There was no space between the param name and colon ('b:')zwsklearn.utils.tests.test_testing.f_check_param_definition There was no space between the param name and colon ('d:int'))z9In function: sklearn.utils.tests.test_testing.f_bad_orderznThere's a parameter name mismatch in function docstring w.r.t. function signature, at index 0 diff: 'b' != 'a'
Full diff:z- ['b', 'a']z+ ['a', 'b'])zHIn function: sklearn.utils.tests.test_testing.f_too_many_param_docstringz_Parameters in function docstring have more items w.r.t. function signature, first extra item: cr   - ['a', 'b']z+ ['a', 'b', 'c']z?          +++++)z7In function: sklearn.utils.tests.test_testing.f_missingzaParameters in function docstring have less items w.r.t. function signature, first missing item: br   r   z+ ['a'])z=In function: sklearn.utils.tests.test_testing.Klass.f_missingaParameters in function docstring have less items w.r.t. function signature, first missing item: Xr   - ['X', 'y']+ []z.In function: sklearn.utils.tests.test_testing.z.predictznThere's a parameter name mismatch in function docstring w.r.t. function signature, at index 0 diff: 'X' != 'y'r   z- ['X']z?   ^z+ ['y']z.predict_probaz&potentially wrong underline length... zParameters z--------- in z.scorez.fitr   r   r   z
"z"
 not in 
"")r   r   r   r.   r   RuntimeErrorr   r   r   r   r   	__class__r   zipr   r   r   r   r   r   )	incorrect	mock_metamock_meta_namemessagesr5   fs         r   test_check_docstring_parametersr     s   *40I??*4>I??*9cUCI??	|+D	E">2 
F	|+F	G"5#7#78 
H ++CDI!795I((11N     		

	
		
		
 =^<LHUC 	
00>/? @ 5	
 =^<LFS4		
 =^<LDQ4 		
INH` &OO##OOMM		
 /q1	LS)!LLO 
F	E	G	Gs   F(F:(
F7:
G	c                     g)zFunction one.

Parameters
----------
a : int,   float
    Parameter a.
    Second    line.

b : str
    Parameter b.

Returns
-------
c : int
   Returning

d : int
   Returning
NrB   r   r   s     r   f_oner     s    ( 	r!   c                     g)zFunction two.

Parameters
----------
a :   int, float
    Parameter a.
      Second line.

b : str
    Parameter bb.

e : int
    Extra parameter.

Returns
-------
c : int
   Returning

d : int
   Returning
NrB   r   s     r   f_twor   (  s    . 	r!   c                     g)zFunction two.

Parameters
----------
a :   int, float
    Parameter a.

b : str
    Parameter B!

e :
    Extra parameter.

Returns
-------
c : int
   Returning.

d : int
   Returning
NrB   r   s     r   f_threer   B  s    , 	r!   c                      [         R                  " [        SS9   [        S[        /5        SSS5        g! , (       d  f       g= f)z1Check error raised when `objects` incorrect type.zAll 'objects' must be one ofr%   stringN)r.   r   	TypeErrorr   r   rB   r!   r   -test_assert_docstring_consistency_object_typer   [  s-     
y(F	G$h%67 
H	G	Gs	   5
Azobjects, kwargs, errorr   r   )include_paramsexclude_paramszThe 'exclude_params' argumentFr   )include_returnsexclude_returnszThe 'exclude_returns' argumentc                     [         R                  " [        US9   [        U 40 UD6  SSS5        g! , (       d  f       g= f)z?Check `assert_docstring_consistency` argument checking correct.r%   N)r.   r   r   r   )objectskwargsrH   s      r   ,test_assert_docstring_consistency_arg_checksr   b  s+    $ 
y	.$W77 
/	.	.s   0
>zobjects, kwargs, error, warnr    
whitespace)idr   Tincl_allzNThe description of Parameter 'a' is inconsistent between \['f_one',\n'f_two'\]z	2-1 groupzYThe description of Parameter 'b' is inconsistent between \['f_one'\] and\n\['f_two'\] andz1-1-1 groupr   zPThe type specification of Parameter 'e' is inconsistent between\n\['f_two'\] andz
empty typez,Checking was skipped for Parameters: \['e'\]z	skip warnc                 8   U(       a/  [         R                  " [        US9   [        U 40 UD6  SSS5        gU(       a/  [         R                  " [
        US9   [        U 40 UD6  SSS5        g[        U 40 UD6  g! , (       d  f       g= f! , (       d  f       g= f)z;Check `assert_docstring_consistency` gives correct results.r%   N)r.   r   r/   r   r~   rg   )r   r   rH   r@   s       r   !test_assert_docstring_consistencyr   x  sr    b ]]>7(;F; 87	\\+T2(;F; 32 	%W77 87 32s   A:B:
B
Bc                     g)zFunction four.

Parameters
----------

labels : array-like, default=None
    The set of labels to include when `average != 'binary'`, and their
    order if `average is None`. Labels present in the data can be excluded.
NrB   labelss    r   f_fourr         	r!   c                     g)zFunction five.

Parameters
----------

labels : array-like, default=None
    The set of labels to include when `average != 'binary'`, and their
    order if `average is None`. This is an extra line. Labels present in the
    data can be excluded.
NrB   r   s    r   f_fiver    s     	r!   c                     g)zFunction six.

Parameters
----------

labels : array-like, default=None
    The group of labels to add when `average != 'binary'`, and the
    order if `average is None`. Labels present on them datas can be excluded.
NrB   r   s    r   f_sixr    r  r!   c                      Sn [         R                  " [        U S9   [        [        [
        [        /SS9  SSS5        g! , (       d  f       g= f)z8Check `assert_docstring_consistency` difference message.a  The description of Parameter 'labels' is inconsistent between
\['f_four'\] and \['f_five'\] and \['f_six'\]:

\*\*\* \['f_four'\]
--- \['f_five'\]
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

\*\*\* 10,25 \*\*\*\*

--- 10,30 ----

  'binary'`, and their order if `average is None`.
\+ This is an extra line.
  Labels present in the data can be excluded.

\*\*\* \['f_four'\]
--- \['f_six'\]
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

\*\*\* 1,25 \*\*\*\*

  The
! set
  of labels to
! include
  when `average != 'binary'`, and
! their
  order if `average is None`. Labels present
! in the data
  can be excluded.
--- 1,25 ----

  The
! group
  of labels to
! add
  when `average != 'binary'`, and
! the
  order if `average is None`. Labels present
! on them datas
  can be excluded.r%   T)r   N)r.   r   r/   r   r  r  r  )r5   s    r   +test_assert_docstring_consistency_error_msgr    s7    (CT 
~S	1$ffe%<TR 
2	1	1s	   ?
Ac            	         Sn [        [        [        [        /SSR	                  U R                  5       5      S9  Sn[        [        [        [        /SSR	                  UR                  5       5      S9  SnSn[        R                  " [        US9   [        [        [        [        /SSR	                  UR                  5       5      S9  S	S	S	5        g	! , (       d  f       g	= f)
zACheck `assert_docstring_consistency` `descr_regex_pattern` works.zThe (set|group) of labels to (include|add) when `average \!\= 'binary'`, and (their|the) order if `average is None`\.[\s\w]*\.* Labels present (on|in) (them|the) datas? can be excluded\.T )r   descr_regex_patternz(labels|average|binary)z#The set of labels to include when.+zCThe description of Parameter 'labels' in \['f_six'\] does not matchr%   N)	r   r  r  r  joinsplitr.   r   r/   )
regex_fullregex_wordsregex_errorr5   s       r   5test_assert_docstring_consistency_descr_regex_patternr    s    
	$  !	HHZ%5%5%78 -K 	HH[%6%6%89 9K
PC	~S	1$VU# #):):)< =	
 
2	1	1s   8C
Cc                        \ rS rSrS rS rSrg)RegistrationCounteri2  c                     SU l         g )Nr   nb_callsr   s    r   r   RegistrationCounter.__init__3  s	    r!   c                 X    U =R                   S-  sl         UR                  [        L d   eg )Nr*   )r  funcr   )r   to_register_funcs     r   __call__RegistrationCounter.__call__6  s$    $$666r!   r  N)r   r   r   r   r   r  r   rB   r!   r   r  r  2  s    7r!   r  c                     [        U[        R                  5      (       d   eUS:g  nUR                  R                  UL d   e[        R
                  R                  X5        g )Nr)r   r+   memmapflags	writeabletestingassert_array_equal)input_array	mmap_data	mmap_moder!  s       r   check_memmapr'  ;  sM    i++++S I??$$	111JJ!!+9r!   c                    [        5       nU R                  [        SU5        [        R                  " S5      n[        U5       n[        X#5        [        R                  R                  UR                  5      nS S S 5        [        R                  S:w  a&  [        R                  R                  W5      (       a   eUR                  S:X  d   eSn[        X%S9 n[        X#US9  [        R                  R                  UR                  5      nS S S 5        [        R                  S:w  a&  [        R                  R                  W5      (       a   eUR                  S:X  d   eg ! , (       d  f       N= f! , (       d  f       Nl= f)Nregisterr   ntr*   r+r&  r'   )r  setattratexitr+   r2   r   r'  ospathdirnamefilenamenameexistsr  )monkeypatchregistration_counterr$  datatemp_folderr&  s         r   test_tempmemmapr9  B  s   .0
,@A''!*K	K	 D['ggoodmm4 
! 
ww$77>>+....((A---I	K	5[)<ggoodmm4 
6 
ww$77>>+....((A--- 
!	  
6	5s   5E 4E1 
E.1
E?c                    [        5       nU R                  [        SU5        [        R                  " S5      n[        U5      n[        X#5        UR                  S:X  d   e[        USS9u  p4[        X#5        U[        R                  R                  UR                  5      :X  d   eUR                  S:X  d   eSn[        X%S9n[        X#U5        UR                  S:X  d   eX"S-   US-   /n[        U5      n[        Xg5       H  u  p#[        X#5        M     UR                  S	:X  d   e[        US
/5      u  p[        X(5        U	S
:X  d   eg )Nr)  r   r*   T)return_folderr'   r+  r,     znot-an-array)r  r-  r.  r+   r2   r   r'  r  r/  r0  r1  r2  r   )
r5  r6  r$  r7  folderr&  
input_listmmap_data_listoutput_dataothers
             r   test_create_memmap_backed_datarB  W  s9   .0
,@A''!*K$[1D#((A---,[MLD#RWW__T]]3333((A---I$[FDI.((A---Qa@J.z:N <[' =((A---2K3PQK*N"""r!   z constructor_name, container_typelisttuplearrayr   
sparse_csrsparse_csr_array
sparse_cscsparse_csc_array	dataframec                  B    [         R                  " S5      R                  $ Npandasr.   importorskip	DataFramerB   r!   r   r   r     s    f11(;EEr!   seriesc                  B    [         R                  " S5      R                  $ rL  r.   rO  SeriesrB   r!   r   r   r     s    6..x8??r!   indexc                  B    [         R                  " S5      R                  $ rL  )r.   rO  IndexrB   r!   r   r   r     s    &--h7==r!   pyarrowc                  B    [         R                  " S5      R                  $ NrX  )r.   rO  TablerB   r!   r   r   r     s    F//	:@@r!   pyarrow_arrayc                  B    [         R                  " S5      R                  $ rZ  )r.   rO  ArrayrB   r!   r   r   r     s    &"5"5i"@"F"Fr!   polarsc                  B    [         R                  " S5      R                  $ Nr_  rN  rB   r!   r   r   r     s    6..x8BBr!   polars_seriesc                  B    [         R                  " S5      R                  $ ra  rS  rB   r!   r   r   r     s    &"5"5h"?"F"Fr!   slicezdtype, superdtypec                 f   U S;   a  U" 5       nSS/n[        UU US9n[        XQ5      (       d   eU S;   a+  [        R                  " [	        US   5      U5      (       d   egU S;   a  g[        US5      (       a  UR                  U:X  d   eg[        US	5      (       a  UR                  S   U:X  d   egg)
zXCheck that we convert the container to the right type of array with the
right data type.)rJ  rU  r_  rb  rX  r\  rQ  r   r*   dtype)rC  rD  rU  )r_  rb  rX  r\  Nrg  dtypes)r   r   r+   
issubdtypetyper   rg  rh  )constructor_namecontainer_typerg  
superdtype	containercontainer_converteds         r   test_convert_containerrp  u  s    L    ()AI,
 )::::55 }}T"5a"89:FFFF	T	T	$g	.	."((E111	$h	/	/"))!,555 
0r!   c                      [         R                  " S5        [        S//SS/S/S9n U R                  R                  S   S:X  d   eg )NrM  r4   rJ  r8   categorical_feature_namesr   rJ   )r.   rO  r   rh  iloc)dfs    r   (test_convert_container_categories_pandasrv    sH    
!	
seu
B 99>>!
***r!   c                      [         R                  " S5      n [        S//SS/S/S9nUR                  S   U R	                  5       :X  d   eg )Nr_  r4   r8   rr  )r.   rO  r   schemaCategorical)plru  s     r   (test_convert_container_categories_polarsr{    sI    			X	&B	cUGXuQTPU	VB99S>R^^----r!   c                      [         R                  " S5      n [        S//SS/S/S9n[        UR                  S   R                  5      U R
                  L d   eg )NrX  r4   r8   rr  r   )r.   rO  r   rj  rx  DictionaryType)paru  s     r   )test_convert_container_categories_pyarrowr    sS    			Y	'B	cUGYRUQV	WB		!!!"b&7&7777r!   c                     [        [        5         [        5       e! , (       d  f       O= f[        [        SS9 n [        S5      e! , (       d  f       O= fW R                  (       d   e[        [        SS/S9 n [        S5      e! , (       d  f       O= fU R                  (       d   e[        R                   " [        SS9   [        [        5       n [	        S5      e! , (       d  f       O= f S S S 5        O! , (       d  f       O= fU R                  (       a   e[        R                   " [
        SS9   [        [        SS9 n [	        5       e! , (       d  f       O= f S S S 5        O! , (       d  f       O= fU R                  (       a   e[        R                   " [        SS9   [        [        SS9 n [	        S5      e! , (       d  f       O= f S S S 5        O! , (       d  f       O= fU R                  (       a   e[        R                   " [
        S	S9   [        [        S
S9 n [        S5      e! , (       d  f       O= f S S S 5        O! , (       d  f       O= fU R                  (       a   e[        R                   " [
        SS9   [        [        S
SS9 n [        S5      e! , (       d  f       O= f S S S 5        O! , (       d  f       O= fU R                  (       a   e[        R                   " [
        SS9   [        [        5       n  S S S 5        O! , (       d  f       O= fS S S 5        O! , (       d  f       O= fU R                  (       a   e[        [        S
SS9 n  S S S 5        O! , (       d  f       O= fU R                  (       a   e[        [        [        45         [        5       e! , (       d  f       O= f[        [        [        45         [	        5       e! , (       d  f       O= f[        R                   " [
        5         [        [        [        45          S S S 5        O! , (       d  f       O= fS S S 5        g ! , (       d  f       g = f)Nzhow are your%   zhello how are youznot this onezthis will be raisedzthe failure message)err_msgzthis is ignoredz,should contain one of the following patternshellozBad message)r&   r  zDid not raiseT)r&   may_pass)r   r   raised_and_matchedr.   r0   r/   )cms    r   test_raisesr    s    
		k 
	 
		/2+,, 
0	/     
	.-!@	AR+,, 
B	A     
z)>	?I"233  
@	?	? $$$$ 
~-B	CI'<=, >== 
D	C	C $$$$ 
z)>	?I%672233 877 
@	?	? $$$$ 
L
 IW-M** .--
 
 

 $$$$ 
~-B	CIW6KLPRM** MLL 
D	C	C $$$$ 
~_	=I"  
>	=	= $$$$ 
	4	8B 
9	8	8$$$$ 
J'	(k 
)	(	J'	(l 
)	(	~	&Y
+, -,, 
'	&	&s!  
)A
A:B
BC:C
C-	)C::
D7E,E
E	E,,
E:)G8G
G	G
G-I+H77
I	I
I KJ++
J9	5K
KL8L	L8
L,	(L88
M+M66
N/N::
O O++
O9Q,P7.	Q7
Q	Q
Qc                  d   [        [        R                  " S/[        R                  S9S5        [        R
                  " [        5         [        [        R                  " S/[        R                  S9S5        S S S 5        [        [        R                  " S/[        R                  S9S5        [        R
                  " [        5         [        [        R                  " S/[        R                  S9S5        S S S 5        [        R
                  " [        5         [        [        R                  " S/[        R                  S9S5        S S S 5        [        [        R                  " S/[        R                  S9SS	S
9  g ! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       N_= f)Ng㈵ ?rf  r   gX ?gc^  ?g55  ?gh㈵>g        gh㈵>)atol)r
   r+   rE  float32r.   r   r/   float64rB   r!   r   "test_float32_aware_assert_allcloser    s    BHHj\<cB	~	&*RZZ@#F 
'
 BHHj\<cB	~	&*RZZ@#F 
' 
~	&$rzz:C@ 
'BHHdV2::6$G 
'	& 
'	& 
'	&s$   	/E>/F/F!>
F
F!
F/zcannot start subprocess)reasonc                     Sn [        U 5        Sn [        R                  " [        SS9   [        U 5        S S S 5        Sn [        R                  " [        SS9   [        U SS9  S S S 5        SR	                  S	S
/5      n [        R                  " [        SS9   [        U SS9  S S S 5        g ! , (       d  f       N|= f! , (       d  f       N_= f! , (       d  f       g = f)Nzx = 1zprint('something to stdout')zExpected no outputr%   z:output was not supposed to match.+got.+something to stdoutz
to.+stdout)pattern
z
import sysz-print('something to stderr', file=sys.stderr)z:output was not supposed to match.+got.+something to stderrz
to.+stderr)r   r.   r   r/   r  )codes    r   ,test_assert_run_python_script_without_outputr  (  s    D+D1)D	~-A	B/5 
C *D	J
 	0lK	
 99l$STUD	J
 	0lK	
 
 
C	B
 

 
s#   B+B<C+
B9<
C

Crk  c                 H    [         R                  " SSSSS9n[        X5        g)zqNon-regression test to check that we can still convert a sparse container
from a given format to another format.

   g?csr)densityformatN)r   randomr   )rk  X_sparses     r   'test_convert_container_sparse_to_sparser  @  s     " }}RS?Hx2r!   c                    U R                   S:X  ab  U(       a[  [        R                  " U R                  U R                  S9   [
        R                  " U R                  U R                  S9  S S S 5        U R                   S:X  a  [
        R                  " SS9 nU R                  nSU;   a  Sn[
        R                  " UU R                  S9  U(       a  [        U5      S	:X  d   e U(       a=  [        US	   R                  5      U:X  d   eUS	   R                  U R                  :X  d   eS S S 5        g g ! , (       d  f       N= f! , (       d  f       g = f)
NrH   r%   )r   rJ   r   T)r   Pyarrowz*
Pyarrow will become a required dependencyr   )
actionr.   r   rJ   r   r?   r@   r|   r   str)warning_infowarnings_as_errorsr   r   s       r   check_warnings_as_errorsr  U  s   g%*<]]<008L8LMMM$,,%.. N
 h&$$D1V"**GG#GMM%.. (:3v;!#@@q6!9,,-888ay))\-B-BBBB 21 ' NM 21s   *D2BE2
E 
Er  c                 \    [         R                  R                  SS5      S:g  n[        XS9  g )NSKLEARN_WARNINGS_AS_ERRORS0r  )r/  environgetr  )r  r  s     r   test_sklearn_warnings_as_errorsr  m  s%    (DcJcQ\Qr!   c                     [         R                  " 5          [        5         [        U SS9  S S S 5        g ! , (       d  f       g = f)NTr  )r?   r|   r   r  )r  s    r   test_turn_warnings_into_errorsr  s  s*    		 	 	"!# $G 
#	"	"s	   4
A)r  )[r.  r/  r?   numpyr+   r.   scipyr   sklearn.discriminant_analysisr   sklearn.treer   sklearn.utils._testingr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   sklearn.utils.deprecationr   sklearn.utils.fixesr   r   r   sklearn.utils.metaestimatorsr   r    markparametrizer:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   paramr   r  r  r  r  r  r  r'  r9  rB  rC  rD  ndarray
csr_matrixr   rd  int32integerint64r  floatingr  rp  rv  r{  r  r  r  xfailr  r  r  r  r  rB   r!   r   <module>r     s7    	     D /    " 1 
 6" .9+ :+&J&&&*"& , ".; .;b |M |M~	.	4	2 8 8  EN #u>+	
 EN %3%@,	
8  8 "EN-u5r2,	
 	eU^&7%>B:VE7#u%) 		
 	E7#u%4 		
 	Gu%# 		
 	EN#u=;	
G*-\	8]- ^	8
		
	 -S -S` "
 "
J7 7:.*#< &		%	"**	6$$%	 
l./	@ 
l./	@ 
EF 
?@ 
=> 
@A 
FG 
BC 
FG  
%!* 	2::	2::	R[[!	R[[!	&6+<&6R+.8CLH$ 8$=>L ?L. 	
 		
	33C0 )H)JKR LR
 )H)JKH LHr!   