%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python3.9/site-packages/numpy/ma/tests/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib64/python3.9/site-packages/numpy/ma/tests/__pycache__/test_extras.cpython-39.pyc

a

z[yc�@s�dZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZmZmZmZmZmZddlmZmZmZmZmZm 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.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<Gdd�d�Z=Gd	d
�d
�Z>Gdd�d�Z?Gd
d�d�Z@Gdd�d�ZAGdd�d�ZBGdd�d�ZCGdd�d�ZDGdd�d�ZEGdd�d�ZFGdd�d�ZGGdd�d�ZHGdd �d �ZIGd!d"�d"�ZJGd#d$�d$�ZKdS)%z�Tests suite for MaskedArray.
Adapted from the original test_ma by Pierre Gerard-Marchant

:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $

�N)�assert_warns�suppress_warnings)�assert_�assert_array_equal�assert_equal�assert_almost_equal)�array�arange�masked�MaskedArray�masked_array�getmaskarray�shape�nomask�ones�zeros�count)"�
atleast_1d�
atleast_2d�
atleast_3d�mr_�dot�polyfit�cov�corrcoef�median�average�unique�setxor1d�	setdiff1d�union1d�intersect1d�in1d�ediff1d�apply_over_axes�apply_along_axis�compress_nd�compress_rowcols�mask_rowcols�clump_masked�clump_unmasked�flatnotmasked_contiguous�notmasked_contiguous�notmasked_edges�
masked_all�masked_all_like�isin�diagflat�ndenumerate�stack�vstackc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestGenericcCsJtdtd�}tddgddgtd�}t||�t�ddgddgd��}td|d�}td	d	gd
d
g|d�}t||�td|d�}td	d	gd	d	ggd
d
gd
d
gg|d�}t||�t�ddd
dgfg�}td|d�}tddgddg|d�}t||�td|d�}tddgddg|d�}t||�td
|d�}tdggdgg|d�}t||�dS)N����dtype���maskr9�a�b�f��names�formats�rr�r:r:�r7r7�r=r?�Zbar?�Zbbr?�r:rD)r.�floatrr�npr9)�self�test�control�dt�rP�@/usr/lib64/python3.9/site-packages/numpy/ma/tests/test_extras.py�test_masked_all%s6

�
�
�
zTestGeneric.test_masked_allcCs�t�ddtfgdffg�}tj�d|�}tt|d�tjjj�tt|dd�tjjj�tt	|dd�d�t|ddj
d�t|ddjj
d�dS)Nr>�c�r:r:rDrP�rKr9�object�mar.r�type�corer�lenrZ_fill_value�rLZmy_dtype�
masked_arrrPrPrQ�"test_masked_all_with_object_nestedCsz.TestGeneric.test_masked_all_with_object_nestedcCsrt�dtdffg�}tj�d|�}tt|d�tjjj�tt	|d�d�t|dj
d�t|djj
d�dS)Nr>rTr:rDrPrUr[rPrPrQ�test_masked_all_with_objectOsz'TestGeneric.test_masked_all_with_objectcCs�tddgtd�}t|�}tddgddgtd�}t||�t�ddgddgd��}td	d	gd
d
g|d�}t|�}tddgd
d
g|d�}t||�t�ddd
dgfg�}tddgddg|d�}t|�}t||�dS)Nr:r7r8r;r=r>r?r@rCrD)�
r_rFrGrHrI)rrJr/rrKr9)rL�baserMrNrOrPrPrQ�test_masked_all_likeYs

�z TestGeneric.test_masked_all_likec	Cs�tdd�D]�}td|�D]�}tj|td�}tj||td�}td|�}|d|@dk|_d}||�D]}||j|��7}qf|t	kr�t
|����|�q|j|_t
|����|�qq
dS)Nr:�r7r8r)�rangerKr	�int�fullrr<�data�sumr*r�
compressed)	rLr?�i�j�k�jar=�s�slrPrPrQ�check_clumpms
zTestGeneric.check_clumpcCsVtt�d��}t|gd�<t|�}tdd�tdd�tdd�g}t||�|�t�dS)Nr_�rr:r7���	r�rqrbrr)rrKr	r
r)�slicerro�rLr=rMrNrPrPrQ�test_clump_masked}s
zTestGeneric.test_clump_maskedcCsNtt�d��}t|gd�<t|�}tdd�tdd�g}t||�|�t�dS)Nr_rprtrqrbrr)rrKr	r
r*rurrorvrPrPrQ�test_clump_unmasked�s
zTestGeneric.test_clump_unmaskedcCs�td�}t|�}t|td|j�g�tjdtd�|_t|td|j�g�t	||dk|dkB|dkB<t|�}t|tdd�tdd�g�t	|dd�<t|�}t|g�dS)	Nr_rr8rtrr�rqrs)
r	r+rru�sizerKr�boolr<r
)rLr=rMrPrPrQ�test_flatnotmasked_contiguous�sz)TestGeneric.test_flatnotmasked_contiguousN)�__name__�
__module__�__qualname__rRr]r^rarorwrxr|rPrPrPrQr5#s

