o
    \i_                     @   sT  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZm Z m!Z! d dl"m#Z# d	d
 Z$ej%&de dd Z'dd Z(dd Z)dd Z*dd Z+dd Z,dd Z-dd Z.G dd dZ/G dd dZ0G d d! d!Z1ed"d# Z2d$d% Z3d&d' Z4d(d) Z5ed*d+ Z6eej%&d,e3e4gd-gd.gd/d0fe3e4gd1d2gd3d4fgd5d6 Z7eej%&d7ej8e3e4gd8d-gid9d9d:d;ej8e3e4gd<d=id9d9d>d;ej8e3e4e5gd8d-gid?d9d@d;ej8e3e4e5gd8d.gidAd9dBd;ej8e4e5gd8dCgidDd9dEd;ej8e3e4gd=d.gd/d9dFdGd;gdHdI Z9dJdK Z:dLdM Z;dNdO Z<edPdQ Z=edRdS Z>G dTdU dUZ?ddWdXZ@dYdZ ZAd[d\ ZBej%&d]d^eCfd_eDfd`ejEfdaejFfgeGdbdcge!eGdddege dfdgdh fdidjdh fdkdldh fdmdndh fdodpdh fdqdrdh fdsdtdh fdueHfej%&dvejIejJfejKejJfejLejMfejNejMfgdwdx ZOdydz ZPd{d| ZQd}d~ ZRdd ZSdd ZTej%jUedddd ZVej%&ddbdde8dce8degdd ZWdd ZXej%&de dd ZYej%&de dd ZZdS )    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                  C   s2   t  } t }t| d t|d |jdksJ d S )N   )r   r   r   random_state)ldatree r   /var/www/www-root/data/www/176.119.141.140/sports-predictor/venv/lib/python3.10/site-packages/sklearn/utils/tests/test_testing.pytest_set_random_state%   s
   

r   csr_containerc              	   C   s  t ddd}d}| |}||fD ]%}tjt|d t||d  W d    n1 s.w   Y  t|| qtjtdd t|| W d    n1 sPw   Y  tj	t 
ddd	 }| t 
d
}tjtdd t|| W d    d S 1 sw   Y  d S )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Br   r   r   !test_assert_allclose_dense_sparse.   s    "r7   c                     s  dd dd  t   t d t ttd W d    n1 s&w   Y  tt ttd  W d    n1 sBw   Y  t } t td  W d    n1 s]w   Y  t	| dksjJ t
| d jtstJ t
| d	 jts~J t } t td  W d    n1 sw   Y  t	| d	ksJ t
| d jtsJ t   t d tttfd W d    n1 sw   Y  t fd
d}tttfd fdd}ttdfdd}ttdfdd}ttd fdd}ttd fdd}t   t d |  |  |  W d    n	1 s,w   Y  tt |  W d    n	1 sEw   Y  tt |  W d    n	1 s^w   Y  tt |  W d    n	1 sww   Y  fdd} fdd}fdd}	fdd}
 fdd} fd d!}t   t d |  |  |	  W d    n	1 sw   Y  tt |
  W d    n	1 sw   Y  tt |  W d    n	1 sw   Y  tt |  W d    n	1 s	w   Y  t}d"}tjt|d# t|}|  W d    n	1 s.w   Y  tjt|d# t|d$d% }W d    d S 1 sOw   Y  d S )&Nc                   S   s   t dt d S Nzdeprecation warningwarningswarnDeprecationWarningr   r   r   r   _warning_functionE   s   z.test_ignore_warning.<locals>._warning_functionc                   S   s   t dt t d d S r8   r9   r   r   r   r   _multiple_warning_functionH   s   z7test_ignore_warning.<locals>._multiple_warning_functionerrorcategoryr$   r   r'   c                      s        d S Nr   r   r>   r=   r   r   decorator_no_warningg   s   
z1test_ignore_warning.<locals>.decorator_no_warningc                      
      d S rB   r   r   r>   r   r   decorator_no_warning_multiplel      
z:test_ignore_warning.<locals>.decorator_no_warning_multiplec                      rE   rB   r   r   r=   r   r    decorator_no_deprecation_warningp   rH   z=test_ignore_warning.<locals>.decorator_no_deprecation_warningc                      rE   rB   r   r   rI   r   r   decorator_no_user_warningt   rH   z6test_ignore_warning.<locals>.decorator_no_user_warningc                      rE   rB   r   r   rF   r   r   )decorator_no_deprecation_multiple_warningx   rH   zFtest_ignore_warning.<locals>.decorator_no_deprecation_multiple_warningc                      rE   rB   r   r   rF   r   r   "decorator_no_user_multiple_warning|   rH   z?test_ignore_warning.<locals>.decorator_no_user_multiple_warningc                      s2   t      W d    d S 1 sw   Y  d S rB   )r   r   rI   r   r   context_manager_no_warning   s   "z7test_ignore_warning.<locals>.context_manager_no_warningc                      s:   t ttfd    W d    d S 1 sw   Y  d S Nr@   )r   r<   UserWarningr   rF   r   r   #context_manager_no_warning_multiple   s   "z@test_ignore_warning.<locals>.context_manager_no_warning_multiplec                      6   t td    W d    d S 1 sw   Y  d S rO   r   r<   r   rI   r   r   &context_manager_no_deprecation_warning      "zCtest_ignore_warning.<locals>.context_manager_no_deprecation_warningc                      rR   rO   r   rP   r   rI   r   r   context_manager_no_user_warning   rU   z<test_ignore_warning.<locals>.context_manager_no_user_warningc                      rR   rO   rS   r   rF   r   r   /context_manager_no_deprecation_multiple_warning   rU   zLtest_ignore_warning.<locals>.context_manager_no_deprecation_multiple_warningc                      rR   rO   rV   r   rF   r   r   (context_manager_no_user_multiple_warning   rU   zEtest_ignore_warning.<locals>.context_manager_no_user_multiple_warningzA'obj' should be a callable.+you should use 'category=UserWarning'r"   c                   S      d S rB   r   r   r   r   r   test   s   z!test_ignore_warning.<locals>.test)r:   catch_warningssimplefilterr   r<   r+   warnsrP   FutureWarninglen
isinstancemessager   r-   )recordrD   rG   rJ   rK   rL   rM   rN   rQ   rT   rW   rX   rY   warning_classr#   silence_warnings_funcr[   r   rC   r   test_ignore_warningB   s   









$rf   c                 C      | | }|S zFunction f

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

    Returns
    -------
    c : list
        Parameter c
    r   abcr   r   r   f_ok      rm   c                 C   rg   )zFunction f

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

    Results
    -------
    c : list
        Parameter c
    r   ri   r   r   r   f_bad_sections   rn   ro   c                 C   s   ||  }|S rh   r   )rk   rj   rl   r   r   r   f_bad_order   rn   rp   c                 C   rg   )zFunction f

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

    Returns
    -------
    d : list
        Parameter c
    r   )rj   rk   dr   r   r   f_too_many_param_docstring   s   rr   c                 C   rg   )zFunction f

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

    Returns
    -------
    c : list
        Parameter c
    r   ri   r   r   r   	f_missing  s   rs   c                 C   s   | | | | S )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
    r   )rj   rk   rl   rq   er   r   r   f_check_param_definition&  s   ru   c                   @      e Zd Zdd Zdd ZdS )Klassc                 C   rZ   rB   r   selfr4   r3   r   r   r   rs   :     zKlass.f_missingc                 C      dS )zFunction f

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

        Results
        -------
        c : list
            Parameter c
        Nr   rx   r   r   r   ro   =  s   zKlass.f_bad_sectionsN)__name__
__module____qualname__rs   ro   r   r   r   r   rw   9      rw   c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )MockEstc                 C   r{   )MockEstimatorNr   ry   r   r   r   __init__P      zMockEst.__init__c                 C      |S rB   r   rx   r   r   r   fitS  rz   zMockEst.fitc                 C   r   rB   r   ry   r4   r   r   r   predictV  rz   zMockEst.predictc                 C   r   rB   r   r   r   r   r   predict_probaY  rz   zMockEst.predict_probac                 C   r{   )N      ?r   r   r   r   r   score\  rz   zMockEst.scoreN)r|   r}   r~   r   r   r   r   r   r   r   r   r   r   O  s    r   c                   @   sh   e Zd Zdd Zedd dd Zedd edd	d
 Zedd dd Zeddd Z	dS )MockMetaEstimatorc                 C   s
   || _ dS )zMetaEstimator to check if doctest on delegated methods work.

        Parameters
        ---------
        delegate : estimator
            Delegated estimator.
        Ndelegate)ry   r   r   r   r   r   a  s   
zMockMetaEstimator.__init__c                 C      t | jdS )Nr   hasattrr   r   r   r   r   <lambda>k      zMockMetaEstimator.<lambda>c                 C   s   | j |S )zThis is available only if delegate has predict.

        Parameters
        ----------
        y : ndarray
            Parameter y
        )r   r   r   r   r   r   r   k  s   	zMockMetaEstimator.predictc                 C   r   )Nr   r   r   r   r   r   r   v  r   z%Testing a deprecated delegated methodc                 C   r{   )zThis is available only if delegate has score.

        Parameters
        ---------
        y : ndarray
            Parameter y
        Nr   r   r   r   r   r   v  r   zMockMetaEstimator.scorec                 C   r   )Nr   r   r   r   r   r   r     r   c                 C   r   )zThis is available only if delegate has predict_proba.

        Parameters
        ---------
        X : ndarray
            Parameter X
        r   r   r   r   r   r     s   	zMockMetaEstimator.predict_probaz-Testing deprecated function with wrong paramsc                 C   r{   )z,Incorrect docstring but should not be testedNr   rx   r   r   r   r     r   zMockMetaEstimator.fitN)
r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   `  s    





	

