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   Zrandom_state)Zldatree r   o/var/www/html/eduruby.in/lip-sync/lip-sync-env/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)npZarangeZreshapepytestr   AssertionErrorr
   
ValueErrorr   ZdiagsonesZtocsr)r   xmsgyXABr   r   r   !test_assert_allclose_dense_sparse.   s    "r1   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 r2   r3   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   r8   r7   r   r   decorator_no_warningg   s   
z1test_ignore_warning.<locals>.decorator_no_warningc                      
      d S r<   r   r   r8   r   r   decorator_no_warning_multiplel      
z:test_ignore_warning.<locals>.decorator_no_warning_multiplec                      r?   r<   r   r   r7   r   r    decorator_no_deprecation_warningp   rB   z=test_ignore_warning.<locals>.decorator_no_deprecation_warningc                      r?   r<   r   r   rC   r   r   decorator_no_user_warningt   rB   z6test_ignore_warning.<locals>.decorator_no_user_warningc                      r?   r<   r   r   r@   r   r   )decorator_no_deprecation_multiple_warningx   rB   zFtest_ignore_warning.<locals>.decorator_no_deprecation_multiple_warningc                      r?   r<   r   r   r@   r   r   "decorator_no_user_multiple_warning|   rB   z?test_ignore_warning.<locals>.decorator_no_user_multiple_warningc                      s2   t      W d    d S 1 sw   Y  d S r<   )r   r   rC   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   r6   UserWarningr   r@   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 rI   r   r6   r   rC   r   r   &context_manager_no_deprecation_warning      "zCtest_ignore_warning.<locals>.context_manager_no_deprecation_warningc                      rL   rI   r   rJ   r   rC   r   r   context_manager_no_user_warning   rO   z<test_ignore_warning.<locals>.context_manager_no_user_warningc                      rL   rI   rM   r   r@   r   r   /context_manager_no_deprecation_multiple_warning   rO   zLtest_ignore_warning.<locals>.context_manager_no_deprecation_multiple_warningc                      rL   rI   rP   r   r@   r   r   (context_manager_no_user_multiple_warning   rO   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 r<   r   r   r   r   r   test   s   z!test_ignore_warning.<locals>.test)r4   catch_warningssimplefilterr   r6   r'   warnsrJ   FutureWarninglen
isinstancemessager   r)   )recordr>   rA   rD   rE   rF   rG   rH   rK   rN   rQ   rR   rS   Zwarning_classr!   Zsilence_warnings_funcrU   r   r=   r   test_ignore_warningB   s   