r5c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	j
�d
gd�ddggd�dgdgfgd�gd�gdgd�gddggd�ggd�gfg�dd��Zdd�Z
dS) �TestAveragecCs$tgd�gd�d�}tdt|dd��tdt|gd�d��t|gd�d	d
�\}}td|�t|dk�t|dd�<tt|dd�jd	g�tgd�gd�d�}|�dd�}t|dd�d
f<tt|dd�ddg�tt|d
d�jdd	g�tddgt|dd��t|dd	d�\}}t|ddg�dS)N)���?�@�@)TFFF�r<r�r��axis)r�r�r�r���weightsT�r��returned�@r7r:r��r�r�r�)rrrrr
r<�reshape)rLZott�result�wtsrPrPrQ�test_testAverage1�s 
zTestAverage.test_testAverage1cCsBgd�}gd�gd�g}tdtjd�}tt|dd�d�tt|d|d�d�ttdtjd�d	td�g�}tt|d�tj�t�d��d
d�tt|dd�t�d�d
d	�tt|dd�t|dd�t|dd�d	g�tt|d|d
�d�tt|d|d�gd��tt|dd�t|dd�t|dd�d	g�td�}gd�}gd�gd�g}t	d�}gd�}	ttt
||�dd�d�ttt
||�dd�d�ttt
||�dd�jdg�ttt
||	�dd�d�tttt
||�dd��d�t
||�}
tt|
d�d�tt|
dd�gd��tt|
dd�ddg�tt|
d|d�gd��dS)N�rr:r:r:r:r�r:rrrrr:rqr8rr��@)r�r�r�r��(@r:r�g������
@)r�r�r�r�r��$@)rrr:r:rr)rr:r:r:r:r:Tr�)r�r���X@r�r�g@�@)r�r�r�r�r�r�)
r	rKZfloat_rrr�add�reducerrrr<r)rL�w1�w2�x�y�m1�m2Zm3Zm4Zm5�zrPrPrQ�test_testAverage2�sF& ���
�zTestAverage.test_testAverage2cCsftd�}td�d}t||g||ggddd�\}}tt|�t|��t|j|j�ttd�dddgdd�\}}tt|�t|��ttd�dd	�\}}tt|�t|��ttd�td�dd
�\}}tt|�t|��tddgddggt�}t|d
d
gdd
gg�}t|dd�}	t|	ddg�t|dd�}
t|
ddg�t|dd�}
t|
d�t|dd�}
t|
ddg�dS)Nrqrtr:Tr�)r7r7rtr�r�r�r�)r�r�r7�Fr���?r�r�g������@��?r�)r	rrrrrrJr)rLr=r>Zr1r�Zr2r�Za2dZa2dmZa2daZa2dmarPrPrQ�test_testAverage3�s*
zTestAverage.test_testAverage3cCs�t�gd���dd�}tjj|dgdgdggd�}t�gd���dd�}t||ddd�}td	gd
gdggdgdgdgg�}t||�dS)N�r7rtr�rtr:FTr�)r�ryrq)r�r��keepdimsr�r�r�)rKrr�rWrrr)rLr�r>�w�actualZdesiredrPrPrQ�test_testAverage4�s"zTestAverage.test_testAverage4cCs@ttddg��}t|d�ttgd�gd�d��}t|d�dS)Nr:r7r�)r:r7rtr��FFTTr�)rrr�rLr=rPrPrQ�test_onintegers_with_mask�s
z%TestAverage.test_onintegers_with_maskc
Cs�tjgd�gd�gtd�}tgd�gd�g|d�}t|�}t�|���}t|j|j�t|j|j�t|dd�}t|jdd�t|jdd�d	}t|j|j�t|j|j�t|d
d�}t|jd
d�t|jd
d�d	}t|j|j�t|j|j�t�gd�gd�g�}	t||	d
�}
tj|��|	|d
�}t|
j|j�t|
j|j�t||	dd�}t|j|	dd�t|j|	dd�d	}t|j|j�t|j|j�t||	d
d�}t|j|	d
d�t|j|	d
d�d	}t|j|j�t|j|j�dS)N)rrrr:r�rr:rrrr8)ry�?@y@@y@@y@ @)y"@��?y@@y@@y@@r�rr�r�r:)r�r�r�r�r�)r�r�r�r�r�r��r�r�)	rKrr{rrrhr�real�imag)
rLr<r=�av�expectedZav0Z	expected0Zav1Z	expected1r�ZwavZwav0Zwav1rPrPrQ�test_complexsR
����  
���zTestAverage.test_complexz<x, axis, expected_avg, weights, expected_wavg, expected_wsum�r:r7rtNr�)rtr�r:g�?� @)r:r7ry)r:rq�r)r�r�r�r:rt)r�r�g#@)r�r�r�c
Cs�tjj||dd�}|jt�|�ks&J�t||�tjj|||dd�}|jt�|�ksXJ�t||�tjj|||ddd�\}}	|jt�|�ks�J�t||�|	jt�|�ks�J�t|	|�dS)NT)r�r�)r�r�r�)r�r�r�r�)rKrWrrr)
rLr�r�Zexpected_avgr�Z
expected_wavgZ
expected_wsumZavgZwavgZwsumrPrPrQ�test_basic_keepdims0s

�

zTestAverage.test_basic_keepdimsc	Csftjjt�d��dd�gd�gd�gd�gd�}tgd�dd�}tgd�gd�d�}t|d|dd	�}t�gd
��}t||�t|d|dd	�}t�gd��}t||�tjjgd�gd
�d�}t|dddtjgd�}t|d�tjjgd�gd�gd�ggd�gd�gd�gd�}tjj|dtjdgdd�}tjjdtjtjdggd�d�}t||�t	|j
|j
�dS)Nrsrt�r:rr�rrrr�)ry��Frr�)�@g�@g�@)r�g0��N@g0��N@)r�r�r�r�r�r:r�r�)r�r��@r�)g"@r�r�r�)FTTF)TFTT)TFTFr�r��@)rKrWrr	r�rrr�nanrr<)	rLr=Zweights_unmaskedZweights_maskedZavg_unmaskedZexpected_unmaskedZ
avg_maskedZexpected_maskedZavg_expectedrPrPrQ�test_masked_weightsGsD��

�
���
�
zTestAverage.test_masked_weights)r}r~rr�r�r�r�r�r��pytest�mark�parametrizer�r�rPrPrPrQr��s "	,���
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestConcatenatorcCszttdtgd���td�}gd�}t||d�}t|dd|f}tt|t��t|gd��t|jt|dd|f�dS)N�r:r7rtr�ryrqry)r:rrrrr�r)r:r:r:r:r:rrr:r:r:r:r:)	rrrrrr�
isinstancerr<)rLr>�m�drSrPrPrQ�test_1dvszTestConcatenator.test_1dcCs0tj�dd�}tj�dd�}t�tj�dd�d�}t�tj�dd�d�}t||d�}t||d�}td||f}t|jdk�t|dd�dd�f|�t|dd�dd�f|�t|j	tj
d||f�t||f}t|jdk�t|dd�dd�f|�t|dd�dd�f|�t|j	tj
||f�dS)Nryrr��1)ryr_)r_ry)rK�random�randZround_rrrrrr<Zr_)rLZa_1Za_2Zm_1Zm_2Zb_1Zb_2r�rPrPrQ�test_2d�s zTestConcatenator.test_2dcCspttjjdf}t|jddg�t|jdd�tddgtjjf}t|jgd��t|jdd�ddg�dS)Nr:TFr7)FFT)rrKrWr
rr<rf)rLr�rPrPrQ�test_masked_constant�sz%TestConcatenator.test_masked_constantN)r}r~rr�r�r�rPrPrPrQr�ssr�c@seZdZdd�Zdd�ZdS)�
TestNotMaskedcCs�tt�d��dd�gd�gd�gd�gd�gd�gd�}t|d�}t|d	d
g�t|d	�}t|d	ddg�t|dd
dg�t|d�}t|d	ddg�t|dddg�t|jd�}t|d	d
g�t|jd	�}t|d	ddg�t|dddg�t|jd�}t|d	ddg�t|dddg�t|d<t|d	�}t|d	ddg�t|dddg�t|d�}t|d	ddg�t|dddg�dS)N�ry)rrr:rr)rrrr:r:)r:r:rrr)rrrrr)r:r:r:rrr�r��rr:r7rtr�r:)rtrtrtr�r�)rrr7rrt)r�r7r�r�r�)r�r�r�r�r�������)r:r:r7r�r�)rr:r7r�)rrr7rt)r�r7r�r�)rrKr	r�r-rrfr
�rLrfrMrPrPrQ�
test_edges�s>��




