HOME


sh-3ll 1.0
DIR:/usr/local/lib/python3.6/site-packages/xarray/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.6/site-packages/xarray/test/__pycache__/test_ops.cpython-36.pyc
3

���h��@shddlZddlmZmZddlmZddlmZmZm	Z	m
Z
ddlmZ
ddlmZGdd	�d	e�ZdS)
�N)�array�nan)�ops)�first�last�count�mean)�interleaved_concat�)�TestCasec@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestOpscCsNtttdtgtddtgdddtggtddd	gtd
dtgtdttggg�|_dS)
Ng@g@g@g @g"@g$@g*@g,@g.@g1@g2@g5@)rr�x)�self�r�4/tmp/pip-build-5_djhm0z/xray/xarray/test/test_ops.py�setUp
s


z
TestOps.setUpc
Csttdddgtddtgdddtgg�tdddtgtdd	dgg�tdddgdd
dgg�g}x>tdd
ddddgd|�D] \}}t|j|�}|j||�qtW|jd}t|jddd�}|j||�|jd}t|jddd�}|j||�|jtd��t|jd�WdQRXdS)N�
������	�
���rr
�F)�axis�skipna.z
out of bounds���������).rr")rr�ziprr
�assertArrayEqual�assertRaisesRegexp�
IndexError)r�expected_resultsr�expected�actualrrr�
test_firsts&



zTestOps.test_firstc
Csttdddgtddtgdddtgg�tdd	dtgtdddgg�td
ddgdddgg�g}x>tdd
d
dddgd
|�D] \}}t|j|�}|j||�qtW|jd}t|jddd�}|j||�|jd}t|jddd�}|j||�|jtd��t|jd�WdQRXdS)Nrrrr�rrrrrrrr
rF)rr.z
out of boundsr r!r"r"r").r"r")rrr#rr
r$r%r&)rr'rr(r)rrr�	test_last.s&



zTestOps.test_lastcCsD|jdt|j��tdddgdddgg�}|j|t|jdd��dS)N�r
rr)rr")ZassertEqualrr
rr$)rr(rrr�
test_countFszTestOps.test_countcCstjttjtjg��st�dS)N)�np�isnanrr�AssertionError)rrrr�test_all_nan_arraysLszTestOps.test_all_nan_arrayscCs��x�ttjtjgD�]n}tjd�}|j|||g|g��tjd�jdd�}tjd�jdddd�}|||�}tjdddddd	d
ddd
g
�}|j||�|jddd�}|||dd�}|j|jdd�|�||dgdggdd�}|j|j	|�||t
d�t
dd�gdd�}|j|j	|�|jt��|||dd�WdQRX|jt��|||dd�WdQRX|jt��||ddgdd�WdQRXqWdS)Nrrrr
�F)�orderrr�rr�r)rr"r"r"r!)
�interleaved_concat_numpyr�_interleaved_concat_slowr	r/Zaranger$Zreshaper�T�sliceZassertRaisesr&)rr	r
Zarrays�indicesr)r(Zarrays2rrr�test_interleaved_concatOs.

zTestOps.test_interleaved_concatcCs�x�ttjtjgD]�}tjdg�}tjdg�}|||gdgdgg�}tjddg�}|j||�tjtjgtd�}||||gdgdgdgg�}tjddtjgtd�}|j||�qWdS)N�aZbcrr
)Zdtyper)	r7rr8r	r/rr$r�object)rr	r=�br)r(�crrr�test_interleaved_concat_dtypesnsz&TestOps.test_interleaved_concat_dtypescCs�|jtjdgg��|jtjddgdddgg��|jtjtd�tdd�g��|jtjtddd�g��|jtjdgdgg��|jtjdgddgg��|jtjddgddgg��|jtjddgddgg��|jtjtddd�g��dS)Nrr
rrr6g@)ZassertFalserZ_interleaved_indices_requiredr:Z
assertTrue)rrrr�!test_interleaved_indices_required}sz)TestOps.test_interleaved_indices_requiredN)�__name__�
__module__�__qualname__rr*r,r.r2r<rArBrrrrrs	r)Znumpyr/rrZxarray.corerZxarray.core.opsrrrrZxarray.core.nputilsr	r7�rrrrrr�<module>s