o
    Yi                     @   sF   d dl Z d dlZd dlmZ d dlmZ d dlmZ G dd dZ	dS )    N)assert_allclose)stats)SmallSampleWarningc                	   @   s`   e Zd Zejdeddddeddddgd	d
 Zejdddd Zdd Z	dd Z
dS )TestChatterjeeXicaseTgdM6dӿg̊E ?)y_cont	statisticpvalueFg`/?g)];?c                 C   st   t jd}|jdd}|d r|jddn|jdddd}tj|||d d}t|j|d  t|j|d	  d S )
Nl   
A;
   sizer   r      y_continuousr   r	   )	nprandomdefault_rngintegersr   chatterjeexir   r   r	   )selfr   rngxyres r   I/tmp/pip-target-1s0edx8b/lib/python/scipy/stats/tests/test_correlation.pytest_against_R_XICOR
   s   z%TestChatterjeeXi.test_against_R_XICORr   )FTc           
      C   s   t jd}t |ddt}d|f}|j|d}|r$|j|dn|jdd|d}tj	|d}tj
||||d	d
}tj
|||d	d}	t jj|j|	jdd t jj|j|	jdd d S )Nl   ^/	d         r   r   r
   )r   )methodr   axis)r   r"   gV瞯<)rtolg{Gz?)r   r   r   flooruniformastypeintr   r   PermutationMethodr   testingr   r   r	   )
r   r   r   nshaper   r   r!   r   refr   r   r   test_permutation_asymptotic%   s   
z,TestChatterjeeXi.test_permutation_asymptoticc                 C   s.  t jd}|jdd\}}d}tjt|d t||d d  W d    n1 s,w   Y  d}tjt|d tj||dd	 W d    n1 sMw   Y  d
}tjt|d tj||dd W d    n1 snw   Y  d}tjt|d tj||dd W d    d S 1 sw   Y  d S )Nl   n3o)r   r
   r   z/Array shapes are incompatible for broadcasting.matchr    z(...axis 10 is out of bounds for array...r
   )r"   z`y_continuous` must be boolean.z	a herringr   z `method` must be 'asymptotic' orz	ekki ekii)r!   )r   r   r   pytestraises
ValueErrorr   r   )r   r   r   r   messager   r   r   test_input_validation6   s$   "z&TestChatterjeeXi.test_input_validationc                 C   sf   d}t jt|d tdgdg}W d    n1 sw   Y  t|js)J t|js1J d S )Nz,One or more sample arguments is too small...r.      r   )	r0   warnsr   r   r   r   isnanr   r	   )r   r3   r   r   r   r   test_special_casesJ   s   z#TestChatterjeeXi.test_special_casesN)__name__
__module____qualname__r0   markparametrizedictr   r-   r4   r8   r   r   r   r   r   	   s    

r   )
r0   numpyr   numpy.testingr   scipyr   scipy.stats._axis_nan_policyr   r   r   r   r   r   <module>   s    