zTestNotMasked.test_edgesc
Cs,tt�d��dd�gd�gd�gd�gd�}t|d�}t|tdd	d�td
dd�tddd�g�t|d�}t|tdd
d�tddd�gtdd
d�tddd�gtdd
d�tddd�gtdd
d�tddd�gtddd�gtddd�ggtddd�gg�t|d
�}t|tdd	d�ggtddd�tddd�gg�dS)Nr�rtrr)rrrrr:r:r:r:)r:r:r:r:r:r:r:r:)rrrrrrr:rr�rr����r:r7rqrb)rrKr	r�r,rru)rLr=�tmprPrPrQ�test_contiguous�s:��



�
�
�zTestNotMasked.test_contiguousN)r}r~rr�r�rPrPrPrQr��s"r�c@s|eZdZdd�Zdd�Zdd�Zej�dgd��ej�d	d
ge	j
jdfe	j
jdfg�d
d���Z
dd�Zdd�Zdd�ZdS)�TestCompressFunctionsc	Cs(t�ttd����ddd�}t�d��t�}d|d<t||d�}t|�}t	|gd	�gd
�gd�ggd�gd
�gd�gg�t|d�}t	|gd�gd�gd�gd�ggd�gd�gd�gd�gg�t|d�}t	|gd�gd�gd�ggd�gd�gd�ggd�gd�gd�gg�t|d�}t|d�}t|d�}t	||�t	||�t	||�t|d�}t	|gd	�gd �gd
�gd�ggd!�gd"�gd#�gd$�ggd�gd%�gd
�gd�gg�t|d&�}t|d'�}t|d(�}t	||�t	||�t	||�t|d)�}t	|gd�gd�gd�ggd�gd�gd�gg�t|d*�}t	||�t|d+�}t	|gd	�gd
�gd�ggd!�gd#�gd$�ggd�gd
�gd�gg�t|d,�}t|d-�}t|d.�}t	||�t	||�t	||�t|d/�}t	|gd	�gd �gd
�gd�ggd�gd%�gd
�gd�gg�t|d0�}t	||�dS)1N�<rtr�ry�rtr�ryT�r:r:r:r�)rr7rtr�)r_��
�)����)�(�*�+�,)�2�4�5�6)�7�9�:�;rr�)ryrqrbrrrs)r_r�r�r�r�)r�r�r�r�r�)r��)r�r�r�)�-�.�/�0�1)r��3r�r�r�)r��8r�r�r�r:)��r�r�r�)�r�� �!�")�#�$�%�&�'rTr�)r�r7)ryrbrrrs)r�r�r�r�)r��r��)rrrr)rrrr	)r�r�r�r�r6r�)r�)rr:)rr��r:r7)r�r7)r:r�)r�r��rr7)rr�)
rKr�listrcr�r�astyper{r&r)rLr�r�r=�a2�a3Za4rPrPrQ�test_compress_nd�s�
���

���


����








����







���



����








���	
z&TestCompressFunctions.test_compress_ndcCs�tt�d��dd�gd�gd�gd�gd�}tt|�ddgdd	gg�tt|d
�gd�gd�g�tt|d
�d
dgddgdd	gg�t|jgd�gd�gd�gd�}tt|�d
dgdd	gg�tt|d
�gd�gd�g�tt|d
�d
dgddgdd	gg�t|jgd�gd�gd�gd�}tt|�d	gg�tt|d
�gd�g�tt|d
�dgdgd	gg�t|jgd�gd�gd�gd�}tt|�jd
�tt|d
�jd
�tt|d
�jd
�dS)Nrsrtr�r�r�r�ryrbrrrr�)rqrbrrr:r7�rr:rrq�rr:r7�rrr:)rrKr	r�rr'�_datarz�rLr�rPrPrQ�test_compress_rowcolsWs$�" "  z+TestCompressFunctions.test_compress_rowcolscCsHtt�d��dd�gd�gd�gd�gd�}tt|�jgd�gd�gd�g�tt|d�jgd�gd�gd�g�tt|d�jgd�gd�gd�g�t|jgd�gd	�gd�gd�}tt|�jgd	�gd�gd	�g�tt|d�jgd�gd�gd�g�tt|d�jgd	�gd	�gd	�g�t|jgd�gd	�gd�gd�}tt|�jgd�gd�gd
�g�tt|d�jgd�gd�gd�g�tt|d�jgd
�gd
�gd
�g�t|jgd�gd	�gd�gd�}tt|��	�t
u�tt|d��	�t
u�tt|d��	�t
u�tt|�j�	��tt|d�j�	��tt|d�j�	��dS)Nrsrtr�r�r�r�rr:r)r:r:rr)rrKr	r�rr(r<rr�allr
rrPrPrQ�test_mask_rowcolsksN�
��� 
��� 
��� z'TestCompressFunctions.test_mask_rowcolsr�)Nrr:�func�rowcols_axisrr:cCsttt�d��dd�gd�gd�gd�gd�}tt��,|||d�}t|t||��Wd�n1sf0YdS)Nrsrtr�r�r�r�)rrKr	r�r�DeprecationWarningrr()rLr�rrr��resrPrPrQ�#test_mask_row_cols_axis_deprecation�s�
z9TestCompressFunctions.test_mask_row_cols_axis_deprecationcCs�t�dd�}gd�}t||d��dd�}t||d��dd�}t||dd�}t|jddgdd	gg�t||dd�}t|jgd
�gd�gd�g�t||dd�}t|t�|�d	�|�d	���t||dd�}t|t�|�d	�|�d	���gd
�}t||d��dd�}t||d��dd�}t||dd�}t|jd	dgddgg�t||dd�}t|jgd�gd�gd
�g�t||dd�}t|t�|�d	�|�d	���t|t||��t||dd�}t|t�|�d	�|�d	���gd�}t||d��dd�}t||d��dd�}t||�}t|jt�t||�}t|jt�t|gd�d��dd�}t|gd�d��dd�}t||dd�}t|jddgd	d	gg�t||dd�}t|t�|�d	�|�d	���t||dd�}t|jgd�gd�gd�g�t||dd�}t|t�|�d	�|�d	���t|gd
�d��dd�}t|gd�d��dd�}t||dd�}t|jd	d	gddgg�t||�}t|t�|�d	�|�d	���t||dd�}t|jgd�gd�gd�g�t||dd�}t|t�|�d	�|�d	���t|gd
�d��dd�}t|gd�d��dd�}t||dd�}t|jdd	gddgg�t||dd�}t|t�|�d	�|�d	���t||dd�}t|jgd�gd
�gd�g�t||dd�}t|t�|�d	�|�d	���dS)Nr:rb)r:rrrrrr�r7rtT)�strictrr�r�F�rrrrrr:r)rrrrrr)rrr:rrr)	rKr	rr�rrr<�filledr)rL�nr�r=r>rSrPrPrQ�test_dot�sz


