HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/pandas/tests/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/pandas/tests/__pycache__/test_lib.cpython-36.pyc
3

���h�@sfddlZddlZddlmZmZddlZddlm	Z	ddl
jZGdd�d�Z
Gdd�d�Zdd	�ZdS)
�N)�lib�writers)�Indexc@s$eZdZdd�Zdd�Zdd�ZdS)�TestMiscc
Cs�tjddtjgdd�}}tj|�dks,t�|jd�jt�}tj|�dksNt�|jd�jt�}tj|�dkspt�d}tj	t
|d	��tj|jd��WdQRXdS)
N�foo�b�object)�dtype��U�SzNo matching signature found)�match)�np�array�nan�
libwritersZmax_len_string_array�AssertionErrorZastyper�pytest�raises�	TypeError)�self�arr�a�msg�r�7/tmp/pip-build-5_djhm0z/pandas/pandas/tests/test_lib.py�test_max_len_string_arraysz"TestMisc.test_max_len_string_arraycCs�ddgddgddgg}dd�|D�}tjdddddg�}tj|dd	�}tjtj|�|�d
d�|D�}tjdddddg�}tj|dd	�}tjtj|�|�dS)N�pr�n�d�scss|]
}|VqdS)Nr)�.0�keyrrr�	<genexpr>!szCTestMisc.test_fast_unique_multiple_list_gen_sort.<locals>.<genexpr>T)�sortcss|]
}|VqdS)Nr)r!r"rrrr#&sF)rrrZfast_unique_multiple_list_gen�tm�assert_numpy_array_equal)r�keys�gen�expected�outrrr�'test_fast_unique_multiple_list_gen_sortsz0TestMisc.test_fast_unique_multiple_list_gen_sortcCs>tjdtjd�g�g}tjt��tj|dd�WdQRXdS)Nr�2000)r$)	rr�pdZ	Timestampr%Zassert_produces_warning�RuntimeWarningrZfast_unique_multiple)rrrrr�3test_fast_unique_multiple_unsortable_runtimewarning+sz<TestMisc.test_fast_unique_multiple_unsortable_runtimewarningN)�__name__�
__module__�__qualname__rr+r/rrrrrs
rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestIndexingcCs�tjd�}tjgtjd�}tj|t|��}t|t�s8t	�t
j||||�x�d
D]�}x�dD]�}tjd	||tjd�}tj|t|��}t|t�s�t	�t
j||||�|ddd�}tj|t|��}t|t�s�t	�t
j||||�q\WqRWx�dddd	gdddd	gd	dddgd
d	dgdd	dggD]X}tj|tjd�}tj|t|��}t|t��sXt	�t
j||�t
j||||��q"WdS)N�d)r	�����c�r)r5r6r7r8r9)r5r6r:������r<)r�aranger�intpr�maybe_indices_to_slice�len�
isinstance�slicerr%r&)r�target�indices�maybe_slice�end�step�caserrr�%test_maybe_indices_to_slice_left_edge2s*


8z2TestIndexing.test_maybe_indices_to_slice_left_edgec"CsFtjd�}x�dD]�}x�dD]�}tj|d
|tjd�}tj|t|��}t|t�sPt�t	j
||||�|ddd�}tj|t|��}t|t�s�t�t	j
||||�qWqWtjddd
dgtjd�}tj|t|��}t|t�s�t�t	j
||�d}tj
t|d
��||WdQRXtj
t|d
��||WdQRXtjdd
ddgtjd�}tj|t|��}t|t��srt�t	j
||�tj
t|d
��||WdQRXtj
t|d
��||WdQRXx~d
dd
dgd
d
ddgddddggD]X}tj|tjd�}tj|t|��}t|t��st�t	j
||�t	j
||||��q�WdS)Nr4rr6r7r8�a�br5r:r9)r	z7index 100 is out of bounds for axis (0|1) with size 100)r
�`)rr6r7r8rJrK)r5r6r:r;)rr=r>rr?r@rArBrr%r&rrr�
IndexError)rrC�startrGrDrErrHrrr�&test_maybe_indices_to_slice_right_edgeTsD


(z3TestIndexing.test_maybe_indices_to_slice_right_edgecCs tjd�}x�d
D]�}tjdd|tjd	�}tj|t|��}t|t�sFt�t	j
||||�|ddd�}tj|t|��}t|t�s�t�t	j
||||�qWx|ddddgddddgddddggD]V}tj|tjd	�}tj|t|��}t|t��s�t�t	j
||�t	j
||||�q�WdS)
N�
r5r6r:r7��	r)r	)r5r6r:r7rQrRr;r<)rr=r>rr?r@rArBrr%r&r)rrCrGrDrErHrrr�&test_maybe_indices_to_slice_both_edges�s 

(z3TestIndexing.test_maybe_indices_to_slice_both_edgescCs2tjd�}x�dD]�\}}x�dD]�}tj|||tjd�}tj|t|��}t|t�sTt�t	j
||||�|ddd�}tj|t|��}t|t�s�t�t	j
||||�qWqWx|dd
dd
gd
d
ddgddd
dggD]V}tj|tjd�}tj|t|��}t|t��s
t�t	j
||�t	j
||||�q�WdS)Nr4r6rPr7��ArJr5r:r8)r	����r6rP�r7rT�rUrJ)rYrZr[)r5r6r:r8r;)rr=r>rr?r@rArBrr%r&r)rrCrNrFrGrDrErHrrr�"test_maybe_indices_to_slice_middle�s"

(z/TestIndexing.test_maybe_indices_to_slice_middlecCs`tjdddddddgtjd�}tj|�}|jtjks8t�tj|dd��}|tdd�ks\t�dS)Nrr5)r	)	rrZuint8rZmaybe_booleans_to_slicer	Zbool_rrB)rr�resultrrr�test_maybe_booleans_to_slice�s

z)TestIndexing.test_maybe_booleans_to_slicec	CsVtjd
dddddddgtjd�}tj|d�}tjddddd	gtjd�}tj||�dS)
Nr5r6rr
r:)r	r7��r;r;r;)rrZint64rZget_reverse_indexerr%r&)rZindexerr]r)rrr�test_get_reverse_indexer�s z%TestIndexing.test_get_reverse_indexerN)	r0r1r2rIrOrSr\r^rarrrrr31s"4r3cCstjjdk	st�dS)N)rZhasnans�__doc__rrrrr�'test_cache_readonly_preserve_docstrings�src)ZnumpyrrZpandas._libsrrrZpandasr-rZpandas._testingZ_testingr%rr3rcrrrr�<module>s
&