r   c                  C   s  t t} | g ks
J t tdgd} | g ksJ t tdgd} | g ks$J tjtdd t t W d    n1 s:w   Y  tjtdd t tj W d    n1 sVw   Y  t t} t	t
 d}|jj}| g dksqJ g dg d	g d
g dd| dddddddgd| ddddgd| ddddgd| dddddgg}t|ttttj|j|j|j|jgD ]\}}t |} || ksJ d|| f qd S )Nrk   )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
"%s"
 not in 
"%s")r   rm   rs   r+   r   RuntimeErrorro   rw   ru   r   r   	__class__r|   ziprp   rr   r   r   r   r   )	incorrect	mock_metamock_meta_namemessagesr2   fr   r   r   test_check_docstring_parameters  s|   




	
Pr   c                 C   r{   )zFunction one.

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

    b : str
        Parameter b.

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

    d : int
       Returning
    Nr   rj   rk   r   r   r   f_one  s   r   c                 C   r{   )a  Function two.

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

    b : str
        Parameter bb.

    e : int
        Extra parameter.

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

    d : int
       Returning
    Nr   r   r   r   r   f_two(  s   r   c                 C   r{   )zFunction two.

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

    b : str
        Parameter B!

    e :
        Extra parameter.

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

    d : int
       Returning
    Nr   r   r   r   r   f_threeB  s   r   c                   C   s@   t jtdd tdtg W d   dS 1 sw   Y  dS )z1Check error raised when `objects` incorrect type.zAll 'objects' must be one ofr"   stringN)r+   r   	TypeErrorr   r   r   r   r   r   -test_assert_docstring_consistency_object_type[  s   "r   zobjects, kwargs, errorrj   rk   )include_paramsexclude_paramszThe 'exclude_params' argumentFrl   )include_returnsexclude_returnszThe 'exclude_returns' argumentc                 C   sD   t jt|d t| fi | W d   dS 1 sw   Y  dS )z?Check `assert_docstring_consistency` argument checking correct.r"   N)r+   r   r   r   )objectskwargsr?   r   r   r   ,test_assert_docstring_consistency_arg_checksb  s   "r   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 grouprt   zPThe type specification of Parameter 'e' is inconsistent between\n\['f_two'\] andz
