B
    Z0dI
                 @   sR   d dl Z d dlZd dlmZ d dlmZ e dZ	e j
dd ZG dd dZdS )    N)ensure_clean_pathtablesc        
   
   c   s   t jddt jdddt jddd} d}|ddd|d d	dd|d d
dd|d dddg}d}tdz}t j|ddN}|jd|| d}x6|D ].}x| D ]\}}	|	|j|< qW |j	  qW W dQ R X ||t
|fV  W dQ R X dS )z4
    Use PyTables to create a simple HDF5 file.
    r   )pos         )Zc0c1c2g   $CAZaaaaaZbbbbbZccccci    Zdddddl    Zpandas_test_timeserieszwritten_with_pytables.h5w)mode/)namedescriptionN)r   Z	Time64ColZ	StringColZInt64Colr   	open_fileZcreate_tableitemsrowappendpdZ	DataFrame)
Ztable_schemat0Ztestsamplesobjnamepathftsamplekeyvalue r   V/var/www/html/venv/lib/python3.7/site-packages/pandas/tests/io/pytables/test_compat.pypytables_hdf5_file
   s"    



r   c               @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )TestReadPyTablesHDF5z
    A group of tests which covers reading HDF5 files written by plain PyTables
    (not written by pandas).

    Was introduced for regression-testing issue 11188.
    c             C   s,   |\}}}t j||d}|}t|| d S )N)r   )r   read_hdftmassert_frame_equal)selfr   r   r   dfresultexpectedr   r   r   test_read_complete4   s    
z'TestReadPyTablesHDF5.test_read_completec             C   s>   |\}}}t j||dd}|dd  jdd}t|| d S )Nr   )r   startT)drop)r   r!   reset_indexr"   r#   )r$   r   r   r   r%   r&   r'   r   r   r   test_read_with_start:   s    
z)TestReadPyTablesHDF5.test_read_with_startc             C   s>   |\}}}t j||dd}|d d jdd}t|| d S )Nr   )r   stopT)r*   )r   r!   r+   r"   r#   )r$   r   r   r   r%   r&   r'   r   r   r   test_read_with_stopA   s    
z(TestReadPyTablesHDF5.test_read_with_stopc             C   s@   |\}}}t j||ddd}|dd jdd}t|| d S )Nr   r   )r   r)   r-   T)r*   )r   r!   r+   r"   r#   )r$   r   r   r   r%   r&   r'   r   r   r   test_read_with_startstopH   s    
z-TestReadPyTablesHDF5.test_read_with_startstopN)__name__
__module____qualname____doc__r(   r,   r.   r/   r   r   r   r   r    ,   s
   r    )ZpytestZpandasr   Zpandas._testingZ_testingr"   Zpandas.tests.io.pytables.commonr   Zimportorskipr   Zfixturer   r    r   r   r   r   <module>   s   
"