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_utils.cpython-36.pyc
3

���h�@s�ddlZddlZddlmZmZddlmZddl	m
Z
Gdd�de
�ZGdd	�d	e
�ZGd
d�de
�Z
Gdd
�d
e
�ZGdd�de
�ZdS)�N)�ops�utils)�OrderedDict�)�TestCasec@seZdZdd�ZdS)�TestSafeCastToIndexcCs�tjddd�}tjd�}|tjdd�}xv||jftj|td�|jt�ftj|�|ftj|td�|jt�fgD].\}}t	j
|�}|j||�|j|j
|j
�qnWdS)Nz
2000-01-01�
)Zperiods�r�D)�dtype)�pdZ
date_range�np�arangeZtimedelta64�values�Index�objectZastyperZsafe_cast_to_indexZassertArrayEqual�assertEqualr)�self�dates�x�td�expected�array�actual�r�6/tmp/pip-build-5_djhm0z/xray/xarray/test/test_utils.py�test
s
"
zTestSafeCastToIndex.testN)�__name__�
__module__�__qualname__rrrrrr	src@seZdZdd�ZdS)�TestArrayEquivcCs\|jtjdtjdtd���|jtjtjtjtjtd���|jtjdtjdtd���dS)Nr)rr)�
assertTruerZarray_equivr
rr�nan�assertFalse)rrrr�test_0ds
zTestArrayEquiv.test_0dN)rrrr$rrrrr sr c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestDictionariescCs&ddd�|_ddd�|_ddi|_dS)N�A�B)�a�b�C)�cr)r(�Z)r�y�z)rrrr�setUp%szTestDictionaries.setUpcCs�|jtjdd��|jtjtjtj��|jtjdtjd���|jtjdgtjdg���|jtjtjdg�dg��|jtjtjd�dtjd���|jtjdtjd���dS)Nrg�g�?)	r!rZ
equivalentr
r"rrr#�zeros)rrrr�test_equivalent*s"z TestDictionaries.test_equivalentcCstj|j|j�dS)N)r�update_safety_checkrr-)rrrr�	test_safe3szTestDictionaries.test_safec
Cs*|jt��tj|j|j�WdQRXdS)N)�assertRaises�
ValueErrorrr3rr.)rrrr�test_unsafe7szTestDictionaries.test_unsafecCs8|jdditj|j|j��|jitj|j|j��dS)Nr)r')rrZordered_dict_intersectionrr-r.)rrrr�test_ordered_dict_intersection;s
z/TestDictionaries.test_ordered_dict_intersectioncCs>t�}d|d<tjdddg�|d<t�}tjdddg�|d<d|d<|jtj||��dddg|d<|jtj||��dddg|d<|jtj||��d|d	<|jtj||��tj|d	<tj|d	<|jtj||��tj|d	<tj|d	<|jtj||��t	|�}|jtj||��dtj
d�|d<|jtj||��dS)
Nr0r(r�r)g�?g@g@r+)rr
rr!rZ
dict_equivr#r"�inf�dictr)rrr-rrr�test_dict_equiv@s.



z TestDictionaries.test_dict_equivcCs�tj|j�}|jt��d|d<WdQRX|jt��|d=WdQRX|jt��|j|j�WdQRX|j|j	|j�|j
t|�d�dS)N�barZfoor(�Frozen({'a': 'A', 'b': 'B'})�Frozen({'b': 'B', 'a': 'A'}))r>r?)rZFrozenrr5�	TypeError�AttributeError�updater-r�mapping�assertIn�repr)rrrrr�test_frozenYs
zTestDictionaries.test_frozencCs@dddd�}tj|�}|j|dddg�|jttj��d�dS)	Nrr9r0)r(r)r+r(r)r+zSortedKeysDict({}))rZSortedKeysDict�assertItemsEqualrrE)rrr-rrr�test_sorted_keys_dictes

z&TestDictionaries.test_sorted_keys_dictcCs�tjddd�d
dd��}|jd|�|jd|�|jd	|�|j|dd�|j|dd�|j|d	d�d|d<|j|dd�|j|jddd�|jddd	g|�dS)Nrr)rr-�dr9)rr.rr-r.i����)r�ChainMaprDr�mapsrG)r�mrrr�test_chain_maplszTestDictionaries.test_chain_mapN)rrrr/r2r4r7r8r<rFrHrMrrrrr%$s	r%c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Test_is_uniform_and_sortedcCs|jtjtjd���dS)Nr	)r!r�is_uniform_spacedr
r)rrrr�test_sorted_uniform|sz.Test_is_uniform_and_sorted.test_sorted_uniformcCs|jdtjdddg��dS)NFr9r�Y���)rrrO)rrrr�test_sorted_not_uniformsz2Test_is_uniform_and_sorted.test_sorted_not_uniformcCs|jdtjdddg��dS)NFrr0���)rrrO)rrrr�test_not_sorted_uniform�sz2Test_is_uniform_and_sorted.test_not_sorted_uniformcCs|jdtjdddg��dS)NF�rrQ)rrrO)rrrr�test_not_sorted_not_uniform�sz6Test_is_uniform_and_sorted.test_not_sorted_not_uniformcCs|jtjddg��dS)Nrg333333�?)r!rrO)rrrr�test_two_numbers�sz+Test_is_uniform_and_sorted.test_two_numberscCs|jtjdddgdd��dS)Nrg
ףp=
�?r9g�������?)Zrtol)r!rrO)rrrr�test_relative_tolerance�sz2Test_is_uniform_and_sorted.test_relative_toleranceN)	rrrrPrSrUrWrXrYrrrrrNzsrNc@seZdZdd�ZdS)�
Test_hashablecCsRxdD]}|jtj|��qWx.ddgd	d
gddigD]}|jtj|��q6WdS)NFrr9r0rV�fourr	�Zseven�8�	Zten�r9�r0rV)Frr_r`r[)r!rZhashabler#)r�vrrr�
test_hashable�s
zTest_hashable.test_hashableN)rrrrbrrrrrZ�srZ)Znumpyr
ZpandasrZxarray.corerrZxarray.core.pycompatr�rrr r%rNrZrrrr�<module>sV