empty typez,Checking was skipped for Parameters: \['e'\]z	skip warnc                 C   s   |r$t jt|d t| fi | W d   dS 1 sw   Y  dS |rHt jt|d t| fi | W d   dS 1 sAw   Y  dS t| fi | dS )z;Check `assert_docstring_consistency` gives correct results.r"   N)r+   r   r,   r   r^   rP   )r   r   r?   r;   r   r   r   !test_assert_docstring_consistencyx  s   1""r   c                 C   r{   )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.
    Nr   labelsr   r   r   f_four     
r   c                 C   r{   )a  Function 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.
    Nr   r   r   r   r   f_five  s   r   c                 C   r{   )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.
    Nr   r   r   r   r   f_six  r   r   c                  C   sJ   d} t jt| d ttttgdd W d   dS 1 sw   Y  dS )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   )r2   r   r   r   +test_assert_docstring_consistency_error_msg  s   *"r   c                  C   s   d} t tttgdd|  d d}t tttgdd| d d}d}tjt|d t tttgdd| d W d	   d	S 1 sHw   Y  d	S )
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_errorr2   r   r   r   5test_assert_docstring_consistency_descr_regex_pattern  s,   "r   c                   @   rv   )RegistrationCounterc                 C   s
   d| _ d S )Nr   )nb_callsr   r   r   r   r   3  s   