zTestCompressFunctions.test_dotcCsnt�d�}t|�}ttt||��tu�ttt||��tu�ttt||��tu�ttt||��tu�dS)Nrt)rK�eyerrrXrr�rLr=r>rPrPrQ�test_dot_returns_maskedarray�s
z2TestCompressFunctions.test_dot_returns_maskedarraycCsDtt�d��}tt�d��}t|||d�}t||u�t||�dS)Nrt)rtrt��out)rrKr%rrrr)rLr=r)rrPrPrQ�test_dot_out�s
z"TestCompressFunctions.test_dot_outN)r}r~rrrrr�r�r�rKrWZ	mask_rowsZ	mask_colsrr$r'r*rPrPrPrQr��sp �	F	r�c@seZdZdd�Zdd�ZdS)�TestApplyAlongAxiscCs@td��ddd�}dd�}t|d|�}t|ddgdd	gg�dS)
Nr�r7rtcSs|dS�Nr:rP)r>rPrPrQ�myfunc�sz*TestApplyAlongAxis.test_3d.<locals>.myfuncr:r�rbr_�r	r�r%r�rLr=r-ZxarPrPrQ�test_3d�szTestApplyAlongAxis.test_3dcCsFtd��ddd�}ddd�}t|d|dd�}t|dd	gd
dgg�dS)
Nr�r7rtrcSs|d|Sr,rP)r>�offsetrPrPrQr-�sz1TestApplyAlongAxis.test_3d_kwargs.<locals>.myfuncr:)r1ryrrr�)rr.r/rPrPrQ�test_3d_kwargs�s
z!TestApplyAlongAxis.test_3d_kwargsN)r}r~rr0r2rPrPrPrQr+�s
r+c@seZdZdd�ZdS)�TestApplyOverAxescCs�td��ddd�}ttj|ddg�}t�dgdgdggg�}t||�t||d�t	�<ttj|ddg�}t�d	gd
gdggg�}t||�dS)Nr�r7rtr�rr��\�|r�r�)
r	r�r$rKrgrrr
rr{)rLr=rMZctrlrPrPrQ�
test_basics
zTestApplyOverAxes.test_basicN)r}r~rr6rPrPrPrQr3sr3c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-S).�
TestMediancCs4tjjtjtjgtjtjggdd�}t|tj�dS)Nr�r�)rKrWr�infr�rL�rrPrPrQ�test_pytypes$zTestMedian.test_pytypecCs�tjjtj�tjtjgtjtjgg�dd�}t|tj�tjjtj�tjtjgtjtjgg�dd�}t|tj�tjjtjjtjtjgtjtjggdd�dd�}t|jd�tjjtjjtjtjgtjtjggdd�dd�}t|jd�dS)Nr�r�Tr�)rKrWrrr8rr<r9rPrPrQ�test_infs8
��
��
���
���zTestMedian.test_infcCslt�d�}ttj�|�d�tttj�|��tu�td�}ttj�|�d�tttj�|��tu�d}ttj�|�d�tttj�|��tu�t�d��	dd�}ttjj|dd	�tj|dd	��ttjj|d
d	�tj|d
d	��ttjj|d
d	�tu�t�d��	dd�}ttjj|dd	�tj|dd	��ttjj|d
d	�tj|d
d	��ttjj|d
d	�tu�dS)Nrsr�rrr�ryr��Hrr�r:gR@)
rKr	rrWrrrXrrcr�rrPrPrQ�test_non_masked(s"
    zTestMedian.test_non_maskedcCstt�d�dgddgdd�}ttj�|�d�ttj�|�jdd�tttj�|��t	u�tt�d	��
