
    Mpjn                     p   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!J"r"J#r#  S SK$J%r%  S	 r&\RN                  RQ                  S
\ 5      S 5       r)S r*S r+S r,S r-S r.S r/S r0 " S S5      r1 " S S5      r2 " S S5      r3\S 5       r4S r5S r6S r7\S 5       r8\\RN                  RQ                  S\5\6/S/S /S!.S"4\5\6/S#S$/S%.S&4/5      S' 5       5       r9\\RN                  RQ                  S(\Rt                  " \5\6/S)S/0S*S*S+S,9\Rt                  " \5\6/S-S.0S*S*S/S,9\Rt                  " \5\6\7/S)S/0S0S*S1S,9\Rt                  " \5\6\7/S)S /0S2S*S3S,9\Rt                  " \6\7/S)S4/0S5S*S6S,9\Rt                  " \5\6/S.S /S!.S*S7S8S,9/5      S9 5       5       r;S: r<S; r=S< r>\S= 5       r?\S> 5       r@ " S? S@5      rASlSA jrBSB rCSC rD\RN                  RQ                  SDSE\E4SF\F4SG\R                  4SH\R                  4/\I" SISJ/\!5      Q\I" 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[\J4P5      \RN                  RQ                  S\\R                  \R                  4\R                  \R                  4\R                  \R                  4\R                  \R                  4/5      S] 5       5       rQS^ rRS_ rSS` rTSa rUSb rV\RN                  R                  \ScSd9Se 5       rX\RN                  RQ                  SfSISK\Rt                  " SJ5      \Rt                  " SL5      /5      Sg 5       rYSh rZ\RN                  RQ                  Si\" 5       5      Sj 5       r[\RN                  RQ                  Si\" 5       5      Sk 5       r\g)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_sparse_diags_array_sparse_random_array)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     \/var/www/html/pdf-tiff/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                  " S5      SS	S
9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   csr)offsetsformat)   r*   zArrays are not equal)
nparangereshapepytestr   AssertionErrorr   
ValueErrorr   ones)r$   xmsgyXABs          r!   !test_assert_allclose_dense_sparser<   0   s    
		!Q"A
#CaAV]]>5(E2 6$Q*	  
z)F	G$Q* 
H 	BGGAJ%@Abggfo&A	~-C	D$Q* 
E	D 65 
H	G
 
