
    d                         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 ddl
mZmZmZmZ  G d de          Z G d	 d
e          Z G d de          ZdS )    N)Filespecial_dtype)
direct_vfd   )utTestCase)r   r   UNICODE_FILENAMESclosed_tempfilec                   N    e Zd Zd Zd Z ej        ed          d             ZdS )
TestFileIDc                     t          dddd          5 }t          |j                                        t                    sJ 	 d d d            d S # 1 swxY w Y   d S )NzTestFileID.test_descriptor_corecoreFx)driverbacking_storemode)r   
isinstanceidget_vfd_handleint)selffs     3lib/python3.11/site-packages/h5py/tests/test_h5f.pytest_descriptor_corezTestFileID.test_descriptor_core   s    3F %C1 1 1 	:45ad1133S999999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   /AAAc                    t          j        d          }t          j                            |d          }	 t          |dd          5 }|j                                        }|                     |d           t          j	        |           d d d            n# 1 swxY w Y   t          j        |           d S # t          j        |           w xY 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   
descriptors        r   test_descriptor_sec2zTestFileID.test_descriptor_sec2   s    !"YZZVY//	"eF555 %T0022
##J222$$$% % % % % % % % % % % % % % %
 M&!!!!!FM&!!!!0   B9 ABB9 BB9 B B9 9CzODIRECT driver is supported on Linux if hdf5 is built with the appriorate flags.c                    t          j        d          }t          j                            |d          }	 t          |dd          5 }|j                                        }|                     |d           t          j	        |           d d d            n# 1 swxY w Y   t          j        |           d S # t          j        |           w xY w)Nz7h5py.lowtest.test_h5f.TestFileID.test_descriptor_directr   directr   r   r   r   r)   s        r   test_descriptor_directz!TestFileID.test_descriptor_direct&   s     !"[\\VY//	"eH3777 %1T0022
##J222$$$% % % % % % % % % % % % % % %
 M&!!!!!FM&!!!!r.   N)	__name__
__module____qualname__r   r-   r   
skipUnlessr   r1        r   r   r      se        : : :
	" 	" 	" R]:67 7	" 	"7 7	" 	" 	"r7   r   c                        e Zd Zd Zd Zd ZdS )TestCacheConfigc                    t          j        d          }t          j                            |d          }	 t          |d          5 }|j                                        }|j                                        }d d d            n# 1 swxY w Y   t          j
        |           d S # t          j
        |           w xY 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_sizes         r   test_simple_getsz TestCacheConfig.test_simple_gets6   s    !"effVY//	"e#&&& 0!511335--//0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 M&!!!!!FM&!!!!s/   B' 3B:B' B

B' B
B' 'B=c                    t          j        d          }t          j                            |d          }	 t          |d          5 }|j                                        }|j                                         |j                                        }|dk    sJ 	 d d d            n# 1 swxY w Y   t          j
        |           d S # t          j
        |           w xY w)NzCh5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_hitrate_resetr   r   r;   r   )r    r!   r"   r#   r$   r   r<   r=   reset_mdc_hit_rate_statsr'   r(   )r   r*   r+   r   r?   s        r   test_hitrate_resetz"TestCacheConfig.test_hitrate_resetA   s	   !"ghhVY//	"e#&&& %!51133..000511331}}}}}	% % % % % % % % % % % % % % % M&!!!!!FM&!!!!s0   C	 AB(C	 (B,,C	 /B,0C	 	Cc                    t          j        d          }t          j                            |d          }	 t          |d          5 }|j                                        }|j                            |           d d d            n# 1 swxY w Y   t          j
        |           d S # t          j
        |           w xY w)NzDh5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_mdc_config_getr   r   r;   )r    r!   r"   r#   r$   r   r<   get_mdc_configset_mdc_configr'   r(   )r   r*   r+   r   confs        r   test_mdc_config_getz#TestCacheConfig.test_mdc_config_getN   s    !"hiiVY//	"e#&&& +!u++--$$T***+ + + + + + + + + + + + + + + M&!!!!!FM&!!!!s/   B( 4B;B( BB( BB( (B>N)r2   r3   r4   rA   rD   rI   r6   r7   r   r9   r9   5   sA        	" 	" 	"" " "" " " " "r7   r9   c                       e Zd Zd ZdS )TestVlenDatac                    t          j        d          }t          j                            |d          }	 t          |d          5 }t          t                    }t          |          }|                    dd|          }t          j
        g d	|          |d
<   t          j
        g d|          |d<   d d d            n# 1 swxY w Y   t          |d          5 }|d         }|d
                                         g dk    sJ |d                                         g dk    sJ 	 d d d            n# 1 swxY w Y   t          j        |           d S # t          j        |           w xY w)Nz7h5py.lowtest.test_h5f.TestVlenStrings.test_vlen_stringsr   wr;   )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dss          r   test_vlen_stringszTestVlenData.test_vlen_stringsZ   s   !"[\\VY//	"e#&&& M!(c222 -8 < < <%%fd-%HH///GGG1"5"5"5]KKK1M M M M M M M M M M M M M M M eS!! BQuX!u||~~);););;;;;!u||~~)A)A)AAAAAAB B B B B B B B B B B B B B B M&!!!!!FM&!!!!sU   E A4C;E CE CE "AD<0E <E  E E E E3N)r2   r3   r4   ri   r6   r7   r   rK   rK   Y   s#        " " " " "r7   rK   )r    r'   r"   numpyrb   h5pyr   r   h5py._hl.filesr   commonr   r   r	   r
   r   r9   rK   r6   r7   r   <module>rn      s     				     $ $ $ $ $ $ $ $ % % % % % %                 D D D D D D D D D D D D" " " " " " " "@!" !" !" !" !"h !" !" !"H" " " " "8 " " " " "r7   