zRegistrationCounter.__init__c                 C   s    |  j d7  _ |jtu sJ d S )Nr'   )r   funcr   )ry   to_register_funcr   r   r   __call__6  s   zRegistrationCounter.__call__N)r|   r}   r~   r   r   r   r   r   r   r   2  r   r   rc                 C   s:   t |tjsJ |dk}|jj|u sJ tj| | d S )Nr   )ra   r(   memmapflags	writeabletestingassert_array_equal)input_array	mmap_data	mmap_moder   r   r   r   check_memmap;  s   r   c                 C   s   t  }| td| td}t|}t|| tj	|j
}W d    n1 s*w   Y  tjdkr<tj|r<J |jdksCJ d}t||d}t|||d tj	|j
}W d    n1 sdw   Y  tjdkrvtj|rvJ |jdks}J d S )Nregisterr   ntr'   r+r   r$   )r   setattratexitr(   r/   r   r   ospathdirnamefilenamenameexistsr   )monkeypatchregistration_counterr   datatemp_folderr   r   r   r   test_tempmemmapB  s$   




r   c           
      C   s  t  }| td| td}t|}t|| |jdksJ t|dd\}}t|| |tj	
|jks7J |jdks>J d}t||d}t||| |jdksSJ ||d |d g}t|}t||D ]	\}}t|| qe|jd	ksvJ t|d
g\}}	t|| |	d
ksJ d S )Nr   r   r'   T)return_folderr$   r   r      znot-an-array)r   r   r   r(   r/   r   r   r   r   r   r   r   r   )
r   r   r   r   folderr   
input_listmmap_data_listoutput_dataotherr   r   r   test_create_memmap_backed_dataW  s,   



r   z constructor_name, container_typelisttuplearrayr   
sparse_csrsparse_csr_array
sparse_cscsparse_csc_array	dataframec                   C      t djS Npandasr+   importorskip	DataFramer   r   r   r   r     r   r   seriesc                   C   r   r   r+   r   Seriesr   r   r   r   r     r   indexc                   C   r   r   )r+   r   Indexr   r   r   r   r     r   pyarrowc                   C   r   Nr   )r+   r   Tabler   r   r   r   r     r   pyarrow_arrayc                   C   r   r  )r+   r   Arrayr   r   r   r   r     r   polarsc                   C   r   Nr  r   r   r   r   r   r     r   polars_seriesc                   C   r   r  r   r   r   r   r   r     r   slicezdtype, superdtypec                 C   s   | dv r| }ddg}t || |d}t||sJ | dv r+tt|d |s)J dS | dv r1dS t|dr?|j|ks=J dS t|d	rM|jd |ksOJ dS dS )
z\Check that we convert the container to the right type of array with the
    right data type.)r   r   r  r  r   r  r   r   r'   dtype)r   r   r   )r  r  r   r  Nr
  dtypes)r   ra   r(   
issubdtypetyper   r
  r  )constructor_namecontainer_typer
  
superdtype	containercontainer_convertedr   r   r   test_convert_containeru  s&   &