$r^   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      re   c                 C   r_   )zFunction f

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

    Results
    -------
    c : list
        Parameter c
    r   ra   r   r   r   f_bad_sections   rf   rg   c                 C   s   ||  }|S r`   r   )rc   rb   rd   r   r   r   f_bad_order   rf   rh   c                 C   r_   )zFunction f

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

    Returns
    -------
    d : list
        Parameter c
    r   )rb   rc   dr   r   r   f_too_many_param_docstring   s   rj   c                 C   r_   )zFunction f

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

    Returns
    -------
    c : list
        Parameter c
    r   ra   r   r   r   	f_missing  s   rk   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   )rb   rc   rd   ri   er   r   r   f_check_param_definition&  s   rm   c                   @      e Zd Zdd Zdd ZdS )Klassc                 C   rT   r<   r   selfr.   r-   r   r   r   rk   :     zKlass.f_missingc                 C      dS )zFunction f

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

        Results
        -------
        c : list
            Parameter c
        Nr   rp   r   r   r   rg   =  s   zKlass.f_bad_sectionsN)__name__
__module____qualname__rk   rg   r   r   r   r   ro   9      ro   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   rs   )ZMockEstimatorNr   rq   r   r   r   __init__P      zMockEst.__init__c                 C      |S r<   r   rp   r   r   r   fitS  rr   zMockEst.fitc                 C   r|   r<   r   rq   r.   r   r   r   predictV  rr   zMockEst.predictc                 C   r|   r<   r   r~   r   r   r   predict_probaY  rr   zMockEst.predict_probac                 C   rs   )N      ?r   r~   r   r   r   score\  rr   zMockEst.scoreN)rt   ru   rv   rz   r}   r   r   r   r   r   r   r   rx   O  s    rx   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)rq   r   r   r   r   rz   a  s   
zMockMetaEstimator.__init__c                 C      t | jdS )Nr   hasattrr   ry   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   ry   r   r   r   r   v  r   z%Testing a deprecated delegated methodc                 C   rs   )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   ry   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   rs   )z,Incorrect docstring but should not be testedNr   rp   r   r   r   r}     r{   zMockMetaEstimator.fitN)
rt   ru   rv   rz   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 )Nrc   )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   re   rk   r'   r   RuntimeErrorrg   ro   rm   r   rx   	__class__rt   ziprh   rj   r   r   r   r}   )Z	incorrectZ	mock_metaZmock_meta_namemessagesr,   fr   r   r   test_check_docstring_parameters  s|   



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

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

    b : str
        Parameter b.

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

    d : int
       Returning
    Nr   rb   rc   r   r   r   f_one  s   r   c                 C   rs   )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   rs   )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, errorrb   rc   )include_paramsZexclude_paramszThe 'exclude_params' argumentFrd   )include_returnsZ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kwargsr9   r   r   r   ,test_assert_docstring_consistency_arg_checksb  s   "r   zobjects, kwargs, error, warnr    
whitespace)idr   TZ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 grouprl   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   rX   rJ   )r   r   r9   r5   r   r   r   !test_assert_docstring_consistencyx  s   1""r   c                 C   rs   )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   rs   )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   rs   )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   )r,   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   Z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(   )Z
regex_fullZregex_wordsZregex_errorr,   r   r   r   5test_assert_docstring_consistency_descr_regex_pattern  s,   "r   c                   @   rn   )RegistrationCounterc                 C   s
   d| _ d S )Nr   )nb_callsry   r   r   r   rz   3  s   
zRegistrationCounter.__init__c                 C   s    |  j d7  _ |jtu sJ d S )Nr%   )r   funcr   )rq   Zto_register_funcr   r   r   __call__6  s   zRegistrationCounter.__call__N)rt   ru   rv   rz   r   r   r   r   r   r   2  rw   r   rc                 C   s:   t |tjsJ |dk}|jj|u sJ tj| | d S )Nr   )r[   r&   Zmemmapflags	writeabletestingZassert_array_equal)input_arrayZ	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   dataZ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)Z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   Z
input_listZmmap_data_listZoutput_dataotherr   r   r   test_create_memmap_backed_dataW  s,   



r   z constructor_name, container_typelisttuplearrayr   Z
sparse_csrZsparse_csr_arrayZ
sparse_cscZsparse_csc_array	dataframec                   C      t djS Npandasr'   importorskipZ	DataFramer   r   r   r   r     r   r   seriesc                   C   r   r   r'   r   Z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   Z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   r[   r&   Z
issubdtypetyper   r   r   )constructor_namecontainer_typer   Z
superdtype	containerZ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   r+   r   r/   Zcategorical_feature_namesr   r;   )r'   r   r   r   Z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   r+   r/   r   )r'   r   r   schemaZ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   r+   r/   r   r   )r'   r   r   r   r   Z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 patternsZhellozBad message)r!   r   zDid not raiseT)r!   Zmay_pass)r   r   Z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㈵>)Z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?Zcsr)ZdensityformatN)r   randomr   )r   ZX_sparser   r   r   'test_convert_container_sparse_to_sparse@  s   r  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 )
Nr9   r    )r\   r;   r   T)r]   ZPyarrowz*
Pyarrow will become a required dependencyr   )
actionr'   r   r;   r\   r4   r5   rV   rZ   str)warning_infowarnings_as_errorsr]   r\   r   r   r   check_warnings_as_errorsU  s2   
"r	  r  c                 C   s"   t jdddk}t| |d d S )NZSKLEARN_WARNINGS_AS_ERRORS0r  )r   environgetr	  )r  r  r   r   r   test_sklearn_warnings_as_errorsm  s   r  c                 C   s@   t   t  t| dd W d    d S 1 sw   Y  d S )NTr  )r4   rV   r   r	  )r  r   r   r   test_turn_warnings_into_errorss  s   
"r  )r   )[r   r   r4   numpyr&   r'   Zscipyr   Zsklearn.discriminant_analysisr   Zsklearn.treer   Zsklearn.utils._testingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   Zsklearn.utils.deprecationr   Zsklearn.utils.fixesr   r   r   Zsklearn.utils.metaestimatorsr   r   markZparametrizer1   r^   re   rg   rh   rj   rk   rm   ro   rx   r   r   r   r   r   r   r   paramr   r   r   r   r   r   r   r   r   r   r   r   ZndarrayZ
csr_matrixr   r   Zint32integerZint64r   Zfloatingr   r   r   r   r   r   r   Zxfailr   r  r	  r  r  r   r   r   r   <module>   s<   D	
 1






.
0
%
	
	

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