E	Ds$   DD7D.
D	
D+.
D<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_functionG   s    +-?@r#   c                  f    [         R                  " S[        5        [         R                  " S5        g r?   r@   rD   r#   r!   _multiple_warning_function7test_ignore_warning.<locals>._multiple_warning_functionJ   s    +-?@+,r#   errorcategoryr)   r   r.   c                  "   > T" 5         T " 5         g NrD   )rH   rE   s   r!   decorator_no_warning1test_ignore_warning.<locals>.decorator_no_warningi   s    "$r#   c                     > T " 5         g rN   rD   rH   s   r!   decorator_no_warning_multiple:test_ignore_warning.<locals>.decorator_no_warning_multiplen   	    "$r#   c                     > T " 5         g rN   rD   rE   s   r!    decorator_no_deprecation_warning=test_ignore_warning.<locals>.decorator_no_deprecation_warningr   	    r#   c                     > T " 5         g rN   rD   rW   s   r!   decorator_no_user_warning6test_ignore_warning.<locals>.decorator_no_user_warningv   rZ   r#   c                     > T " 5         g rN   rD   rR   s   r!   )decorator_no_deprecation_multiple_warningFtest_ignore_warning.<locals>.decorator_no_deprecation_multiple_warningz   rU   r#   c                     > T " 5         g rN   rD   rR   s   r!   "decorator_no_user_multiple_warning?test_ignore_warning.<locals>.decorator_no_user_multiple_warning~   rU   r#   c                  \   > [        5          T " 5         S S S 5        g ! , (       d  f       g = frN   )r   rW   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NrK   )r   rC   UserWarningrR   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rh   r   rC   rW   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rh   r   ri   rW   s   r!   context_manager_no_user_warning<test_ignore_warning.<locals>.context_manager_no_user_warning   s    k2 322rp   c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frh   rm   rR   s   r!   /context_manager_no_deprecation_multiple_warningLtest_ignore_warning.<locals>.context_manager_no_deprecation_multiple_warning   s    &89&( :99rp   c                  b   > [        [        S9   T " 5         S S S 5        g ! , (       d  f       g = frh   rr   rR   s   r!   (context_manager_no_user_multiple_warningEtest_ignore_warning.<locals>.context_manager_no_user_multiple_warning   s    k2&( 322rp   zA'obj' should be a callable.+you should use 'category=UserWarning'r'   c                      g rN   rD   rD   r#   r!   test!test_ignore_warning.<locals>.test   s    r#   )rA   catch_warningssimplefilterr   rC   r2   warnsri   FutureWarninglen
isinstancemessager   r4   )recordrO   rS   rX   r\   r_   rb   re   rj   rn   rs   rv   ry   warning_classr(   silence_warnings_funcr|   rH   rE   s                    @@r!   test_ignore_warningr   D   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
rD   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
rD   r   s      r!   f_bad_sectionsr      r   r#   c                     X-   nU$ r   rD   )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
rD   )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
rD   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
rD   )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)Klassi;  c                     g rN   rD   selfr9   r8   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
NrD   r   s      r!   r   Klass.f_bad_sections?  s     	r#   rD   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__rD   r#   r!   r   r   ;  s    r#   r   c                   2    \ rS rSrS rS rS rS rS rSr	g)	MockEstiQ  c                     g)MockEstimatorNrD   r   s    r!   __init__MockEst.__init__R      r#   c                     U$ rN   rD   r   s      r!   fitMockEst.fitU      r#   c                     U$ rN   rD   r   r9   s     r!   predictMockEst.predictX  r   r#   c                     U$ rN   rD   r   s     r!   predict_probaMockEst.predict_proba[  r   r#   c                     g)N      ?rD   r   s     r!   scoreMockEst.score^  s    r#   rD   N)
r   r   r   r   r   r   r   r   r   r   rD   r#   r!   r   r   Q  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)MockMetaEstimatorib  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__c  s	     !r#   c                 .    [        U R                  S5      $ )Nr   hasattrr   r   s    r!   <lambda>MockMetaEstimator.<lambda>m  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.predictm  s     }}$$Q''r#   c                 .    [        U R                  S5      $ )Nr   r   r   s    r!   r   r   x  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
NrD   r   s     r!   r   MockMetaEstimator.scorex  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
rD   r   s     r!   r   MockMetaEstimator.predict_proba  s	     r#   z-Testing deprecated function with wrong paramsc                     g)z,Incorrect docstring but should not be testedNrD   r   s      r!   r   MockMetaEstimator.fit  r   r#   r   N)r   r   r   r   r   r   r   r   r   r   r   r   rD   r#   r!   r   r   b  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   r2   r   RuntimeErrorr   r   r   r   r   	__class__r   zipr   r   r   r   r   r   )	incorrect	mock_metamock_meta_namemessagesr7   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
NrD   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
NrD   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
NrD   r   s     r!   f_threer   D  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)r2   r   	TypeErrorr   r   rD   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)r2   r   r   r   )objectskwargsrJ   s      r!   ,test_assert_docstring_consistency_arg_checksr   d  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)r2   r   r3   r   r   ri   )r   r   rJ   rB   s       r!   !test_assert_docstring_consistencyr   z  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.
NrD   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.
NrD   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.
NrD   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)r2   r   r3   r   r  r  r  )r7   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splitr2   r   r3   )
regex_fullregex_wordsregex_errorr7   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)RegistrationCounteri4  c                     SU l         g )Nr   nb_callsr   s    r!   r   RegistrationCounter.__init__5  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__8  s$    $$666r#   r  N)r   r   r   r   r   r  r   rD   r#   r!   r  r  4  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/   r5   r   r)  ospathdirnamefilenamenameexistsr  )monkeypatchregistration_counterr&  datatemp_folderr(  s         r!   test_tempmemmapr;  D  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/  r0  r/   r5   r   r)  r  r1  r2  r3  r4  r   )
r7  r8  r&  r9  folderr(  
input_listmmap_data_listoutput_dataothers
             r!   test_create_memmap_backed_datarD  Y  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pandasc                  B    [         R                  " S5      R                  $ NrL  r2   importorskip	DataFramerD   r#   r!   r   r         6..x8BBr#   seriesc                  B    [         R                  " S5      R                  $ rN  r2   rP  SeriesrD   r#   r!   r   r     s    6..x8??r#   indexc                  B    [         R                  " S5      R                  $ rN  )r2   rP  IndexrD   r#   r!   r   r     s    &--h7==r#   pyarrowc                  B    [         R                  " S5      R                  $ NrZ  )r2   rP  TablerD   r#   r!   r   r     s    F//	:@@r#   pyarrow_arrayc                  B    [         R                  " S5      R                  $ r\  )r2   rP  ArrayrD   r#   r!   r   r     s    &"5"5i"@"F"Fr#   polarsc                  B    [         R                  " S5      R                  $ Nra  rO  rD   r#   r!   r   r     rR  r#   polars_seriesc                  B    [         R                  " S5      R                  $ rc  rU  rD   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.)rL  rW  ra  rd  rZ  r^  rS  r   r.   dtype)rE  rF  rW  )ra  rd  rZ  r^  Nri  dtypes)r   r   r/   
issubdtypetyper   ri  rj  )constructor_namecontainer_typeri  
superdtype	containercontainer_converteds         r!   test_convert_containerrr  w  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 )NrL  r6   r:   categorical_feature_namesr   rL   )r2   rP  r   rj  iloc)dfs    r!   (test_convert_container_categories_pandasrx    sE    
!	cUGXuQTPU	VB99>>!
***r#   c                      [         R                  " S5      n [        S//SS/S/S9nUR                  S   U R	                  5       :X  d   eg )Nra  r6   r:   rt  )r2   rP  r   schemaCategorical)plrw  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 )NrZ  r6   r:   rt  r   )r2   rP  r   rl  rz  DictionaryType)parw  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_matchedr2   r4   r3   )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㈵ ?rh  r   gX ?gc^  ?g55  ?gh㈵>g        gh㈵>)atol)r
   r/   rG  float32r2   r   r3   float64rD   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   r2   r   r3   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rm  c                 0    [        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.
)
   r  g?r+   )densityr-   N)r   r   )rm  X_sparses     r!   'test_convert_container_sparse_to_sparser  @  s    " $Hc%HH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OUS	:X  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)NrJ   r'   )r   rL   r   T)r   Pyarrowz*