d
d�dgddgdd�}ttj�|�d
�ttj�|�jdd�tttj�|��t	u�tjj|ddd�}t|ddg�t|jdd�tt|�t	u�dS)z5test the examples given in the docstring of ma.medianrrrr�r:r�r�rP�shape mismatchr_r7ryrqr�r�T�r�Zoverwrite_inputr�r�r6N)rrKr	rrWrrrrXrr�)rLr�Zma_xrPrPrQ�test_docstring_examples=s"*z"TestMedian.test_docstring_examplescCs�d}td�D]�}dD]�}td||d�}t�t||�ddg�}|D]F\}}ztjj|||d�WqBty�t|||||f��YqB0qBt�|d|gddg�}|D]H\}}ztjj|||d�Wntj	y�Yq�0t|||||f��q�qqdS)	Nz5mask = %s, ndim = %s, axis = %s, overwrite_input = %sry)FTr:)�ndminr<FTr@)
rcr�	itertools�productrKrWr�	Exception�AssertionErrorZ	AxisError)rL�msgrBr<r��argsr�ZoverrPrPrQ�test_axis_argument_errorsLs"z$TestMedian.test_axis_argument_errorscCsDtddd�}ttj�|�d�tddd�}ttj�|�tjj�dS)Nr:Fr�T)rrrKrWrr
rrPrPrQ�test_masked_0ddszTestMedian.test_masked_0dcCs�tt�d�dd�}ttj�|�tjj�ttj�|�jdd�tt	tj�|��tjj
ju�tt�d�dd�}ttj�|�d�ttj�|�jdd�tt	tj�|��tu�tt�d�gd�d�}ttj�|�d	�ttj�|�jdd�tt	tj�|��tu�tt�d�gd
�d�}ttj�|�d�ttj�|�jdd�tt	tj�|��tu�tt�d�gd�d�}ttj�|�d
�ttj�|�jdd�tt	tj�|��tu�tt�d�gd�d�}ttj�|�d
�ttj�|�jdd�tt	tj�|��tu�tt�d�gd�d�}ttj�|�d	�ttj�|�jdd�tt	tj�|��tu�tt�d�gd�d�}ttj�|�d	�ttj�|�jdd�tt	tj�|��tu�dS)NryTr�rPr?Fr�r�r�)rr:r:r:r:r�)rr:r:rrr�r�rqr�r�)
rrKr	rrWrr
rrrXrYZMaskedConstantrrrPrPrQ�test_masked_1dks@zTestMedian.test_masked_1dcCsBttj�tgd�gd�d��jtj�tgd�gd�d��j�dS)Nr�r�r�r)rrKrWrrr�rLrPrPrQ�test_1d_shape_consistency�s�z$TestMedian.test_1d_shape_consistencycCs�d\}}tt�dd|��}t|dd�<|dd�<ttj||ftd��}|dd�|dd�df<t�t|��}td|�D]$}tj	�
|�|||dd�|f<qxtt|dd�df�d�tt|�d�tt|dd	�t�
|��tt|jdd	�t�
|��dS)
N)�er��r�r_���r8rr:r�)rrKZlinspacer
�emptyrJr	rZrcr�Zshufflerrr�T)rLr#�pr�r��idxrirPrPrQr��szTestMedian.test_2dcCs�tt�d��dd��}t|dd�<|dd�<tt|�d�tttj	�|��t
u�tt|dd�gd��tttj	j|dd��t
u�tt|d	d�gd
��tttj	j|d	d��t
u�tt|d	d�jgd��dS)Nrr_rt����-@rr�)�+@rVg/@r:)
rrrr_r�r�r�rrr)
r:r:r:rrrrr:r:r:)rrKr	r�r
rrrrXrWrr<rrPrPrQ�
test_2d_waxis�szTestMedian.test_2d_waxiscCs�tj�d��ddd�}t||ddk<tt|d�ddgdd	gddgd
d	gg�d|_tt|d�dd
gddgddgg�tj�d��ddd�}t||ddk<tt|d�dd
gddgddgg�dS)Nr�rtr�r7rr�rsrqr�r�)r�rtr7�cr_r�r�r�ryrrr�r�)rKrWr	r�r
rrrrrPrPrQr0�s("zTestMedian.test_3dcCsLtt�d��dd��}t|dd�<|dd�<tt|dd�t|dd��dS)Nrr_rtrUr�r�r:)rrKr	r�r
rrrrPrPrQ�
test_neg_axis�szTestMedian.test_neg_axiscCs�dD]~}tt�|��}t|dd�<|dd�<tt�d��}t||d�}|dkr\t|d�n
t|d�t||u�tt|�t	u�qdS)	N)r�>@r�g?@rtrUrPr(rrVg.@)
rrKr	r
rrrrrXr)rL�vr�r)r:rPrPrQ�test_out_1d�s
zTestMedian.test_out_1dcCsdD]�}tt�|��dd��}t|dd�<|dd�<tt�d��}t|d|d�}|dkr�td	gdgd
�d	gddgddgd
dgdd�}n>td	gdgd�d	gddgddgd
dgdd�}t||�t||u�tt	|�t
u�qdS)N)r�gD@rr[r_r�rtrUr:)r�r)rr�)r_r�r�r�TFr�r�)rWg�1@g�5@g�9@)rrKr	r�r
rrrrrXr)rLr\r�r)r:�erPrPrQ�test_out�s��
zTestMedian.test_outcCsFddgddgddgg}tj�|d�}ddg}ttjj|dd�|�dS)Nr�r�r�rr�)rKrWZmasked_equalrr)rLrfr\r�rPrPrQ�$test_single_non_masked_value_on_axis�s��z/TestMedian.test_single_non_masked_value_on_axiscCs�dtjdtd�fD�]
}tj�dtjdggd�g�}||_tjj|dd�}tt�	|��t
|tj�tjj|��dd�}tt�	|��t
|tj�tjj|dd�}tt
|�t�t
|dtjdg�tjj|dd�}tt
|�t�t
|tjd	g�tjj|d
d�}tt
|�t�t
|tjd	g�qtj�dtjdggd�g�}tjj|dd�d	f<t
tjj|dd�tj�t
tjj|dd�dtjdg�t
tjj|dd�tjdg�dS)NFrqr8r:rtr�r�rr7r�r�)rKrr{rWrr�r<rr�isscalarrZravelrrXrr
)rLr<Zdmr:rPrPrQ�test_nan�s.zTestMedian.test_nancCs�tj�t�d��}tj�t�d��}tj|d<tjj|d<ttjj|d|d�|�tj�t�d��}ttjj|d|d�|�tj�t�d	��}ttjj||d�|�dS)
N)r��rtr��r7r:rErr(�rtr:rP)	rKrWrrrr�r
rr)rL�or�rPrPrQ�test_out_nans
zTestMedian.test_out_nancCs�tj�tjdtd��}tjj|ddd�<tj|d<ttj�|�tj�ttjj|dd�tj�tj�tjdtd��	ddd��}t�|j
�ddk|_|��}tj|d	<tj|d
<ttj�|�tj�t
t�tj�|���tjj|dd�}tj|d<tj|d<ttj�|d�|�tjj|dd�}tj|d
<tj|d<ttj�|d�|�tjj|dd�}tj|d<tj|d<ttj�|d�|�dS)Nr�r8rtr7rr�r�r:r�)r:r:r7�r7rtr�r:rtr
)rKrWrr	rJr
r�rrr�rzr<�copyrrar)rLr=Zaorigr>rPrPrQ�test_nan_behaviors0
 







zTestMedian.test_nan_behaviorcCs�tjgd�gd�gtjd�}tjj||dkd�}ttjj|dd�d�ttjj|dd�jd�ttjj|d	d�|d	�ttj�|�d�dS)
N)rtrt�r8rtr�r:r�rlFr)rKrZuint8rWrrrr<r�rPrPrQ�test_ambigous_fill4szTestMedian.test_ambigous_fillcCstjtjfD�]�}t�|tjgtjtjgg�}tjj|t�|�d�}ttjj|dd�|tjg�ttjj|dd�|tjg�ttj�|�|�t�tjtj|gtjtj|gg�}tjj|t�|�d�}t	tjj|dd�|�t	tjj|dd�j
d�t	tjj|dd�|d�t	tj�|�|�t�||g||gg�}ttj�|�|�ttjj|dd�|�ttjj|dd�|�tj|d|dgdtjtjd	gd
tjtj|ggtjd�}tjj|t�|�d�}|dk�rttjj|dd�dd
|dg�ttj�|�d�n2ttjj|dd�dd
|dg�ttj�|�d�ttjj|dd�dd|g�tdd�D]�}tdd�D]�}t�tjg||g|gd�}tjj|t�|�d�}ttj�|�|�ttjj|dd�|�ttjj|dd�tjg||g|��qh�qZqdS)Nr�rr�r:Frbi����rPryr�r8r�r�r�g@g$�g"�g�rOr_r7)
rKr8rr�rWrZisnanrrrr<Zfloat32rc)rLr8r=rirjrPrPrQ�test_special=sL"��
  "�zTestMedian.test_specialcCs�tj�tjgtd��}t��B}|�t�ttj�	|�tj
