HOME


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

���h>�@s�dZddlmZddlZddlZddljjZ	ddl
Zddlj
ZddlmZmZejd�Zeej�Zejjd�ZeejjGdd�d���ZdS)	z test feather-format compat �)�LooseVersionN)�read_feather�
to_feather�pyarrowzignore:The Sparsec@s�eZdZdd�Zdifdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jddd�dd��Zdd�Z
dd�Zdd�Zdd�Zdd�Ze
jddd�d d!��Ze
jd�ejd"d#���ZdS)$�TestFeathercCs8tj|��$tj��}t||�WdQRXWdQRXdS)N)�pytestZraises�tm�ensure_cleanr)�self�df�exc�path�r�>/tmp/pip-build-5_djhm0z/pandas/pandas/tests/io/test_feather.py�check_error_on_writes
z TestFeather.check_error_on_writeNc
KsJ|dkr|}tj��,}t||f|�t|f|�}tj||�WdQRXdS)N)rr	rr�assert_frame_equal)r
r�expected�write_kwargsZread_kwargsr
�resultrrr�check_round_trip s
zTestFeather.check_round_tripcCsFx@tjdddg�ddtjd�tjdddg�gD]}|j|t�q.WdS)N����foo�20130101)�pdZSeries�	Timestamp�np�arrayr�
ValueError)r
�objrrr�
test_error+szTestFeather.test_errorcCs"tjtd�ttdd��tjdd�jd�tjddd	d
�dtjdgdd
dgdtjd
gtjtd��tj	ttj
ddd��dd�tj	ttj
dddd��dd�tjd�tjtjd�gtj	ttj
dddd��dd�d��}t
td�kr�tjdddd�|d<tjddd�|d<|jjjjdk�st�|j|�dS)N�abcr�r��u1g@g@Zfloat64)�dtypeg�?TFr)�periods)�freqz
US/Eastern)r'�tzZ20130103�ns)r'r()�string�intZuint�floatZfloat_with_null�boolZbool_with_null�cat�dt�dttzZdt_with_nullZdtnsz
0.16.1.devZ2013�M)r(r'r'z1 dayZ
timedeltas)r�	DataFrame�list�ranger�arangeZastype�nanZCategoricalZ
DatetimeIndex�
date_rangerZNaT�pyarrow_versionrZperiod_rangeZtimedelta_ranger1r&r)�zone�AssertionErrorr)r
rrrr�
test_basic6s0


 zTestFeather.test_basiccCs4tjtjd�jdd�td�d�j�}|j|t�dS)N�r#rZaaa)�columns)	rr3rr6�reshaper4�copyrr)r
rrrr�test_duplicate_columns]s$z"TestFeather.test_duplicate_columnscCs,tjtjd�jdd��j�}|j|t�dS)Nr=r#r)rr3rr6r?r@rr)r
rrrr�test_stringify_columnsdsz"TestFeather.test_stringify_columnscCsPtjtd�ttdd��td�ttdd��d��}ddg}|j||||d	�dS)
Nr"rr#Zxyz�)�col1Zcol2�col3Zcol4rDrE)rr>)rr3r4r5r)r
rr>rrr�test_read_columnsiszTestFeather.test_read_columnsrz0.17.1)�min_versioncCs4tjddgddgddgd��}|j|dd	gd
�dS)Nrr�x�yTF)�A�B�CrKrJ)r>)rr3r)r
rrrr�read_columns_different_ordervsz(TestFeather.read_columns_different_ordercCs$tjddddgi�}|j|t�dS)N�arg@)rr3r�	Exception)r
rrrr�test_unsupported_other|sz"TestFeather.test_unsupported_othercCs4tjdtjd�i�}|j|dd�|j|dd�dS)NrJi��T)Zuse_threadsF)rr3rr6r)r
rrrr�test_rw_use_threads�szTestFeather.test_rw_use_threadsc	Cs�tjddddgi�}|j|�xPdddgtjddd�td�dddgtjjd
ddg�gD]}||_|j|t	�qVWdddg|_d|j_
|j|t	�dddg|_tjjdg�|_|j|t	�dS)NrJrrrr#r)r'r"rN�brr)rNr)rNr)rRr)rNr)rr3rr8r4Z
MultiIndex�from_tuples�indexrr�namer>)r
rrTrrr�test_write_with_index�s 
z!TestFeather.test_write_with_indexcCs,tj�j�}tj|jtj�}tj||�dS)N)r�
makeDataFrame�reset_indexZround_trip_pathlibrrrr)r
rrrrr�test_path_pathlib�szTestFeather.test_path_pathlibcCs,tj�j�}tj|jtj�}tj||�dS)N)rrWrXZround_trip_localpathrrrr)r
rrrrr�test_path_localpath�szTestFeather.test_path_localpathz
0.16.1.devcCs$tj�j�}|j|tdd�d�dS)Nr)�version)r)rrWrXr�dict)r
rrrr�test_passthrough_keywords�sz%TestFeather.test_passthrough_keywordscCs(d}tj|�}tj|�}tj||�dS)Nzmhttps://raw.githubusercontent.com/pandas-dev/pandas/master/pandas/tests/io/data/feather/feather-0_3_1.feather)rrrr)r
Zfeather_file�urlr�resrrr�test_http_path�s

zTestFeather.test_http_path)�__name__�
__module__�__qualname__rrr!r<rArBrF�tdZ
skip_if_norMrPrQrVrYrZr]r�networkr`rrrrrs '
r)�__doc__Zdistutils.versionrZnumpyrrZpandas.util._test_decorators�utilZ_test_decoratorsrdZpandasrZpandas._testingZ_testingrZpandas.io.feather_formatrrZimportorskipr�__version__r9�mark�filterwarningsZ
filter_sparseZsinglerrrrr�<module>s