r  c                  C   s:   t d tdggddgdgd} | jjd dksJ d S )Nr   r1   r   r5   categorical_feature_namesr   rA   )r+   r   r   r  iloc)dfr   r   r   (test_convert_container_categories_pandas  s
   
r  c                  C   s<   t d} tdggddgdgd}|jd |  ksJ d S )Nr  r1   r5   r  )r+   r   r   schemaCategorical)plr  r   r   r   (test_convert_container_categories_polars  s   
r  c                  C   s@   t d} tdggddgdgd}t|jd j| ju sJ d S )Nr   r1   r5   r  r   )r+   r   r   r  r  DictionaryType)par  r   r   r   )test_convert_container_categories_pyarrow  s   
r  c               	   C   s  t t t 1 sw   Y  t tdd} td1 sw   Y  | js(J t tddgd} td1 s8w   Y  | jsBJ tj tdd t t} td1 sVw   Y  W d    n1 sew   Y  | jroJ tj tdd t tdd} t 1 sw   Y  W d    n1 sw   Y  | jrJ tj tdd t tdd} td1 sw   Y  W d    n1 sw   Y  | jrJ tj td	d t td
d} td1 sw   Y  W d    n1 sw   Y  | jrJ tj tdd t td
dd} td1 sw   Y  W d    n	1 s#w   Y  | jr.J tj tdd t t} W d    n	1 sFw   Y  W d    n	1 sVw   Y  | jraJ t td
dd} W d    n	1 stw   Y  | jrJ t ttf t 1 sw   Y  t ttf t 1 sw   Y  t t( t ttf W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )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+   r-   r,   )cmr   r   r   test_raises  s   








 $r%  c                   C   s  t tjdgtjdd tt t tjdgtjdd W d    n1 s(w   Y  t tjdgtjdd tt t tjdgtjdd W d    n1 sUw   Y  tt t tjdgtjdd W d    n1 svw   Y  t tjdgtjddd	d
 d S )Ng㈵ ?r	  r   gX ?gc^  ?g55  ?gh㈵>g        gh㈵>)atol)r	   r(   r   float32r+   r   r,   float64r   r   r   r   "test_float32_aware_assert_allclose  s    r)  zcannot start subprocess)reasonc                  C   s   d} t |  d} tjtdd t |  W d    n1 sw   Y  d} tjtdd t | dd W d    n1 s=w   Y  dd	d
g} tjtdd t | dd W d    d S 1 sbw   Y  d S )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   )coder   r   r   ,test_assert_run_python_script_without_output(  s(   
"r.  r  c                 C   s    t jddddd}t||  dS )zyNon-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   )r  X_sparser   r   r   'test_convert_container_sparse_to_sparse@  s   r5  c                 C   s  | j dkr)|r)tj| j| jd tj| j| jd W d    n1 s$w   Y  | j dkrtjddD}| j}d|v r>d}tj|| jd |rPt|d	ksQJ 	 |rht	|d	 j|ks^J |d	 j| jkspJ W d    d S W d    d S 1 s{w   Y  d S d S )
Nr?   r"   )rb   rA   r   T)rc   Pyarrowz*
Pyarrow will become a required dependencyr   )
actionr+   r   rA   rb   r:   r;   r\   r`   str)warning_infowarnings_as_errorsrc   rb   r   r   r   check_warnings_as_errorsU  s2   
"r;  r9  c                 C   s"   t jdddk}t| |d d S )NSKLEARN_WARNINGS_AS_ERRORS0r:  )r   environgetr;  )r9  r:  r   r   r   test_sklearn_warnings_as_errorsm  s   rA  c                 C   s@   t   t  t| dd W d    d S 1 sw   Y  d S )NTr>  )r:   r\   r   r;  )r9  r   r   r   test_turn_warnings_into_errorss  s   
"rB  )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parametrizer7   rf   rm   ro   rp   rr   rs   ru   rw   r   r   r   r   r   r   r   r   paramr   r   r   r   r   r   r   r   r   r   r   r   ndarray
csr_matrixr   r  int32integerint64r'  floatingr(  r  r  r  r  r%  r)  xfailr.  r5  r;  rA  rB  r   r   r   r   <module>   s<   D	
 1






.
0
%
	
	










	)F