Pyarrow will become a required dependencyzcodecs\.open\(\) is deprecatedz0codecs.open() is deprecated. Use open() instead.r   )
actionr2   r   rL   r   rA   rB   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==LMM%.. (:3v;!#@@q6!9,,-888ay))\-B-BBBB! 21 ' NM 21s   *D;BE;
E	
Er  c                 \    [         R                  R                  SS5      S:g  n[        XS9  g )NSKLEARN_WARNINGS_AS_ERRORS0r  )r1  environgetr  )r  r  s     r!   test_sklearn_warnings_as_errorsr  p  s%    (DcJcQ\Qr#   c                     [         R                  " 5          [        5         [        U SS9  S S S 5        g ! , (       d  f       g = f)NTr  )rA   r~   r   r  )r  s    r!   test_turn_warnings_into_errorsr  v  s*    		 	 	"!# $G 
#	"	"s	   4
A)r   )]r0  r1  rA   numpyr/   r2   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   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)  r;  rD  rE  rF  ndarray
csr_matrixr   rf  int32integerint64r  floatingr  rr  rx  r}  r  r  r  xfailr  r  r  r  r  rD   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./	@ 
BC 
?@ 
=> 
@A 
FG 
BC 
FG  
%!* 	2::	2::	R[[!	R[[!	&6+<&6R+.8CLH$ 8$=>L ?L. 	
 		
	33C6 )H)JKR LR
 )H)JKH LHr#   