�t|jdj
tu�Wd�n1sd0Ytj�tjgtdd��}t��P}|�t�t�ddt�ttj�	|�tj
�t|jdj
tu�Wd�n1s�0Ytj�tjgtdd��}ttjj	|dd�|�ttjj	|d	d�|�tj�tjtj
tdd��}tjd
d��F}t�ddt�ttjj	|dd�|�t|dj
tu�Wd�n1�s�0YdS)Nr8rrt)r9rB�always�r7r�r:T)�record)rKrWrrrJrrq�RuntimeWarningrrr�r�log�category�warnings�filterwarningsr�catch_warnings)rLr=r�r>rPrPrQ�
test_emptyhs&
2
2zTestMedian.test_emptycCsXtj�t�d��}tttj�|�t���t	�tj
|d<tttj�|�t���t	�dS)Nr�r7)rKrWrr	rrXrrrVrJr�)rLrfrPrPrQ�test_object�s
zTestMedian.test_objectN)r}r~rr;r<r>rArIrJrKrMr�rXr0rZr]r_r`rbrgrkrmrnrxryrPrPrPrQr7s,&	#	+r7c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestCovcCsttj�d��|_dS�Nr�)rrKr�r�rfrLrPrPrQ�setup_method�szTestCov.setup_methodcCsZ|j}tt�|�t|��ttj|dd�t|dd��ttj|ddd�t|ddd��dS)NF��rowvarT�r~�bias)rfrrKrrrPrPrQ�test_1d_without_missing�s�zTestCov.test_1d_without_missingcCsb|j�dd�}tt�|�t|��ttj|dd�t|dd��ttj|ddd�t|ddd��dS)Nrtr�Fr}Tr)rfr�rrKrrrPrPrQ�test_2d_without_missing�s�zTestCov.test_2d_without_missingcCs>|j}t|d<||��8}|��}tt�|�t|��ttj|dd�t|dd��ttj|ddd�t|ddd��zt|dd�Wnty�Yn0|dd�}tt�||ddd��t||ddd���ttj||ddd�dd�t||ddd�dd��ttj||ddd�ddd�t||ddd�ddd��dS)Nr�Fr}Tr�Zallow_maskedr:)rfr
�meanrhrrKr�
ValueError)rLr��nxrPrPrQ�test_1d_with_missing�s*�,��zTestCov.test_1d_with_missingcCs6|j}t|d<|�dd�}t�t|���t�}t�||j	�}||�
d�dd�df�d�}tt
|�t�
|�|jdd|d�tt
|dd�tj
|dd�|jd|�t�|j	|�}||�
d��d�}tt
|d	d
�tj
|d	d
�|jdd|d�tt
|d	dd�tj
|d	dd�|jd|�dS)Nr�rtr�r:rr�T�r�Fr}r)rfr
r�rKZlogical_notr
rrdrrRr�r"rrr)rLr�ZvalidZfracZxfrPrPrQ�test_2d_with_missing�s8 ��������zTestCov.test_2d_with_missingN)r}r~rr|r�r�r�r�rPrPrPrQrz�s
rzc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestCorrcoefcCs(ttj�d��|_ttj�d��|_dSr{)rrKr�r�rf�data2rLrPrPrQr|�szTestCorrcoef.setup_methodcCs�|j|j}}t�|�}t�||�}t���}t�d�ttt|dd�|�	td�t
tj|dd�t|dd��t
t|dd�|�t
t||dd�|�t
t|dd�|�t
t||dd�|�Wd�n1s�0YdS)Nror��Zddof�bias and ddof have no effectrrt�rfr�rKrrru�simplefilterrr�filterr)rLr�r�r�Z	expected2�suprPrPrQ�	test_ddof�s

zTestCorrcoef.test_ddofcCs�|j|j}}t�|�}t��l}t�d�ttt||dd�ttt||dd�ttt|dd�|�	td�t
t|dd�|�Wd�n1s�0YdS)NroTFr�r�r:r�)rLr�r�r�r�rPrPrQ�	test_bias�s

zTestCorrcoef.test_biascCs�|j}tt�|�t|��ttj|dd�t|dd��t��<}|�td�ttj|ddd�t|ddd��Wd�n1s~0YdS)NFr}r�Tr)rfrrKrrr�r�rLr�r�rPrPrQr��s
��z$TestCorrcoef.test_1d_without_missingcCs�|j�dd�}tt�|�t|��ttj|dd�t|dd��t��<}|�td�ttj|ddd�t|ddd��Wd�n1s�0YdS)Nrtr�Fr}r�Tr)rfr�rrKrrr�rr�rPrPrQr��s
��z$TestCorrcoef.test_2d_without_missingc	Cs�|j}t|d<||��8}|��}tt�|�t|��ttj|dd�t|dd��t��<}|�t	d�ttj|ddd�t|ddd��Wd�n1s�0Yzt|dd�Wnt
y�Yn0|dd�}tt�||ddd��t||ddd���ttj||ddd�dd�t||ddd�dd��t��|}|�t	d�tt�||ddd��t||ddd�dd	��tt�||ddd��t||ddd�d
d��Wd�n1�s�0YdS)Nr�Fr}r�Trr�r:r�r7r�)rfr
r�rhrrKrrr�rr�)rLr�r�r�rPrPrQr�s<
��",���z!TestCorrcoef.test_1d_with_missingcCs$|j}t|d<|�dd�}t|�}t�|�}t|dd�dd�f|dd�dd�f�t���}|�td�tt|dd�dd�dd�f|dd�dd�f�tt|dd�dd�dd�f|dd�dd�f�tt|dd�dd�dd�f|dd�dd�f�Wd�n1�s0YdS)	Nr�rtr�r�r�r�r:r�)	rfr
r�rrKrrr�r)rLr�rMrNr�rPrPrQr�&s"
*���z!TestCorrcoef.test_2d_with_missingN)
r}r~rr|r�r�r�r�r�r�rPrPrPrQr��s
r�c@seZdZdd�Zdd�ZdS)�TestPolynomialcCs�tj�d�}tj�d��dd�}tt||d�t�||d��|�t�}t|d<|�t�}t|d<|d<t||dd�dfdd	d
�\}}}}}tj|dd�|dd�df�	�dd	d
�\}}	}
}}t
|||||f||	|
||f�D]\}
}t|
|�q�t||dd�dfdd	d
�\}}}}}tj|dd�|dd�dfdd	d
�\}}	}
}}t
|||||f||	|
||f�D]\}
}t|
|��qht||dd	d
�\}}}}}tj|dd�|dd�dd�fdd	d
�\}}	}
}}t
|||||f||	|
||f�D]\}
}t|
|��q�tj�d�d}|��}|dd�}|dd�}|dd�}t||dd	|d�\}}}}}tj||dd	|d�\}}	}
}}t||�t
|||||f||	|
||f�D]\}
}t|
|��q�dS)
Nr_r�r�r7rtrrC�r�r�T�rer:)rer�)
rKr�r�r�rr�viewrr
rh�ziprjr)rLr�r��C�R�K�S�DrSr:rkrmr�r=�a_r�ZwoZxsZys�wsrPrPrQ�test_polyfit<s>

&"�&&0&4&
&zTestPolynomial.test_polyfitcCs�tj�d�}tj�d��dd�}tj|d<tj|d<|�t�}|�t�}t|d<t|d<t||ddd	�\}}}}}tj|d
d�|d
d�dd�fddd	�\}}	}
}}t	|||||f||	|
||f�D]\}
}t
|
|�q�dS)Nr_r�r�r7rr�rtTr�r:)rKr�r�r�r�r�rr
rr�r)rLr�r�r�r�r�r�r�rSr:rkrmr�r=r�rPrPrQ�test_polyfit_with_masked_NaNscs



4&z,TestPolynomial.test_polyfit_with_masked_NaNsN)r}r~rr�r�rPrPrPrQr�:s'r�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"�TestArraySetOpscCsngd�}t|ddd�}tt|dt��t|dtgd�gd�d��t|dgd	��t|d
gd��dS)N�r:r:r:r7r7rtT�Zreturn_indexZreturn_inverserr�r�r�r:)rrtryr7)rrrr:r:r7)rrr�rrrr�rPrPrQ�test_unique_onlistvsz"TestArraySetOps.test_unique_onlistcCs�tgd�gd�d�}t|ddd�}t|dtgd�gd�d��t|d	gd
��t|dgd��d
|_tgd�gd�d
d�}t|ddd�}t|dtgd�gd�d��t|d	gd
��t|dgd��dS)Nr�)rrr:rr:rr�Tr�r)r:r7rtr��rrrr:r:)rrtryr7r7)rrrtr:rtr7rt)rfr<�
fill_value)rrrr�r�rPrPrQ�test_unique_onmaskedarrays�z)TestArraySetOps.test_unique_onmaskedarraycCs�tgd�dd�}t|ddd�}t|dtdgdgd��t|ddg�t|dgd��t}t|ddd�}t|dtt��t|ddg�t|ddg�dS)	Nr�Tr�r�rr:r7r�)rrrr
r�rPrPrQ�test_unique_allmasked�sz%TestArraySetOps.test_unique_allmaskedcCsdtt�d�gd�d�}tgd�gd�d�}t|�}t||�t|�d�|�d��t|j|j�dS)Nry�r:rrrr:r�)r:r:r:r�)r:rrr:r)rrKr	rr#rr"r<)rLr�rNrMrPrPrQ�test_ediff1d�s
zTestArraySetOps.test_ediff1dcCs�tt�d�gd�d�}t|td�}tgd�gd�d�}t||�t|�d�|�d��t|j|j�t|gd�d�}tgd	�gd
�d�}t||�t|�d�|�d��t|j|j�dS)Nryr�r�)�to_begin)rr:r:r:r�)r:r:rrr:rr�)r:r7rtr:r:r:r�)rrrr:rrr:�	rrKr	r#r
rrr"r<�rLr�rMrNrPrPrQ�test_ediff1d_tobegin�s

z$TestArraySetOps.test_ediff1d_tobegincCs�tt�d�gd�d�}t|td�}tgd�gd�d�}t||�t|�d�|�d��t|j|j�t|gd�d�}tgd	�gd
�d�}t||�t|�d�|�d��t|j|j�dS)Nryr�r�)�to_end)r:r:r:r�r)r:rrr:r:rr�)r:r:r:r�r:r7rt)r:rrr:rrrr�r�rPrPrQ�test_ediff1d_toend�s

z"TestArraySetOps.test_ediff1d_toendcCs�tt�d�gd�d�}t|ttd�}tgd�gd�d�}t||�t|�d�|�d��t|j|j�t|gd�td�}tgd	�gd
�d�}t||�t|�d�|�d��t|j|j�dS)Nryr�r��r�r�)rr:r:r:r�r)r:r:rrr:r:rr�)rr:r:r:r�r:r7rt)r:r:rrr:rrrr�r�rPrPrQ�test_ediff1d_tobegin_toend�s
�
z*TestArraySetOps.test_ediff1d_tobegin_toendcCs�t�d�}t|�}tgd�gd�d�}t||�tt|t��t|�d�|�d��t|j	|j	�t|t
t
d�}tgd�gd�d�}tt|t��t|�d�|�d��t|j	|j	�dS)	Nry�r:r:r:r:�rrrrr�rr�r�r�)rKr	r#rrrr�rr"r<r
r�rPrPrQ�test_ediff1d_ndarray�s

z$TestArraySetOps.test_ediff1d_ndarraycCsTtgd�gd�d�}tgd�gd�d�}t||�}tgd�gd�d�}t||�dS)N)r:rtrtrtr�r�)rtr:r:r:)r:rtr�r)rr!r)rLr�r�rMrNrPrPrQ�test_intersect1d�s

z TestArraySetOps.test_intersect1dcCs$tgd�gd�d�}tgd�gd�d�}t||�}t|tgd���tgd�gd�d�}gd�}t||�}t|tgd�gd	�d��tgd
��}tgd��}t||�}tt|t��t|gd��tgd
�gd�d�}tgd�gd	�d�}t||�}tt|t��t|gd��tgtgg��dS)N�r:r7ryrbr��rrrrr:r��r:r7rtr�ryr�r!)rtr�rb)r:r7rtr�ry)rtr�rbr�r�r�)rqryr�r�)r:rrr7rt)rr:rr)rqryr�rr)rrrrr�rr�rLr=r>rMrPrPrQ�
test_setxor1d�s&



zTestArraySetOps.test_setxor1dcCs�t�d��gd��}t�gd��}d|d<t||d�}tgd�gd�d�}tdtd	�}d
|d<d
|d<d
|d
<t||�}tt|t	��t
||�t�|||j�|j@}t
||�dS)Nr�r�r:)r:r7rr�)	rr_r�rr:rtr�r�r)	rr:rr:rr:rr:r)rfr<r8Tr�r)rr7rt)rKr	r�rrr{r0rr�rrr<)rLr=r<r>ZecrSr�rPrPrQ�	test_isins �

zTestArraySetOps.test_isincCs�tgd�gd�d�}tgd�gd�d�}t||�}t|gd��tgd�gd�d�}tgd�gd	�d�}t||�}t|gd
��tgtgg��dS)Nr�r�r�r�r!)TTTFT�ryryr7r:r��r:ryr�r)TTFTT)rr"rrr�rPrPrQ�	test_in1ds

zTestArraySetOps.test_in1dcCs�tgd�gd�d�}tgd�gd�d�}tt�t||��t||dd��tgd�gd�d�}tgd	�gd
�d�}tt�t||��t||dd��tgtggdd��dS)Nr�r�r�r�r!T)�invertr�r�r)rrrKr�r"rr&rPrPrQ�test_in1d_invert*s  z TestArraySetOps.test_in1d_invertc	Cs�tgd�gd�d�}tgd�gd�d�}t||�}tgd�gd�d�}t||�tgd�gd�ggd	�gd
�gd�}tgd�gd�d�}tgd
�gd�d�}t||�}t||�tgtgg��dS)N)r:r7ryrbryr�r!r�r�)r:r7rtr�ryrbr�)rrrrrrr:rr�r�rr�r�)rr:r7rtr�ry)rr rr)	rLr=r>rMrNr�r�Zezr�rPrPrQ�test_union1d6s

$

zTestArraySetOps.test_union1dcCs�tgd�gd�d�}tgd��}t||�}t|tgd�gd�d��td�}td�}tt||�tdd	g��tgtjgd�}tt|g�jtj�dS)
N)rqryr�rbrbr:r7r:)rrrrrrrr:r�)r7r�rtrtr7r:ry)rqrbr�rr_rrrs)rrrr	rKZuint32r9r�rPrPrQ�test_setdiff1dHs
zTestArraySetOps.test_setdiff1dcCs8t�gd��}t�gd��}tt||�t�dg��dS)N)r=r>rS)r=r>rmrS)rKrrrr&rPrPrQ�test_setdiff1d_char_arrayUsz)TestArraySetOps.test_setdiff1d_char_arrayN)r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rPrPrPrQr�ts 		
r�c@seZdZdd�Zdd�ZdS)�
TestShapeBasecCsntgd�gd�d�}t|�}t|jd�t|jj|jj�t|jd�t|jj|jj�t|jj|jj�dS)Nrrr�rire)rrrrr<rfr&rPrPrQ�test_atleast_2d^szTestShapeBase.test_atleast_2dcCs�td�}t|jd�t|jj|j�t|jj|j�tdd�}|D]0}t|jd�t|jj|j�t|jj|j�qBtd�}t|jd�t|jj|j�t|jj|j�tdd�}|D]0}t|jd�t|jj|j�t|jj|j�q�td�}t|jd�t|jj|j�t|jj|j�tdd�}|D]2}t|jd�t|jj|j�t|jj|j��q*td�}t|jd�t|jj|jj�dS)Nr�rTr�rDr�)rrrr<rfrrr1)rLr>r=rPrPrQ�test_shape_scalarhs<


zTestShapeBase.test_shape_scalarN)r}r~rr�r�rPrPrPrQr�\s
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestNDEnumeratecCs�t�d��d�}tj|td�}t||d�}ttt�|��tt|���ttt|��tt|���ttt|��tt|dd���dS)Nr�)r:rtr7r8r�F�rh)	rKr	r�Z
zeros_liker{rrrr2)rLZordinaryZ
empty_maskZ	with_maskrPrPrQ�test_ndenumerate_nomasked�s
�
��z)TestNDEnumerate.test_ndenumerate_nomaskedcCs�td�}td�}td�}ttt|��g�ttt|��g�ttt|dd��ttt�d�dtg���ttt|��g�ttt|dd��ttt�d�dtg���dS)NrP)�dr�Fr�r�r�)r.rrr2r�rKZndindexr
)rLr=r>rSrPrPrQ�test_ndenumerate_allmasked�s��z*TestNDEnumerate.test_ndenumerate_allmaskedcCs�tt�d��d�gd�gd�gd�gd�}gd�}ttt|��|�tttt|dd	���|j�t|dd	�D]\}}t|||�qldS)
Nr�rcr�)r:r:rr:r�r�))rrq))r7rrr)rdrs)rEr_)rhr�Fr�)	rrKr	r�rrr2rZrz)rLr=�itemsZ
coordinate�valuerPrPrQ�test_ndenumerate_mixedmasked�s��z,TestNDEnumerate.test_ndenumerate_mixedmaskedN)r}r~rr�r�r�rPrPrPrQr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�	TestStackcCs�tgd�gd�d�}tgd�gd�d�}t||gdd�}t|jd�t|j|dj�t|j|d	j�t||g�}t|j|j�t|j|j�t||gd	d�}t|jd
�t|j|dd�dfj�t|j|dd�d	fj�dS)Nrrr��rsrrrbr�rr�rhr:�rtr7�rr3rrrr<r4rf�rLr=r>rSr�rPrPrQ�
test_stack_1d�szTestStack.test_stack_1dcCs�tgd�dd�}tgd�dd�}t||gdd�}t|jd�t|j|dj�t|j|d	j�t||g�}t|j|j�t|j|j�t||gd	d�}t|jd
�t|j|dd�dfj�t|j|dd�d	fj�dS)NrTr�r�Frr�rhr:r�r�r�rPrPrQ�test_stack_masks�szTestStack.test_stack_masksc
Cs�d}tj�dd|�}tj�dd|�}tj�dd|��t�}tj�dd|��t�}t||d�}t||d�}t||gdd�}d|}	t|j|	�t	|j
|dj
�t	|j
|dj
�t||gd	d�}|d}	t|j|	�t	|j
|d
j
�t	|j
|dj
�d}tj�dd|�}tj�dd|�}tj�dd|��t�}tj�dd|��t�}t||d�}t||d�}t||gdd�}d|}	t|j|	�t	|j
|dj
�t	|j
|dj
�t||gd	d�}|d}	t|j|	�t	|j
|d
j
�t	|j
|dj
�dS)
Nr�rr_r7r�r�r6r:r�).r).r:)rtr7r�ry)rKr�Zrandintrr{rr3rrrr<)
rLZshpZd1Zd2r�r�Za1rrSZc_shprPrPrQ�
test_stack_nd�sDzTestStack.test_stack_ndN)r}r~rr�r�r�rPrPrPrQr��sr�)L�__doc__rurCr�ZnumpyrKZ
numpy.testingrrZnumpy.ma.testutilsrrrrZ
numpy.ma.corerr	r
rrr
rrrrrZnumpy.ma.extrasrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r�r�r�r�r+r3r7rzr�r�r�r�r�r�rPrPrPrQ�<module>s<4�
O,F
}Ck:i7&

Zerion Mini Shell 1.0