o
    2hm                     @   s   d dl Z d dlZd dlZd dlZd dlmZmZ d dlm	Z	 ddl
mZmZ G dd deZG dd	 d	eZG d
d deZdS )    N)Filespecial_dtype)
direct_vfd   )utTestCasec                   @   s0   e Zd Zdd Zdd Zeeddd ZdS )	
TestFileIDc                 C   sJ   t ddddd}t|j tsJ W d    d S 1 sw   Y  d S )NTestFileID.test_descriptor_corecoreFx)driverbacking_storemode)r   
isinstanceidget_vfd_handleint)selff r   N/var/www/html/chatgem/venv/lib/python3.10/site-packages/h5py/tests/test_h5f.pytest_descriptor_core   s   "r	   c              	   C      t d}tj|d}z7t|ddd}|j }| |d t	| W d    n1 s/w   Y  W t
| d S W t
| d S t
| w )Nz5h5py.lowtest.test_h5f.TestFileID.test_descriptor_sec2test.h5sec2r   r   r   r   tempfilemkdtempospathjoinr   r   r   assertNotEqualfsyncshutilrmtreer   dn_tmpfn_h5r   
descriptorr   r   r   test_descriptor_sec2   s   

zTestFileID.test_descriptor_sec2zODIRECT driver is supported on Linux if hdf5 is built with the appriorate flags.c              	   C   r   )Nz7h5py.lowtest.test_h5f.TestFileID.test_descriptor_directr   directr   r   r   r   r&   r   r   r   test_descriptor_direct%   s   

z!TestFileID.test_descriptor_directN)	__name__
__module____qualname__r   r*   r   
skipUnlessr   r,   r   r   r   r   r      s    r   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestCacheConfigc              	   C   s   t d}tj|d}z0t|dd}|j }|j }W d    n1 s(w   Y  W t	
| d S W t	
| d S t	
| w )NzAh5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_simple_getsr   r   r   )r   r   r   r    r!   r   _idget_mdc_hit_rateget_mdc_sizer$   r%   )r   r'   r(   r   hit_ratemdc_sizer   r   r   test_simple_gets5   s   

z TestCacheConfig.test_simple_getsc              	   C   s   t d}tj|d}z;t|dd}|j }|j  |j }|dks)J W d    n1 s3w   Y  W t	
| d S W t	
| d S t	
| w )NzCh5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_hitrate_resetr   r   r2   r   )r   r   r   r    r!   r   r3   r4   reset_mdc_hit_rate_statsr$   r%   )r   r'   r(   r   r6   r   r   r   test_hitrate_reset@   s   



z"TestCacheConfig.test_hitrate_resetc              	   C   s   t d}tj|d}z1t|dd}|j }|j| W d    n1 s)w   Y  W t	
| d S W t	
| d S t	
| w )NzDh5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_mdc_config_getr   r   r2   )r   r   r   r    r!   r   r3   get_mdc_configset_mdc_configr$   r%   )r   r'   r(   r   confr   r   r   test_mdc_config_getM   s   

z#TestCacheConfig.test_mdc_config_getN)r-   r.   r/   r8   r:   r>   r   r   r   r   r1   4   s    r1   c                   @   s   e Zd Zdd ZdS )TestVlenDatac              	   C   s$  t d}tj|d}zt|dd0}ttd}t|d}|jdd|d}t	j
g d	|d|d
< t	j
g d|d|d< W d    n1 sFw   Y  t|d$}|d }|d
  g dksaJ |d  g dksmJ W d    n1 sww   Y  W t| d S W t| d S t| w )Nz7h5py.lowtest.test_h5f.TestVlenStrings.test_vlen_stringsr   wr2   )vlenz/com)   )dtype)abcr   )der   gr   rcom)   a   b   c)   d   e   f   g)r   r   r   r    r!   r   r   strcreate_datasetnparraytolistr$   r%   )r   r'   r(   hvlen_strvlen_vlen_strdsr   r   r   test_vlen_stringsY   s$   


zTestVlenData.test_vlen_stringsN)r-   r.   r/   r\   r   r   r   r   r?   X   s    r?   )r   r$   r   numpyrU   h5pyr   r   h5py._hl.filesr   commonr   r   r   r1   r?   r   r   r   r   <module>   s   	 $