U
    ÉZj  ã                   @   s2   d dl Zd dlmZmZmZmZ G dd„ dƒZdS )é    N)Úassert_Úassert_array_equalÚassert_allcloseÚsuppress_warningsc                   @   st   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚTestRegressionc              
   C   sP   t jjddddddddgddddddddgd�}tt j |¡dddd	ggƒ d S )
Nr   é   é   é   é   é   é   ©Úmaské   )ÚnpÚmaÚmasked_arrayr   Znonzero)ÚselfÚx© r   úa/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/site-packages/numpy/ma/tests/test_regression.pyÚtest_masked_array_create   s    ÿz'TestRegression.test_masked_array_createc                 C   s   t jjddgd� d S )Nr   r   )r   r   Úarray©r   r   r   r   Útest_masked_array   s    z TestRegression.test_masked_arrayc                 C   s>   ddl m}m} t d¡}t |j|¡}|||ƒ}||  d S )Nr   )Úmasked_whereÚMaskType)r   r   )Znumpy.mar   r   r   ÚzerosÚshape)r   r   r   ÚaÚbÚcr   r   r   Útest_mem_masked_where   s
    

z$TestRegression.test_mem_masked_wherec                 C   s6   t j d¡}t jj|d< t  d¡}||  ||  d S )N)r
   r   )r   r   )r
   r   )r   r   r   Zmasked©r   r   r    r   r   r   Útest_masked_array_multiply   s
    
z)TestRegression.test_masked_array_multiplyc                 C   s   t jjdgdd� d¡ d S )Nr   Fr   é
   )r   r   r   Úrepeatr   r   r   r   Útest_masked_array_repeat"   s    z'TestRegression.test_masked_array_repeatc                 C   s   t tj d¡ƒ d S )NZUnicode)Úreprr   r   r   r   r   r   r   Útest_masked_array_repr_unicode&   s    z-TestRegression.test_masked_array_repr_unicodec                 C   sJ   t jjdddgdddgd�}t  |¡}t|jjdkƒ t|jjdkƒ d S )	Ng        g333333ó?g      @FTr   r   r   )r   r   r   Z
atleast_2dr   r   Úndimr#   r   r   r   Útest_atleast_2d*   s    
zTestRegression.test_atleast_2dc                 C   s4   t jjdddgdddgd�}d|_t|jdkƒ d S )Nr   r    r!   r   r   r   ÚX)r   r   r   Z
fill_valuer   )r   r   r   r   r   Útest_set_fill_value_unicode_py31   s    z.TestRegression.test_set_fill_value_unicode_py3c                 C   sD   t jjt  d¡dd�}t jjdtd�}|j|d� t|jdkƒ d S )Nr   Tr   éÿÿÿÿ©Zdtype)Úoutr   )r   r   r   ÚarangeÚfloatÚvarr   Ú_data)r   r   Zmoutr   r   r   Ú test_var_sets_maskedarray_scalar7   s    z/TestRegression.test_var_sets_maskedarray_scalarc              	   C   s€   t j dddddgd¡}t  dddddg¡}tƒ �D}| td¡ t jj||d	d
�}t jj||dd
�}t|j	|j	ƒ W 5 Q R X d S )Nr   r   r	   r
   r   g      @gÍÌÌÌÌÌ@zbias and ddof have no effectr   )Zddof)
r   r   Zmasked_equalr   r   ÚfilterÚDeprecationWarningZcorrcoefr   Údata)r   r   ÚyÚsupZr0Úr1r   r   r   Útest_ddof_corrcoef>   s    z!TestRegression.test_ddof_corrcoefc                 C   sf   t jjddgddgd�}t|jjdkƒ t  |d¡}t|jjdkƒ t|jdkƒ t|jjdkƒ d S )Nç      ð?ç       @Fr   )r   )r   r   ©r   r   )r   r   ÚMaskedArrayr   r   r   Ztiler#   r   r   r   Útest_mask_not_backmangledJ   s    z(TestRegression.test_mask_not_backmangledc                 C   s0   t jjdddgdd�}t|g  |d d… ƒ d S )N)r   r=   )r   r>   )r	   g      @zi4,f4r/   r   )r   r   r@   r   ©r   r   r   r   r   Útest_empty_list_on_structuredT   s    z,TestRegression.test_empty_list_on_structuredc                 C   s.   t j d¡ d¡}t|jdd�|j ¡ ƒ d S )Nr
   r?   ÚF)Úorder)r   r   r1   Zreshaper   ÚtobytesÚTrB   r   r   r   Ú!test_masked_array_tobytes_fortranY   s    z0TestRegression.test_masked_array_tobytes_fortranN)Ú__name__Ú
__module__Ú__qualname__r   r   r"   r$   r'   r)   r+   r-   r5   r<   rA   rC   rH   r   r   r   r   r      s   
r   )Únumpyr   Znumpy.testingr   r   r   r   r   r   r   r   r   Ú<module>   s   