a
    =Â×_ìm ã                   @   s€  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZzd dl	Z
dZW n eyn   dZY n0 d dlZd dlZd dlZd dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!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* d d	l+m,Z,m-Z- d d
l+m.Z/ G dd„ de/ƒZ0G dd„ de*j1e/ƒZ2G dd„ de2ƒZ3G dd„ de2ƒZ4G dd„ de2ƒZ5G dd„ de*j1e/ƒZ6e, 7e j8dkr°ej9dk pºej:j;dkd¡G dd„ de*j1e/ƒƒZ<G dd„ de*j1e/ƒZ=G dd „ d e*j1e/ƒZ>G d!d"„ d"e*j1e/ƒZ?e, 7d#e @¡  A¡ v d$¡e, 7e B¡ d%kd&¡G d'd(„ d(e*j1e/ƒƒƒZCe, 7ej9d)k d*¡G d+d,„ d,e*j1e/ƒƒZDG d-d.„ d.e/ƒZEe, 7e*jF d/¡G d0d1„ d1e*jGe/ƒƒZHdGd2d3„ZIe, 7e d4¡e, 7e @¡  A¡ d5v d6¡e, 7e*jF d/¡G d7d8„ d8e/ƒƒƒƒZJG d9d:„ d:e/ƒZKG d;d<„ d<e/ƒZLG d=d>„ d>e/ƒZMG d?d@„ d@e/ƒZNG dAdB„ dBe/ƒZOdCdD„ ZPeQdEkr|e* RejS¡ e* T¡  e,jUdDdF dS )Hé    NTF)ÚDescriptionÚIsDescriptionÚFloat64AtomÚColÚIntColÚInt16ColÚInt32ColÚFloatColÚ
Float64ColÚClosedFileErrorÚFileModeErrorÚFlavorErrorÚFlavorWarningÚNaturalNameWarningÚClosedNodeErrorÚ	NodeErrorÚNoSuchNodeErrorÚUnImplemented)Úall_flavorsÚarray_of_flavor)ÚNODE_CACHE_SLOTS)Údescr_from_dtypeÚdtype_from_descr)Úcommon)ÚunittestÚtest_filename)ÚPyTablesTestCasec                       s4   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Z‡  ZS )	ÚOpenFileFailureTestCasec                    s2   t t| ƒ ¡  dd l}t|jjƒ| _|jj| _d S )Nr   )	Úsuperr   ÚsetUpZtables.fileÚlenÚfileZ_open_filesÚNÚ
open_files)ÚselfÚtables©Ú	__class__© ú7lib/python3.9/site-packages/tables/tests/test_basics.pyr   )   s    zOpenFileFailureTestCase.setUpc                 C   s^   t  d¡}|  t¡" t |¡}| ¡  W d  ƒ n1 s<0    Y  |  | jt	| j
ƒ¡ dS )z(Checking opening of a non existing file.ú.h5N)ÚtempfileÚmktempÚassertRaisesÚIOErrorr%   Ú	open_fileÚcloseÚassertEqualr"   r    r#   ©r$   Úh5fnameÚh5filer(   r(   r)   Útest01_open_file1   s
    

&z(OpenFileFailureTestCase.test01_open_filec              	   C   sŠ   t  d¡}t|dƒ ¡  z`|  tj¡" t |¡}| ¡  W d  ƒ n1 sN0    Y  |  | j	t
| jƒ¡ W t |¡ nt |¡ 0 dS )z.Checking opening of an existing non HDF5 file.r*   ÚwbN)r+   r,   Úopenr0   r-   r%   ÚHDF5ExtErrorr/   r1   r"   r    r#   ÚosÚremover2   r(   r(   r)   Útest02_open_file;   s    

&z(OpenFileFailureTestCase.test02_open_filec              	   C   sP   t  d¡}t |d¡}| ¡  z |  ttj|d¡ W t |¡ nt |¡ 0 dS )z7Checking opening of an existing file with invalid mode.r*   ÚwZabN)	r+   r,   r%   r/   r0   r-   Ú
ValueErrorr9   r:   r2   r(   r(   r)   Útest03_open_fileL   s    
z(OpenFileFailureTestCase.test03_open_file)Ú__name__Ú
__module__Ú__qualname__r   r5   r;   r>   Ú__classcell__r(   r(   r&   r)   r   (   s   
r   c                       sT  e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Zd;d<„ Z d=d>„ Z!d?d@„ Z"dAdB„ Z#dCdD„ Z$dEdF„ Z%dGdH„ Z&dIdJ„ Z'dKdL„ Z(dMdN„ Z)dOdP„ Z*dQdR„ Z+dSdT„ Z,dUdV„ Z-dWdX„ Z.dYdZ„ Z/d[d\„ Z0d]d^„ Z1d_d`„ Z2dadb„ Z3dcdd„ Z4dedf„ Z5dgdh„ Z6didj„ Z7dkdl„ Z8dmdn„ Z9dodp„ Z:dqdr„ Z;dsdt„ Z<dudv„ Z=dwdx„ Z>dydz„ Z?d{d|„ Z@d}d~„ ZAdd€„ ZBdd‚„ ZCdƒd„„ ZDd…d†„ ZEd‡dˆ„ ZFd‰dŠ„ ZGd‹dŒ„ ZHddŽ„ ZIdd„ ZJ‡  ZKS )‘ÚOpenFileTestCasec                    s   t t| ƒ ¡  |  ¡  d S ©N)r   rC   r   ÚpopulateFile©r$   r&   r(   r)   r   _   s    zOpenFileTestCase.setUpc                 C   s>  | j j}| j j|dddgdd | j  |ddtƒ id¡ d	|j_| j  |d
dgd¡ | j  |ddtƒ id¡ | j  |dd¡}d|j_| j  |dg d¢d¡}d|j_| j  |ddgd¡ | j  |ddtƒ id¡ t	j
jdgdd}| j  |d|d¡ | j  |dd¡ | j  |dd ¡}| j  |d!d"¡ | j j|dddgdd d S )#NÚarrayé   é   úArray example©ÚtitleÚtableZvar1zTable exampleé)   ÚanarrayzArray titleÚatablezTable titleÚagroupzGroup titleé*   Úanarray1)rH   rI   é   é   é   é   é   úArray title 1Úanarray2úArray title 2Zatable1zTable title 1)rH   é   Úazu1,f4,a1)ZformatsÚatable2zTable title 2Úagroup2zGroup title 2Úagroup3úGroup title 3Úagroup4zGroup title 4)r4   ÚrootÚcreate_arrayÚcreate_tabler   Ú_v_attrsÚtestattrÚcreate_groupÚattrsÚnumpyZrecrG   )r$   rc   ÚgroupÚarray1ZraZgroup3r(   r(   r)   rE   c   s>    ÿÿ
þ
ÿÿÿzOpenFileTestCase.populateFilec                 C   s>   | j j| j jdddgdd | j jjjj}|  | ¡ d¡ dS )z Checking creation of a new file.Z	array_newrH   rI   rJ   rK   ÚArrayN)r4   rd   rc   rG   ri   ZCLASSr1   Ú
capitalize)r$   Zclass_r(   r(   r)   Útest00_newFile   s
    ÿzOpenFileTestCase.test00_newFilec              	   C   st   t  ¡ }zZttj |d¡ƒ}t |d¡}|  |tj	¡ W d   ƒ n1 sL0    Y  W t
 |¡ nt
 |¡ 0 d S ©Nztest.h5r<   )r+   ÚmkdtempÚstrr9   ÚpathÚjoinr%   r/   Ú
assertTrueÚFileÚshutilÚrmtree©r$   Ztemp_dirr3   r4   r(   r(   r)   Útest00_newFile_unicode_filename˜   s    .z0OpenFileTestCase.test00_newFile_unicode_filenamec              	   C   sv   t  ¡ }z\t tj |d¡¡}t |d¡}|  	|tj
¡ W d   ƒ n1 sN0    Y  W t |¡ nt |¡ 0 d S rp   )r+   rq   rj   Zstr_r9   rs   rt   r%   r/   ru   rv   rw   rx   ry   r(   r(   r)   Ú!test00_newFile_numpy_str_filename¡   s    .z2OpenFileTestCase.test00_newFile_numpy_str_filenamec              	   C   sv   t  ¡ }z\t tj |d¡¡}t |d¡}|  	|tj
¡ W d   ƒ n1 sN0    Y  W t |¡ nt |¡ 0 d S rp   )r+   rq   rj   Zunicode_r9   rs   rt   r%   r/   ru   rv   rw   rx   ry   r(   r(   r)   Ú%test00_newFile_numpy_unicode_filenameª   s    .z6OpenFileTestCase.test00_newFile_numpy_unicode_filenamec                 C   s.   | j | jd | jjj d¡}|  |d¡ dS )z%Checking opening of an existing file.©Únode_cache_slotsÚTITLErJ   N)Ú_reopenr~   r4   rc   rG   Úget_attrr1   ©r$   rL   r(   r(   r)   Útest01_openFile³   s    z OpenFileTestCase.test01_openFilec                 C   sZ   | j d| jd | jj| jjdddgdd | j | jd | jjj d	¡}|  |d¡ d
S )z/Checking appending objects to an existing file.úr+©Úmoder~   Úarray2rT   rU   úTitle example 2rK   r}   r   N©r€   r~   r4   rd   rc   r‡   r   r1   r‚   r(   r(   r)   Útest02_appendFile¾   s    ÿz"OpenFileTestCase.test02_appendFilec                 C   sZ   | j d| jd | jj| jjdddgdd | j | jd | jjj d	¡}|  |d¡ d
S )z<Checking appending objects to an existing file ("a" version)r]   r…   r‡   rT   rU   rˆ   rK   r}   r   Nr‰   r‚   r(   r(   r)   Útest02b_appendFile2Î   s    ÿz$OpenFileTestCase.test02b_appendFile2c                 C   sr   | j d| jd | jj| jjdddgdd | j | jd |  t¡ | jjj W d	  ƒ n1 sd0    Y  d	S )
z;Checking appending objects to an existing file in "w" mode.r<   r…   r‡   rT   rU   rˆ   rK   r}   N)r€   r~   r4   rd   rc   r-   ÚLookupErrorrG   rF   r(   r(   r)   Útest03_appendErrorFileà   s    ÿz'OpenFileTestCase.test03_appendErrorFilec                 C   s@   |   t¡" tjdd| jd W d  ƒ n1 s20    Y  dS )z0Checking opening a non-existing file for readingznonexistent.h5Úrr…   N)r-   r.   r%   r/   r~   rF   r(   r(   r)   Útest04a_openErrorFileð   s    ÿz&OpenFileTestCase.test04a_openErrorFilec                 C   sV   | j d| jd tjr"td| jƒ | jjj d¡}| jjj}|  	|¡ |  
|d¡ dS )z2Checking alternate root access to the object tree.ú/agroup©Zroot_uepr~   z
File tree dump:r   rY   N)r€   r~   r   ÚverboseÚprintr4   rc   rS   r   ÚassertIsNotNoner1   )r$   rL   rS   r(   r(   r)   Útest04b_alternateRootFile÷   s    ÿ

z*OpenFileTestCase.test04b_alternateRootFilec                 C   s>   |   t¡  | jd| jd W d  ƒ n1 s00    Y  dS )z>Checking non-existent alternate root access to the object treez/nonexistentr‘   N)r-   ÚRuntimeErrorr€   r~   rF   r(   r(   r)   Únotest04c_alternateRootFile  s    ÿz,OpenFileTestCase.notest04c_alternateRootFilec                 C   sÞ   | j d| jd |  t¡" | j | jjj¡ W d  ƒ n1 sB0    Y  | jj| jjddd | j | jd |  t¡ | jjj W d  ƒ n1 sš0    Y  |  t¡ | j 	d¡ W d  ƒ n1 sÐ0    Y  dS )	z&Checking removing a group recursively.r„   r…   NrQ   rH   ©Ú	recursiver}   ú/agroup/agroup3)
r€   r~   r-   r   r4   Úremove_noderc   rQ   rŒ   Úget_noderF   r(   r(   r)   Útest05a_removeGroupRecursively  s    0(z/OpenFileTestCase.test05a_removeGroupRecursivelyc                 C   sð   t jr tddƒ td| jj ƒ | jd| jd |  t¡" | j	 
| j	jd¡ W d  ƒ n1 sb0    Y  | j	j
| j	jddd	 |  t¡ | j	jj W d  ƒ n1 s¬0    Y  |  t¡ | j	 d
¡ W d  ƒ n1 sâ0    Y  dS )zKChecking removing a group recursively and access to it
        immediately.Ú
z<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=z,Running %s.test05b_removeGroupRecursively...r„   r…   rQ   NrH   r˜   rš   )r   r’   r“   r'   r?   r€   r~   r-   r   r4   r›   rc   rŒ   rQ   rœ   rF   r(   r(   r)   Útest05b_removeGroupRecursively)  s    
ÿ0(z/OpenFileTestCase.test05b_removeGroupRecursivelyc                 C   sF   | j d| jd |  t¡ | jj`W d  ƒ n1 s80    Y  dS )z0Checking removing a node using ``__delattr__()``r„   r…   N)r€   r~   r-   ÚAttributeErrorr4   rc   rQ   rF   r(   r(   r)   Útest06_removeNodeWithDelC  s    z)OpenFileTestCase.test06_removeNodeWithDelc                 C   sh   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W d  ƒ n1 sZ0    Y  dS )z7Checking removing a lonely group from an existing file.r„   r…   r_   r}   N)r€   r~   r4   r›   rc   r-   rŒ   r_   rF   r(   r(   r)   Útest06a_removeGroupM  s
    z$OpenFileTestCase.test06a_removeGroupc                 C   sh   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W d  ƒ n1 sZ0    Y  dS )z/Checking removing Leaves from an existing file.r„   r…   rO   r}   N©r€   r~   r4   r›   rc   r-   rŒ   rO   rF   r(   r(   r)   Útest06b_removeLeaf[  s
    z#OpenFileTestCase.test06b_removeLeafc                 C   sZ   | j d| jd | j | jjd¡ |  t¡ | jjj W d  ƒ n1 sL0    Y  dS )z3Checking removing Leaves and access it immediately.r„   r…   rO   Nr£   rF   r(   r(   r)   Útest06c_removeLeafh  s    z#OpenFileTestCase.test06c_removeLeafc                 C   sP   | j d| jd |  t¡" | j | jjd¡ W d  ƒ n1 sB0    Y  dS )z%Checking removing a non-existent noder„   r…   ÚnonexistentN)r€   r~   r-   rŒ   r4   r›   rc   rF   r(   r(   r)   Útest06d_removeLeafr  s    z#OpenFileTestCase.test06d_removeLeafc                 C   sh   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W d  ƒ n1 sZ0    Y  dS )z/Checking removing Tables from an existing file.r„   r…   rP   r}   N)r€   r~   r4   r›   rc   r-   rŒ   rP   rF   r(   r(   r)   Útest06e_removeTable{  s
    z$OpenFileTestCase.test06e_removeTablec                 C   sž   | j d| jd | j | jjjd¡ | j | jd | jjj}|  |jd¡ |  |j	d¡ |  |j
d¡ |  t¡ | jjj W d  ƒ n1 s0    Y  dS )z;Checking renaming a leave and access it after a close/open.r„   r…   rZ   r}   ú	/anarray2rH   N©r€   r~   r4   Úrename_noderc   rO   rZ   r1   ÚnameÚ_v_pathnameÚ_v_depthr-   rŒ   ©r$   Úarray_r(   r(   r)   Útest07_renameLeafˆ  s    
z"OpenFileTestCase.test07_renameLeafc                 C   s   | j d| jd | j | jjjd¡ | jjj}|  |jd¡ |  |j	d¡ |  |j
d¡ |  t¡ | jjj W d  ƒ n1 s‚0    Y  dS )z7Checking renaming Leaves and accesing them immediately.r„   r…   rZ   r©   rH   Nrª   r¯   r(   r(   r)   Útest07b_renameLeaf›  s    
z#OpenFileTestCase.test07b_renameLeafc                 C   sX   | j d| jd | j | jjjd¡ | jjj}d|j_|  	|j
d¡ |  	|jjd¡ dS )z:Checking renaming Leaves and modify attributes after that.r„   r…   rZ   ÚhelloN)r€   r~   r4   r«   rc   rO   rZ   ri   r   r1   rL   r¯   r(   r(   r)   Útest07c_renameLeaf«  s    
z#OpenFileTestCase.test07c_renameLeafc                 C   sD   | j d| jd | j | jjjjd¡ | jjjj}|  |j	d¡ dS )ú/Checking renaming a Group under a nested group.r„   r…   Úanarray3r[   N)
r€   r~   r4   r«   rc   rQ   rZ   r¶   r1   Ú_v_title©r$   Únoder(   r(   r)   Útest07d_renameLeaf·  s    z#OpenFileTestCase.test07d_renameLeafc                 C   sŽ   | j d| jd |  t¡$ | j | jjjd¡ W d  ƒ n1 sD0    Y  | jjj}| jj|ddd |  d| j¡ |  	| jjj
|¡ dS )z-Checking renaming a node to an existing name.r„   r…   rG   NT©Ú	overwritez/anarray)r€   r~   r-   r   r4   r«   rc   rO   ÚassertNotInÚassertIsrG   )r$   rO   r(   r(   r)   Útest08_renameToExistingLeafÁ  s    2
z,OpenFileTestCase.test08_renameToExistingLeafc              	   C   sˆ   | j d| jd t ¡ \ tjdtd |  t¡$ | j | jj	j
d¡ W d  ƒ n1 s\0    Y  W d  ƒ n1 sz0    Y  dS )z4Checking renaming a node to a non-valid natural namer„   r…   Úerror©Úcategoryzarray 2N)r€   r~   ÚwarningsÚcatch_warningsÚfilterwarningsr   r-   r4   r«   rc   rO   rF   r(   r(   r)   Ú#test08b_renameToNotValidNaturalNameÐ  s
    
z4OpenFileTestCase.test08b_renameToNotValidNaturalNamec                 C   sî   | j d| jd | j | jjjd¡ | j | jd | jjj}|  |jd¡ |  |j	d¡ | j 
d¡}|  |jd¡ |  |j	d¡ |  t¡ | jjj W d  ƒ n1 sª0    Y  |  t¡ | j 
d¡ W d  ƒ n1 sà0    Y  dS )	z;Checking renaming a Group and access it after a close/open.r„   r…   r`   r}   ú/agroup3ú/agroup3/agroup3Nrš   ©r€   r~   r4   r«   rc   rQ   r`   r1   Ú_v_namer­   rœ   r-   rŒ   ©r$   rk   Úgroup2r(   r(   r)   Útest09_renameGroupÜ  s    
(z#OpenFileTestCase.test09_renameGroupc                 C   sà   | j d| jd | j | jjjd¡ | jjj}|  |jd¡ |  |j	d¡ | j 
d¡}|  |jd¡ |  |j	d¡ |  t¡ | jjj W d  ƒ n1 sœ0    Y  |  t¡ | j 
d¡ W d  ƒ n1 sÒ0    Y  dS )z4Checking renaming a Group and access it immediately.r„   r…   r`   rÇ   rÈ   Nrš   rÉ   rË   r(   r(   r)   Útest09b_renameGroupø  s    
(z$OpenFileTestCase.test09b_renameGroupc                 C   sX   | j d| jd | j | jjjd¡ | jjj}d|j_|  	|j
d¡ |  	|jjd¡ dS )z;Checking renaming a Group and modify attributes afterwards.r„   r…   r`   ÚHelloN)r€   r~   r4   r«   rc   rQ   r`   rf   r   r1   r·   ©r$   rk   r(   r(   r)   Útest09c_renameGroup  s    
z$OpenFileTestCase.test09c_renameGroupc                 C   sD   | j d| jd | j | jjjjd¡ | jjjj}|  |j	d¡ dS )rµ   r„   r…   rb   ra   N)
r€   r~   r4   r«   rc   rQ   r`   rb   r1   r·   rÐ   r(   r(   r)   Útest09d_renameGroup  s    z$OpenFileTestCase.test09d_renameGroupc                 C   sˆ   | j d| jd | jjjjj}|  |¡ | jjdddd |  	d| j¡ |  	d| j¡ d	D ](}|  
|| j¡ |  || j |¡j¡ qZd
S )z>Checking renaming a Group with nested groups in the LRU cache.r„   r…   ú/rQ   Zagroup_)r¬   Únewnamez/agroup_/agroup4r   )z/agroup_z/agroup_/agroup3z/agroup_/agroup3/agroup4N)r€   r~   r4   rc   rQ   r`   rb   r”   r«   r½   ÚassertInr1   rœ   r­   )r$   ÚgÚnewpathr(   r(   r)   Útest09e_renameGroup'  s    
ÿz$OpenFileTestCase.test09e_renameGroupc                 C   s°   | j d| jd | j dd¡}| j | jjj|d¡ | j | jd | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ |  t¡ | jjj W d	  ƒ n1 s¢0    Y  d	S )
z9Checking moving a leave and access it after a close/open.r„   r…   rÓ   ÚnewgrouprZ   r}   ú/newgroup/anarray2rI   N©r€   r~   r4   rh   Ú	move_noderc   rO   rÙ   rZ   r1   r¬   r­   r®   r-   rŒ   ©r$   rÙ   r°   r(   r(   r)   Útest10_moveLeaf<  s    z OpenFileTestCase.test10_moveLeafc                 C   s¢   | j d| jd | j dd¡}| j | jjj|d¡ | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ |  t¡ | jjj W d  ƒ n1 s”0    Y  dS )	z;Checking moving a leave and access it without a close/open.r„   r…   rÓ   rÙ   rZ   rÚ   rI   NrÛ   rÝ   r(   r(   r)   Útest10b_moveLeafP  s    z!OpenFileTestCase.test10b_moveLeafc                 C   sj   | j d| jd | j dd¡}| j | jjj|d¡ | jjjj}d|j	_
|  |jd¡ |  |j	j
d¡ dS )z8Checking moving Leaves and modify attributes after that.r„   r…   rÓ   rÙ   rZ   r³   N)r€   r~   r4   rh   rÜ   rc   rO   rÙ   rZ   ri   r   r1   rL   rÝ   r(   r(   r)   Útest10c_moveLeafa  s    z!OpenFileTestCase.test10c_moveLeafc                 C   sX   | j d| jd |  t¡* | j | jjj| jjd¡ W d  ƒ n1 sJ0    Y  dS )z+Checking moving a leaf to an existing name.r„   r…   rG   N)r€   r~   r-   r   r4   rÜ   rc   rO   rF   r(   r(   r)   Útest10d_moveToExistingLeafn  s
    ÿz+OpenFileTestCase.test10d_moveToExistingLeafc                 C   s°   | j d| jd | j dd¡}| j | jjj|d¡ | j | jd | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ |  t¡ | jjj W d	  ƒ n1 s¢0    Y  d	S )
z9Checking moving a table and access it after a close/open.r„   r…   rÓ   rÙ   r^   r}   ú/newgroup/atable2rI   N©r€   r~   r4   rh   rÜ   rc   rP   rÙ   r^   r1   r¬   r­   r®   r-   rŒ   ©r$   rÙ   Útable_r(   r(   r)   Útest10_2_moveTablex  s    z#OpenFileTestCase.test10_2_moveTablec                 C   s¢   | j d| jd | j dd¡}| j | jjj|d¡ | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ |  t¡ | jjj W d  ƒ n1 s”0    Y  dS )	z;Checking moving a table and access it without a close/open.r„   r…   rÓ   rÙ   r^   râ   rI   Nrã   rä   r(   r(   r)   Útest10_2b_moveTableŒ  s    z$OpenFileTestCase.test10_2b_moveTablec                 C   sº   | j d| jd | j dd¡}| jjjj}| j | jjj|d¡ | jjjj	}|  
|jd¡ |  
|jd¡ |  
|jd¡ |j}|  
|j|jj¡ |j}| ¡  | ¡  |  
|j|d ¡ d	S )
z@Checking moving a table and use cached row without a close/open.r„   r…   rÓ   rÙ   r^   râ   rI   rH   N)r€   r~   r4   rh   rc   rP   ÚrowrÜ   rÙ   r^   r1   r¬   r­   r®   rM   ÚnrowsÚappendÚflush)r$   rÙ   rè   rå   ré   r(   r(   r)   Útest10_2b_bis_moveTable  s    z(OpenFileTestCase.test10_2b_bis_moveTablec                 C   sj   | j d| jd | j dd¡}| j | jjj|d¡ | jjjj}d|j	_
|  |jd¡ |  |j	j
d¡ dS )z8Checking moving tables and modify attributes after that.r„   r…   rÓ   rÙ   r^   r³   N)r€   r~   r4   rh   rÜ   rc   rP   rÙ   r^   ri   r   r1   rL   rä   r(   r(   r)   Útest10_2c_moveTable·  s    z$OpenFileTestCase.test10_2c_moveTablec                 C   sX   | j d| jd |  t¡* | j | jjj| jjd¡ W d  ƒ n1 sJ0    Y  dS )z,Checking moving a table to an existing name.r„   r…   rM   N)r€   r~   r-   r   r4   rÜ   rc   rP   rF   r(   r(   r)   Útest10_2d_moveToExistingTableÄ  s
    ÿz.OpenFileTestCase.test10_2d_moveToExistingTablec                 C   sL   | j d| jd | jjj}| jj|| jjddd | jjj}|  ||¡ dS )z<Checking moving a table to an existing name, overwriting it.r„   r…   rM   Tr»   N)r€   r~   r4   rc   rP   rÜ   rM   r¾   ©r$   ÚsrcNodeÚdstNoder(   r(   r)   Ú&test10_2e_moveToExistingTableOverwriteÎ  s    
ÿ
z7OpenFileTestCase.test10_2e_moveToExistingTableOverwritec                 C   s"  | j d| jd | j | jjd¡}| j | jjj|d¡ | j | jd | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ | j d¡}|  	|j
d¡ |  	|jd¡ |  	|jd	¡ |  t¡ | jjj W d
  ƒ n1 sÜ0    Y  |  t¡ | j d¡ W d
  ƒ n1 s0    Y  d
S )z9Checking moving a Group and access it after a close/open.r„   r…   rÙ   r`   r}   ú/newgroup/agroup3rI   ú/newgroup/agroup3/agroup3rT   Nrš   ©r€   r~   r4   rh   rc   rÜ   rQ   rÙ   r`   r1   rÊ   r­   r®   rœ   r-   rŒ   ©r$   rÙ   rk   rÌ   r(   r(   r)   Útest11_moveGroupÚ  s     (z!OpenFileTestCase.test11_moveGroupc                 C   s  | j d| jd | j | jjd¡}| j | jjj|d¡ | jjjj}|  	|j
d¡ |  	|jd¡ |  	|jd¡ | j d¡}|  	|j
d¡ |  	|jd¡ |  	|jd¡ |  t¡ | jjj W d	  ƒ n1 sÎ0    Y  |  t¡ | j d
¡ W d	  ƒ n1 s0    Y  d	S )z2Checking moving a Group and access it immediately.r„   r…   rÙ   r`   ró   rI   rô   rT   Nrš   rõ   rö   r(   r(   r)   Útest11b_moveGroupù  s    (z"OpenFileTestCase.test11b_moveGroupc                 C   s†   | j d| jd | j | jjd¡}| j | jjj|d¡ | jjjj}d|j	_
d|j	_|  |jd¡ |  |j	j
d¡ |  |j	jd¡ dS )z9Checking moving a Group and modify attributes afterwards.r„   r…   rÙ   r`   rÏ   N)r€   r~   r4   rh   rc   rÜ   rQ   rÙ   r`   rf   r   Zholar1   r·   )r$   rÙ   rk   r(   r(   r)   Útest11c_moveGroup  s    z"OpenFileTestCase.test11c_moveGroupc                 C   sX   | j d| jd |  t¡* | j | jjj| jjd¡ W d  ƒ n1 sJ0    Y  dS )z,Checking moving a group to an existing name.r„   r…   r_   N)r€   r~   r-   r   r4   rÜ   rc   rQ   rF   r(   r(   r)   Útest11d_moveToExistingGroup$  s
    ÿz,OpenFileTestCase.test11d_moveToExistingGroupc                 C   sL   | j d| jd | jjj}| jj|| jjddd | jjj}|  ||¡ dS )z<Checking moving a group to an existing name, overwriting it.r„   r…   rQ   Tr»   N)r€   r~   r4   rc   r_   rÜ   rQ   r¾   rï   r(   r(   r)   Ú$test11e_moveToExistingGroupOverwrite.  s    
ÿ
z5OpenFileTestCase.test11e_moveToExistingGroupOverwritec                 C   sH   | j d| jd | jjj}| j || jjd¡ | jjj}|  ||¡ dS )z#Checking moving a node over itself.r„   r…   rG   N)r€   r~   r4   rc   rG   rÜ   r¾   rï   r(   r(   r)   Útest12a_moveNodeOverItself;  s
    

z+OpenFileTestCase.test12a_moveNodeOverItselfc                 C   sX   | j d| jd |  t¡* | j | jjj| jjj¡ W d  ƒ n1 sJ0    Y  dS )z$Checking moving a group into itself.r„   r…   N)r€   r~   r-   r   r4   rÜ   rc   r_   rF   r(   r(   r)   Útest12b_moveGroupIntoItselfG  s
    ÿz,OpenFileTestCase.test12b_moveGroupIntoItselfc                 C   sF   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||¡ dS )zCopying a leaf.r„   r…   N)r€   r~   r4   Ú	copy_noderc   rG   r_   r¾   ©r$   Únew_noderñ   r(   r(   r)   Útest13a_copyLeafP  s    ÿz!OpenFileTestCase.test13a_copyLeafc                 C   sF   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||¡ dS )zCopying a group.r„   r…   N©r€   r~   r4   rþ   rc   r_   rQ   r¾   rÿ   r(   r(   r)   Útest13b_copyGroup\  s    ÿz"OpenFileTestCase.test13b_copyGroupc                 C   sF   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||¡ dS )zCopying a group into itself.r„   r…   N)r€   r~   r4   rþ   rc   r_   r¾   rÿ   r(   r(   r)   Útest13c_copyGroupSelfh  s    ÿz&OpenFileTestCase.test13c_copyGroupSelfc                 C   sz   | j d| jd | jj| jjj| jjjdd}| jjjj}|  ||¡ |j}|  	|¡ |j
}|  	|¡ |j}|  	|¡ dS )zRecursively copying a group.r„   r…   Tr˜   N)r€   r~   r4   rþ   rc   rQ   r_   r¾   rS   r”   rZ   r`   )r$   r   rñ   Z	dstChild1Z	dstChild2Z	dstChild3r(   r(   r)   Útest13d_copyGroupRecursivet  s    ÿ

z+OpenFileTestCase.test13d_copyGroupRecursivec              	   C   sª   | j d| jd t d¡}tj|d| jd}zd| jj| jj|jdd}|j}|  	||¡ |  
d|¡ |  
d|¡ |  
d	|¡ W | ¡  t |¡ n| ¡  t |¡ 0 d
S )zARecursively copying the root group into the root of another file.r„   r…   r*   r<   Tr˜   r   z/agroup/anarray1rš   N)r€   r~   r+   r,   r%   r/   r4   rþ   rc   r¾   rÕ   r0   r9   r:   ©r$   Úh5fname2Úh5file2r   rñ   r(   r(   r)   Útest13e_copyRootRecursive†  s$    
ÿÿÿz*OpenFileTestCase.test13e_copyRootRecursivec              	   C   sº   | j d| jd t d¡}tj|d| jd}zt| dd¡ | jj| jj	|j	j
dd}|j	j
}|  ||¡ |  d	|¡ |  d
|¡ |  d|¡ W | ¡  t |¡ n| ¡  t |¡ 0 dS )z@Recursively copying the root group into a group in another file.r„   r…   r*   r<   rÓ   r_   Tr˜   z/agroup2/agroupz/agroup2/agroup/anarray1z/agroup2/agroup/agroup3N)r€   r~   r+   r,   r%   r/   rh   r4   rþ   rc   r_   r¾   rÕ   r0   r9   r:   r  r(   r(   r)   Útest13f_copyRootRecursiveœ  s&    
ÿÿÿz*OpenFileTestCase.test13f_copyRootRecursivec                 C   sF   | j d| jd | jj}|  |¡ | jt| jj| jj| jjdd dS )z/Recursively copying the root group into itself.r„   r…   Tr˜   N)r€   r~   r4   rc   r”   r-   r.   rþ   )r$   r_   r(   r(   r)   Útest13g_copyRootItself´  s    
ÿz'OpenFileTestCase.test13g_copyRootItselfc                 C   sT   | j d| jd |  t¡& | jj| jjjdd W d  ƒ n1 sF0    Y  dS )zCopying over an existing node.r„   r…   rQ   ©rÔ   N)r€   r~   r-   r   r4   rþ   rc   r_   rF   r(   r(   r)   Útest14a_copyNodeExisting¿  s    z)OpenFileTestCase.test14a_copyNodeExistingc                 C   sB   | j d| jd | jj| jjjddd}| jjj}|  ||¡ dS )z.Copying over an existing node, overwriting it.r„   r…   rQ   T©rÔ   r¼   Nr  rÿ   r(   r(   r)   Ú!test14b_copyNodeExistingOverwriteÈ  s    ÿ
z2OpenFileTestCase.test14b_copyNodeExistingOverwritec              	   C   s¢   | j d| jd t d¡}tj|d| jd}z\| jj| jjj	j
|jd}| jj| jj|jddd}|j}|  ||¡ W | ¡  t |¡ n| ¡  t |¡ 0 dS )	z<Copying over an existing node in other file, overwriting it.r„   r…   r*   r<   )Z	newparentT)r¼   r™   N)r€   r~   r+   r,   r%   r/   r4   rþ   rc   rQ   rS   r¾   r0   r9   r:   r  r(   r(   r)   Ú"test14b2_copyNodeExistingOverwriteÔ  s$    
ÿÿÿÿz3OpenFileTestCase.test14b2_copyNodeExistingOverwritec                 C   sT   | j d| jd |  t¡& | jj| jjjdd W d  ƒ n1 sF0    Y  dS )zCopying over self.r„   r…   rQ   r  N©r€   r~   r-   r   r4   rþ   rc   rQ   rF   r(   r(   r)   Útest14c_copyNodeExistingSelfë  s    z-OpenFileTestCase.test14c_copyNodeExistingSelfc                 C   sV   | j d| jd |  t¡( | jj| jjjddd W d  ƒ n1 sH0    Y  dS )z'Copying over self, trying to overwrite.r„   r…   rQ   Tr  Nr  rF   r(   r(   r)   Ú%test14d_copyNodeExistingOverwriteSelfô  s
    ÿz6OpenFileTestCase.test14d_copyNodeExistingOverwriteSelfc                 C   s\   | j d| jd |  t¡. | jj| jjj| jjjdd W d  ƒ n1 sN0    Y  dS )z(Recursively copying a group into itself.r„   r…   Tr˜   Nr  rF   r(   r(   r)   Útest14e_copyGroupSelfRecursiveþ  s
    
ÿz/OpenFileTestCase.test14e_copyGroupSelfRecursivec                 C   sL   | j d| jd | jjj}| j || jjjd¡ | jjjj}|  ||¡ dS )z.Moving and renaming a node in a single action.r„   r…   rG   N)	r€   r~   r4   rc   rS   rÜ   rQ   rG   r¾   rï   r(   r(   r)   Útest15a_oneStepMove  s
    
z$OpenFileTestCase.test15a_oneStepMovec                 C   sH   | j d| jd | j | jjj| jjjd¡}| jjjj}|  ||¡ dS )z/Copying and renaming a node in a single action.r„   r…   rG   N)	r€   r~   r4   rþ   rc   rS   rQ   rG   r¾   rÿ   r(   r(   r)   Útest15b_oneStepCopy  s    ÿz$OpenFileTestCase.test15b_oneStepCopyc                 C   sŠ   | j d| jd | jjj}| jj|ddd}| jjj}|  ||¡ |  |j	j
|j	j
¡ |  |jjj
|jjj
¡ |  |j ¡ |j ¡ ¡ dS )z&Copying full data and user attributes.r„   r…   Ú	groupcopyT©rÔ   r™   N)r€   r~   r4   rc   rQ   rþ   r  r¾   r1   rf   rg   rS   ri   Úread©r$   rð   r   rñ   r(   r(   r)   Útest16a_fullCopy   s    
ÿ
ÿz!OpenFileTestCase.test16a_fullCopyc              	   C   s–   | j d| jd | jjj}| jj|ddddddd	}| jjj}|  ||¡ |  t	|j
d
ƒ¡ |  t	|jjd
ƒ¡ |  |j ¡ ddd… |j ¡ ¡ dS )z,Copying partial data and no user attributes.r„   r…   r  TFr   rV   rI   )rÔ   r™   ZcopyuserattrsÚstartÚstopÚsteprg   N)r€   r~   r4   rc   rQ   rþ   r  r¾   ZassertFalseÚhasattrrf   rS   ri   r1   r  r  r(   r(   r)   Útest16b_partialCopy1  s     
ý
ÿÿz$OpenFileTestCase.test16b_partialCopyc              	   C   sÚ   | j d| jd t d¡}tj|d| jd}z”| jj}| jj||jddd}|jj	}|  
||¡ |  |jj|jj¡ |  |jjjj|jjjj¡ |  |jj ¡ |jj ¡ ¡ W | ¡  t |¡ n| ¡  t |¡ 0 dS )	z:Copying full data and user attributes (from file to file).r„   r…   r*   r<   r  Tr  N)r€   r~   r+   r,   r%   r/   r4   rc   rþ   r  r¾   r1   rf   rg   rQ   rS   ri   r  r0   r9   r:   )r$   r  r  rð   r   rñ   r(   r(   r)   Útest16c_fullCopyD  s4    
ÿ
ÿ
ÿ

þ
ÿÿz!OpenFileTestCase.test16c_fullCopyc                 C   sN   | j d| jd | jjj}| jj|ddd}|  |jd¡ |  |j|j¡ dS )z"Copying dataset with a chunkshape.r„   r…   Ú	tablecopyr\   ©rÔ   Ú
chunkshape)r\   N)	r€   r~   r4   rc   rM   rþ   r1   r$  ÚassertNotEqual©r$   ÚsrcTableÚnewTabler(   r(   r)   Útest17a_CopyChunkshape`  s    
ÿz'OpenFileTestCase.test17a_CopyChunkshapec                 C   s@   | j d| jd | jjj}| jj|ddd}|  |j|j¡ dS )z4Copying dataset with a chunkshape with 'keep' value.r„   r…   r"  Úkeepr#  N©r€   r~   r4   rc   rM   rþ   r1   r$  r&  r(   r(   r)   Útest17b_CopyChunkshapek  s    
ÿz'OpenFileTestCase.test17b_CopyChunkshapec                 C   sR   | j d| jd | jjj}| jj|ddd}| jj|ddd}|  |j|j¡ dS )	z4Copying dataset with a chunkshape with 'auto' value.r„   r…   r"  r\   r#  Z
tablecopy2ÚautoNr+  )r$   r'  r(  Z	newTable2r(   r(   r)   Útest17c_CopyChunkshapeu  s    
ÿÿz'OpenFileTestCase.test17c_CopyChunkshapec                 C   sT   | j | jd | jjj| jjjfD ],}| ¡  |  dt|ƒ¡ |  dt	|ƒ¡ q"dS )z'Representing a closed node as a string.r}   ÚclosedN)
r€   r~   r4   rc   rQ   rO   Ú_f_closerÕ   rr   Úreprr¸   r(   r(   r)   Útest18_closedRepr  s
    z"OpenFileTestCase.test18_closedReprc                 C   s:   | j d| jd | j ¡ }tjr*td|ƒ |  |d¡ dS )z*Checking that the 'fileno()' method works.rŽ   r…   zValue of fileno():r   N)r€   r~   r4   Úfilenor   r’   r“   ÚassertGreaterEqual)r$   Úfdr(   r(   r)   Útest19_fileno‹  s
    

zOpenFileTestCase.test19_fileno)Lr?   r@   rA   r   rE   ro   rz   r{   r|   rƒ   rŠ   r‹   r   r   r•   r—   r   rŸ   r¡   r¢   r¤   r¥   r§   r¨   r±   r²   r´   rº   r¿   rÆ   rÍ   rÎ   rÑ   rÒ   rØ   rÞ   rß   rà   rá   ræ   rç   rì   rí   rî   rò   r÷   rø   rù   rú   rû   rü   rý   r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r   r!  r)  r,  r.  r2  r6  rB   r(   r(   r&   r)   rC   ]   s   *			

	




			



rC   c                   @   s   e Zd ZeZeedZdS )ÚNodeCacheOpenFiler}   N©r?   r@   rA   r   r~   ÚdictÚopen_kwargsr(   r(   r(   r)   r7  ˜  s   r7  c                   @   s   e Zd ZdZeedZdS )ÚNoNodeCacheOpenFiler   r}   N)r?   r@   rA   r~   r9  r:  r(   r(   r(   r)   r;    s   r;  c                   @   s   e Zd Ze ZeedZdS )ÚDictNodeCacheOpenFiler}   Nr8  r(   r(   r(   r)   r<  ¢  s   r<  c                       sž   e Zd Z‡ fdd„Z‡ fdd„Zdd„ Zdd„ Zd	d
„ Ze 	e
edƒoPe ¡ dkd¡dd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z‡  ZS )ÚCheckFileTestCasec                    sB   t t| ƒ ¡  t d¡| _t| jdƒ| _| j d¡ | j 	¡  d S )Nr*   r<   zHello!)
r   r=  r   r+   r,   Útxtfiler7   ÚfilehÚwriter0   rF   r&   r(   r)   r   ¨  s
    zCheckFileTestCase.setUpc                    s(   | j  ¡  t | j¡ tt| ƒ ¡  d S rD   )r?  r0   r9   r:   r>  r   r=  ÚtearDownrF   r&   r(   r)   rA  ±  s    
zCheckFileTestCase.tearDownc                 C   s^   | j j| j jdddgdd | j  ¡  tjrFtd| jt 	| j¡f ƒ |  
t 	| j¡d¡ dS )z2Checking  tables.is_hdf5_file function (TRUE case)rG   rH   rI   úTitle examplerK   z
isHDF5File(%s) ==> %dN)r4   rd   rc   r0   r   r’   r“   r3   r%   Úis_hdf5_filer1   rF   r(   r(   r)   Útest00_isHDF5File¶  s    ÿ
ÿz#CheckFileTestCase.test00_isHDF5Filec                 C   s   t  | j¡}|  |d¡ dS )z3Checking  tables.is_hdf5_file function (FALSE case)r   N)r%   rC  r>  ZassertLessEqual©r$   Úversionr(   r(   r)   Útest01_isHDF5FileÆ  s    z#CheckFileTestCase.test01_isHDF5Filec                 C   s   |   ttjd¡ dS )z$Identifying a nonexistent HDF5 file.r¦   N)r-   r.   r%   rC  rF   r(   r(   r)   Útest01x_isHDF5File_nonexistentÏ  s    z0CheckFileTestCase.test01x_isHDF5File_nonexistentÚgetuidr   zno UIDc                 C   s.   | j  ¡  t | jd¡ |  ttj| j¡ dS )z$Identifying an unreadable HDF5 file.r   N)	r4   r0   r9   Úchmodr3   r-   r.   r%   rC  rF   r(   r(   r)   Útest01x_isHDF5File_unreadableÓ  s    
z/CheckFileTestCase.test01x_isHDF5File_unreadablec                 C   sZ   | j j| j jdddgdd | j  ¡  t | j¡}tjrJt	ƒ  t	d| ƒ |  
|d¡ dS )	z.Checking is_pytables_file function (TRUE case)rG   rH   rI   rB  rK   ú&
PyTables format version number ==> %sz1.0N)r4   rd   rc   r0   r%   Úis_pytables_filer3   r   r’   r“   r4  rE  r(   r(   r)   Útest02_isPyTablesFileÛ  s    ÿ
z'CheckFileTestCase.test02_isPyTablesFilec                 C   s2   t  | j¡}tjr$tƒ  td| ƒ |  |¡ dS )z/Checking is_pytables_file function (FALSE case)rL  N)r%   rM  r>  r   r’   r“   ÚassertIsNonerE  r(   r(   r)   Útest03_isPyTablesFileî  s
    z'CheckFileTestCase.test03_isPyTablesFilec                 C   sÖ   t dƒ}tj|dd¬}|jddd}|  |jd¡ |j|dd	d}|  |jd¡ |j|d
d	d}|  |jd
¡ tjr–tdt	|ƒƒ td|dd… ƒ |jdddd}|  |jd¡ W d  ƒ n1 sÈ0    Y  dS )z(Checking opening of a generic HDF5 file.úex-noattr.h5rŽ   ©r†   z/columnsZGroup)Z	classnameÚcolumnsZTDCrm   Úpressurez$Array object with type H5T_ARRAY -->zArray contents -->Nz	/detectorrM   ZTable)
r   r%   r/   rœ   r1   rÊ   r   r’   r“   r1  )r$   r3   r4   rS  r°   ÚuirM   r(   r(   r)   Útest04_openGenericHDF5Fileú  s    z,CheckFileTestCase.test04_openGenericHDF5Filec              	   C   sv   t dƒ}t |¡P}|  t¡ | d¡}W d  ƒ n1 s>0    Y  |  |t¡ W d  ƒ n1 sh0    Y  dS )z@Checking failure loading resulting in an ``UnImplemented`` node.úsmpl_unsupptype.h5ú/CompoundChunkedN)r   r%   r/   ÚassertWarnsÚUserWarningrœ   ÚassertIsInstancer   )r$   r3   r4   r¹   r(   r(   r)   Útest04b_UnImplementedOnLoading  s
    	(z0CheckFileTestCase.test04b_UnImplementedOnLoadingc              	   C   sr   t  tdƒ¡P}|  t¡ | d¡}W d  ƒ n1 s:0    Y  |  |t¡ W d  ƒ n1 sd0    Y  dS )zVChecking opening of HDF5 files containing scalar dataset of
        UnImlemented type.z	scalar.h5z/variable length stringN)r%   r/   r   rY  rZ  rœ   r[  r   )r$   r4   r¹   r(   r(   r)   Útest04c_UnImplementedScalar&  s    (z-CheckFileTestCase.test04c_UnImplementedScalarc              	   C   s¾   t dƒ}tj|dd”}|  t|jd¡ t ¡ $ t d¡ | d¡}W d  ƒ n1 sZ0    Y  |  	|j
d¡ tjr†tdt|ƒƒ |  t|j| jjd	¡ W d  ƒ n1 s°0    Y  dS )
ú7Checking that an UnImplemented object cannot be copied.rW  rŽ   rR  rX  ÚignoreNZCompoundChunkedúUnImplement object -->Únewui)r   r%   r/   rY  rZ  rœ   rÃ   rÄ   Úsimplefilterr1   rÊ   r   r’   r“   r1  Úcopyr4   rc   )r$   r3   r4   rU  r(   r(   r)   Útest05_copyUnimplemented/  s    

(z*CheckFileTestCase.test05_copyUnimplementedc              
   C   sÜ   t dƒ}tj|dd²}| |jjd¡}|  |jd¡ tj	rJt
dt|ƒƒ t ¡ X tjdtd |  t¡  | | jjd¡ W d	  ƒ n1 s’0    Y  W d	  ƒ n1 s°0    Y  W d	  ƒ n1 sÎ0    Y  d	S )
r^  rQ  rŽ   rR  rT  r`  rÀ   rÁ   ra  N)r   r%   r/   rœ   rc   rS  r1   rÊ   r   r’   r“   r1  rÃ   rÄ   rÅ   rZ  r-   rc  r4   )r$   r  r  rU  r(   r(   r)   Ú_test05_copyUnimplementedB  s    
z+CheckFileTestCase._test05_copyUnimplemented)r?   r@   rA   r   rA  rD  rG  rH  r   Z
skipUnlessr  r9   rI  rK  rN  rP  rV  r\  r]  rd  re  rB   r(   r(   r&   r)   r=  §  s   		
	r=  Únt)rT   ÚstrictzFILE_OPEN_POLICY = "strict"c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )ÚThreadingTestCasec                    s2   t t| ƒ ¡  | j ddt ¡ d¡ | j ¡  d S )NrÓ   Ú
test_array)éÈ   i,  )r   rh  r   r4   Zcreate_carrayr%   Z	Int64Atomr0   rF   r&   r(   r)   r   ]  s
    ÿzThreadingTestCase.setUpc                    s¦   t  ¡ ‰ ‡ fdd„‰‡ fdd„‰| j}‡‡fdd„}g }t ¡ }tdƒD ](}t j|||fd}| ¡  | |¡ qHtdƒD ]}|  	| 
¡ d	¡ qz|D ]}| ¡  q”d S )
Nc                     s8   ˆ   t j| i |¤ŽW  d   ƒ S 1 s*0    Y  d S rD   )r%   r/   )ÚargsÚkwargs©Úlockr(   r)   Úsyncronized_open_filef  s    z5ThreadingTestCase.test.<locals>.syncronized_open_filec                    s8   ˆ   | j |i |¤ŽW  d   ƒ S 1 s*0    Y  d S rD   )r0   )r$   rk  rl  rm  r(   r)   Úsyncronized_close_filej  s    z6ThreadingTestCase.test.<locals>.syncronized_close_filec                    s‚   zRˆ| dd}|j jdd…dd…f }| ¡ | ¡   krBdksHn J ‚ˆ |ƒ W n  tyr   | t ¡ ¡ Y n0 | d¡ d S )	NrŽ   rR  é   é   é   é   r   ÚOK)rc   ri  ÚmaxÚminÚ	ExceptionÚputÚsysÚexc_info)ÚfilenameÚqÚfZarr)rp  ro  r(   r)   Úrunp  s    "z#ThreadingTestCase.test.<locals>.runé
   ©Útargetrk  ru  )Ú	threadingZLockr3   ÚqueueÚQueueÚrangeZThreadr  rê   r1   Úgetrt   )r$   r|  r  Zthreadsr}  ÚiÚtr(   )rn  rp  ro  r)   Útestc  s    zThreadingTestCase.test)r?   r@   rA   r   rŠ  rB   r(   r(   r&   r)   rh  Y  s   rh  c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚPythonAttrsTestCasez7Test interactions of Python attributes and child nodes.c                 C   sv   | j j}| j  |ddg¡}d}|  tt|d|¡ |  |j|¡ |  | d¡|¡ |`|  |j|¡ |  	t
t|d¡ dS )z-Setting a Python attribute over a child node.rŠ  rH   ÚfoobarN)r4   rc   rd   rY  r   Úsetattrr¾   rŠ  Ú_f_get_childr-   r    Údelattr)r$   rc   ÚchildÚattrr(   r(   r)   Útest00_attrOverChildŒ  s    ÿz(PythonAttrsTestCase.test00_attrOverChildc                 C   s|   | j }|j}d}||_|  t|j|ddg¡ | d¡}|  |j|¡ |  | d¡|¡ |`|  |j|¡ |  	t
t|d¡ dS )z/Creating a child node under a Python attribute.rŒ  rŠ  rH   ú/testN)r4   rc   rŠ  rY  r   rd   rœ   r¾   rŽ  r-   r    r  )r$   r4   rc   r‘  r  r(   r(   r)   Útest01_childUnderAttr¢  s    ÿ
z)PythonAttrsTestCase.test01_childUnderAttrc                 C   sr   | j }| dddg¡}| dddg¡}||_||_|  |j|¡ |  |j|¡ |  t|jd¡ |  t|jd¡ dS )z9Assigning a ``Node`` value as an attribute to a ``Leaf``.rÓ   rl   rH   r‡   z/array1/array2z/array2/array3N)r4   rd   r‡   rl   r¾   r-   r   rœ   )r$   r4   rl   r‡   r(   r(   r)   Útest02_nodeAttrInLeafº  s    ÿÿz)PythonAttrsTestCase.test02_nodeAttrInLeafc                 C   sŠ   | j }|j}| dddg¡}||_|  tt|d|¡ |  |j|¡ |  |j|¡ |  	t
|jd¡ |  | d¡|¡ |`|  	tt|d¡ dS )z:Assigning a ``Node`` value as an attribute to a ``Group``.rÓ   rG   rH   z/arrayAliasú/arrayN)r4   rc   rd   Z
arrayAliasrY  r   r  r¾   rG   r-   r   rœ   r    r  )r$   r4   rc   rG   r(   r(   r)   Útest03_nodeAttrInGroupÎ  s    z*PythonAttrsTestCase.test03_nodeAttrInGroupN)r?   r@   rA   Ú__doc__r’  r”  r•  r—  r(   r(   r(   r)   r‹  ‰  s
   r‹  c                   @   sØ   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4S )5ÚStateTestCasezzTest that ``File`` and ``Node`` operations check their state (open or
    closed, readable or writable) before proceeding.c              	   C   s`   | j  ¡  tjdd}z,|  t| j j|¡ W tj 	|¡r\t 
|¡ ntj 	|¡rZt 
|¡ 0 dS )zTest copying a closed file.r*   ©ÚsuffixN)r4   r0   r+   r,   r-   r   Z	copy_filer9   rs   Úexistsr:   )r$   Zh5cfnamer(   r(   r)   Útest00_fileCopyFileClosedì  s    
ÿÿz'StateTestCase.test00_fileCopyFileClosedc                 C   s:   | j  ¡  z| j  ¡  W n ty4   |  d¡ Y n0 dS )z$Test closing an already closed file.z&could not close an already closed fileN)r4   r0   r   ÚfailrF   r(   r(   r)   Útest01_fileCloseClosedù  s
    
z$StateTestCase.test01_fileCloseClosedc                 C   s   | j  ¡  |  t| j j¡ dS )zTest flushing a closed file.N)r4   r0   r-   r   rë   rF   r(   r(   r)   Útest02_fileFlushClosed  s    
z$StateTestCase.test02_fileFlushClosedc                 C   s:   |   d¡ z| j ¡  W n ty4   |  d¡ Y n0 dS )zFlushing a read-only file.rŽ   z could not flush a read-only fileN)r€   r4   rë   r   rž  rF   r(   r(   r)   Útest03_fileFlushRO	  s
    
z StateTestCase.test03_fileFlushROc                 C   s"   | j  ¡  |  t| j jdd¡ dS )z&Test creating a node in a closed file.rÓ   rŠ  N)r4   r0   r-   r   rh   rF   r(   r(   r)   Útest04_fileCreateNodeClosed  s    

ÿz)StateTestCase.test04_fileCreateNodeClosedc                 C   s"   |   d¡ |  t| jjdd¡ dS )z)Test creating a node in a read-only file.rŽ   rÓ   rŠ  N)r€   r-   r   r4   rh   rF   r(   r(   r)   Útest05_fileCreateNodeRO  s    

ÿz%StateTestCase.test05_fileCreateNodeROc                 C   s0   | j  dd¡ | j  ¡  |  t| j jdd¡ dS )z(Test removing a node from a closed file.rÓ   rŠ  N)r4   rh   r0   r-   r   r›   rF   r(   r(   r)   Útest06_fileRemoveNodeClosed!  s
    

ÿz)StateTestCase.test06_fileRemoveNodeClosedc                 C   s0   | j  dd¡ |  d¡ |  t| j jdd¡ dS )z+Test removing a node from a read-only file.rÓ   rŠ  rŽ   N)r4   rh   r€   r-   r   r›   rF   r(   r(   r)   Útest07_fileRemoveNodeRO)  s
    

ÿz%StateTestCase.test07_fileRemoveNodeROc                 C   s@   | j  dd¡ | j  dd¡ | j  ¡  |  t| j jddd¡ dS )z$Test moving a node in a closed file.rÓ   Útest1Útest2ú/test1N)r4   rh   r0   r-   r   rÜ   rF   r(   r(   r)   Útest08_fileMoveNodeClosed1  s    
ÿz'StateTestCase.test08_fileMoveNodeClosedc                 C   s@   | j  dd¡ | j  dd¡ |  d¡ |  t| j jddd¡ dS )z'Test moving a node in a read-only file.rÓ   r¦  r§  rŽ   r¨  N)r4   rh   r€   r-   r   rÜ   rF   r(   r(   r)   Útest09_fileMoveNodeRO:  s    
ÿz#StateTestCase.test09_fileMoveNodeROc                 C   s@   | j  dd¡ | j  dd¡ | j  ¡  |  t| j jddd¡ dS )z%Test copying a node in a closed file.rÓ   r¦  r§  r¨  N)r4   rh   r0   r-   r   rþ   rF   r(   r(   r)   Útest10_fileCopyNodeClosedC  s    
ÿz'StateTestCase.test10_fileCopyNodeClosedc                 C   s2   | j  dd¡ |  d¡ |  t| j jddd¡ dS )z(Test copying a node in a read-only file.rÓ   r¦  rŽ   r¨  r§  N)r4   rh   r€   r-   r   rþ   rF   r(   r(   r)   Útest11_fileCopyNodeROL  s
    
ÿz#StateTestCase.test11_fileCopyNodeROc                 C   s.   | j  dd¡ | j  ¡  |  t| j jd¡ dS )z'Test getting a node from a closed file.rÓ   rŠ  r“  N)r4   rh   r0   r-   r   rœ   rF   r(   r(   r)   Útest13_fileGetNodeClosedT  s    
z&StateTestCase.test13_fileGetNodeClosedc                 C   s>   | j  dd¡ | j  dd¡ | j  ¡  |  tt| j  ¡ ¡ dS )zTest walking a closed file.rÓ   r¦  r§  N)r4   rh   r0   r-   r   ÚnextZ
walk_nodesrF   r(   r(   r)   Útest14_fileWalkNodesClosed[  s    
z(StateTestCase.test14_fileWalkNodesClosedc                 C   sF   | j  dd¡ | j  ¡  |  t| j jddd¡ |  t| j jdd¡ dS )z<Test setting and deleting a node attribute in a closed file.rÓ   rŠ  r“  ÚfooÚbarN)r4   rh   r0   r-   r   Úset_node_attrÚdel_node_attrrF   r(   r(   r)   Útest15_fileAttrClosedc  s    
ÿ
ÿz#StateTestCase.test15_fileAttrClosedc                 C   sV   | j  dd¡ | j  ddd¡ |  d¡ |  t| j jddd¡ |  t| j jdd¡ dS )z?Test setting and deleting a node attribute in a read-only file.rÓ   rŠ  r“  r°  rŽ   r±  N)r4   rh   r²  r€   r-   r   r³  rF   r(   r(   r)   Útest16_fileAttrROm  s    
ÿ
ÿzStateTestCase.test16_fileAttrROc                 C   sf   | j  ¡  | j  dd¡ | j  ¡  |  t| j j¡ |  t| j j¡ |  t| j j¡ |  t| j j	¡ dS )z&Test undo operations in a closed file.rÓ   r§  N)
r4   Úenable_undorh   r0   r-   r   Zis_undo_enabledZget_current_markZundoZdisable_undorF   r(   r(   r)   Útest17_fileUndoClosedx  s    

z#StateTestCase.test17_fileUndoClosedc                 C   s6   | j  ¡  | j  dd¡ |  d¡ |  | j jd¡ dS )z)Test undo operations in a read-only file.rÓ   rŠ  rŽ   FN)r4   r¶  rh   r€   r1   Z_undoEnabledrF   r(   r(   r)   Útest18_fileUndoROƒ  s    

zStateTestCase.test18_fileUndoROc                 C   sÄ   | j  dd¡}| j  dd¡}| ¡  |  t|jd¡ |  t| j j|¡ z| j  d¡}W n tyr   |  d¡ Y n0 |  |j	dd¡ |  |j	d	d¡ | j  d¡}|  |j	dd
¡ |  |j	d	d¡ dS )z&Test getting a child of a closed node.rÓ   Úg1z/g1Úg2z/g1/g2z)closed parent group has not been reopenedFz.open child of closed group has not been closedTz*already closed group is not closed anymorez"newly opened group is still closedN)
r4   rh   r0  r-   r   rŽ  rœ   rž  r¾   Z	_v_isopen)r$   r¹  rº  Zg2_Zg1_r(   r(   r)   Útest19a_getNode  s0    ÿ
ÿ
ÿ
ÿ
ÿzStateTestCase.test19a_getNodec                 C   s.   | j jddddgdd |  t| j jd¡ dS )z;Test getting a node that does not start with a slash ('/').rÓ   rG   rH   rI   rB  rK   N)r4   rd   r-   Ú	NameErrorrœ   rF   r(   r(   r)   Útest19b_getNode®  s    zStateTestCase.test19b_getNodec                 C   s¨   | j  dd¡}| j  dddg¡}| ¡  |  t|j¡ |  t| j j|¡ z| j jddd W n tyx   |  d¡ Y n0 |  t|j¡ |  	d	| j ¡ |  	d| j ¡ d
S )zTest removing a closed node.rÓ   rk   z/grouprG   rH   Tr˜   z!closed node has not been reloadedz/group/arrayN)
r4   rh   rd   r0  r-   r   Z	_f_remover›   rž  r½   )r$   rk   rG   r(   r(   r)   Útest20_removeNode·  s    zStateTestCase.test20_removeNodec                 C   sP   | j  dd¡}|j}d |_}| ¡  |  tt|d¡ |  | j  	dd¡|¡ dS )z2Test manipulating the attributes of a closed node.rÓ   rŠ  r°  rf   r“  N)
r4   rh   rf   rŠ  r0  r-   r   Úgetattrr1   Zget_node_attr)r$   r¹   Z	nodeAttrsr‘  r(   r(   r)   Útest21_attrsOfNodeÒ  s    
z StateTestCase.test21_attrsOfNodec                 C   sB   | j  dd¡ | j  ddd¡ |  d¡ |  t| j jddd¡ dS )z?Test manipulating the attributes of a node in a read-only file.rÓ   rŠ  r“  r°  rŽ   r±  N)r4   rh   r²  r€   r-   r   rF   r(   r(   r)   Útest21b_attrsOfNodeá  s    
ÿz!StateTestCase.test21b_attrsOfNodec                 C   s,   | j  dd¡}| j  ¡  |  tt|d¡ dS )z*Test node closing because of file closing.rÓ   rŠ  rf   N)r4   rh   r0   r-   r   r¿  r¸   r(   r(   r)   Útest22_fileClosesNodeë  s    
z#StateTestCase.test22_fileClosesNodec              	   C   sV  | j  ddg d¢¡ | j  ¡  t | jd¡}|  |jd¡ tjj	dkr`|  
ttj| jd¡ nÒt | jd¡²}|  |jd¡ |  |jd¡ tjr°td|jƒ td|jjd ƒ |  |jjd d	¡ | ¡  |  |jd¡ tjrþtd
|jƒ td|jjd ƒ |  |jjd d	¡ W d  ƒ n1 s(0    Y  W d  ƒ n1 sH0    Y  dS )z6Testing reopening a file and closing it several times.rÓ   rŠ  )rH   rI   rT   rŽ   rH   rg  z(h5file1) open_count:z(h5file1) test[1]:rI   z(h5file2) open_count:z(h5file2) test[1]:N)r4   rd   r0   r%   r/   r3   r1   Z
open_countr!   Ú_FILE_OPEN_POLICYr-   r=   r   r’   r“   rc   rŠ  )r$   Zh5file1r  r(   r(   r)   Útest23_reopenFileó  s*    

ÿzStateTestCase.test23_reopenFileN)r?   r@   rA   r˜  r  rŸ  r   r¡  r¢  r£  r¤  r¥  r©  rª  r«  r¬  r­  r¯  r´  rµ  r·  r¸  r»  r½  r¾  rÀ  rÁ  rÂ  rÄ  r(   r(   r(   r)   r™  è  s4   

			

!	
r™  c                       s‚   e Zd ZdZe d¡Ze d¡Zd‡ fdd„	Z	‡ fdd„Z
dd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z‡  ZS )ÚFlavorTestCasezaTest that setting, getting and changing the ``flavor`` attribute of a
    leaf works as expected.r€  rŽ   c                    s0   t t| ƒ |¡ | j d¡| _| j d¡| _dS )Nr–  z/scalarT)r   rÅ  r€   r4   rœ   rG   Úscalar)r$   r†   r&   r(   r)   r€     s    zFlavorTestCase._reopenc                    s:   t t| ƒ ¡  | j dd| j¡| _| j dd| j¡| _d S )NrÓ   rG   rÆ  )	r   rÅ  r   r4   rd   Ú
array_datarG   Úscalar_datarÆ  rF   r&   r(   r)   r     s    zFlavorTestCase.setUpc                 C   s   |   tt| jdd¡ dS )zSetting an invalid flavor.Úflavorr°  N)r-   r   r  rG   rF   r(   r(   r)   Útest00_invalid!  s    zFlavorTestCase.test00_invalidc                 C   s(   | j dd |  tt| jdtjj¡ dS )z%Setting a flavor in a read-only file.rŽ   rR  rÉ  N)r€   r-   r   r  rG   r%   rÉ  Úinternal_flavorrF   r(   r(   r)   Útest01_readonly&  s
    þzFlavorTestCase.test01_readonlyc                 C   sT   t D ]J}|| j_|  | jj|¡ t| j|ƒ}| jdd… }|  t |||¡¡ qdS )z%Changing the flavor and reading data.N)	r   rG   rÉ  r1   r   rÇ  ru   r   Úallequal©r$   rÉ  ZidataZodatar(   r(   r)   Útest02_change.  s    zFlavorTestCase.test02_changec                 C   sB   t D ]8}|| j_|  | jj|¡ | jdd |  | jj|¡ qdS )zStoring a changed flavor.r„   rR  N)r   rG   rÉ  r1   r€   )r$   rÉ  r(   r(   r)   Útest03_store8  s
    zFlavorTestCase.test03_storec                 C   sv   | j j}d| j j_| jdd t| j|ƒ}|  t¡ | j  	¡ }W d  ƒ n1 sT0    Y  |  
t |||¡¡ dS )z&Reading a dataset of a missing flavor.rŒ  rŽ   rR  N)rG   rÉ  rf   ÚFLAVORr€   r   rÇ  rY  r   r  ru   r   rÍ  rÎ  r(   r(   r)   Útest04_missingA  s    
(zFlavorTestCase.test04_missingc                 C   s\   d| j _|  | j jd¡ |  | j jjd¡ | j `|  | j jtjj¡ |  tt	| j jd¡ dS )z!Deleting the flavor of a dataset.ZpythonrÑ  N)
rG   rÉ  r1   ri   rÑ  r%   rË  r-   r    r¿  rF   r(   r(   r)   Útest05_deleteL  s    zFlavorTestCase.test05_deletec           	   	   C   sÆ   dd„ | j | jfD ƒ}dd„ |D ƒ}|D ]}| j d|¡}|`q(dD ]|}|  |¡ t||ƒD ]b\}}|dkrˆ| j d|¡}| d|¡}n|dkrž| j d|¡}|  |jt	jj
d|j|jf ¡ q\qDd	S )
z0Copying a node with a deleted flavor (see #100).c                 S   s   g | ]
}|j ‘qS r(   )rÊ   )Ú.0r¹   r(   r(   r)   Ú
<listcomp>Y  ó    z5FlavorTestCase.test06_copyDeleted.<locals>.<listcomp>c                 S   s   g | ]}d | ‘qS )z%s_copyr(   )rÔ  r¬   r(   r(   r)   rÕ  Z  rÖ  rÓ   )r„   rŽ   r„   rŽ   z)flavor of node ``%s`` is not internal: %rN)rG   rÆ  r4   rœ   rÉ  r€   Úziprc  r1   r%   rË  r­   )	r$   ZsnamesZdnamesr¬   r¹   ZfmodeZsnameZdnameZsnoder(   r(   r)   Útest06_copyDeletedV  s$    

ÿÿz!FlavorTestCase.test06_copyDeletedc              
   C   s&  t tjjƒ}tjj ¡ }tjj ¡ }tjj ¡ }tjj ¡ }z’tjj	g d |  
ttjjƒt|ƒ¡ |  
ttjjƒt|ƒ¡ W |d d … tjjd d …< tjj |¡ tjj |¡ tjj |¡ tjj |¡ nR|d d … tjjd d …< tjj |¡ tjj |¡ tjj |¡ tjj |¡ 0 d S )N)r*  )Úlistr%   rÉ  r   Ú	alias_maprc  Úconverter_mapÚidentifier_mapÚdescription_mapZrestrict_flavorsZ
assertLessr    Úupdate)r$   r   rÚ  rÛ  rÜ  rÝ  r(   r(   r)   Útest07_restrict_flavorsk  s,    
þüz&FlavorTestCase.test07_restrict_flavors)rŽ   )r?   r@   rA   r˜  rj   ÚarangerÇ  Zint32rÈ  r€   r   rÊ  rÌ  rÏ  rÐ  rÒ  rÓ  rØ  rß  rB   r(   r(   r&   r)   rÅ    s   


	
rÅ  Úwinzknown bug: gh-389zutf-8zneed utf-8 file-system encodingc                       sT   e Zd ZdZdd„ Z‡ fdd„Zdd„ Zdd	„ Zd
d„ Ze	dd„ ƒZ
dd„ Z‡  ZS )ÚUnicodeFilenameu	   paraÅ€lelc                 C   s   t j| jddS )Nr*   ©Úprefixr›  )r+   r,   Úunicode_prefixrF   r(   r(   r)   Ú_getTempFileNameˆ  s    z UnicodeFilename._getTempFileNamec                    s0   t t| ƒ ¡  | j ddddg¡| _|  ¡  d S ©NrÓ   rŠ  rH   rI   )r   râ  r   r4   rd   rŠ  r€   rF   r&   r(   r)   r   ‹  s    zUnicodeFilename.setUpc                 C   sZ   | j jj}tjr<td| jƒ td|dd… ƒ tdddgƒ |  |dd… ddgd¡ dS )z0Checking creating a filename with Unicode chars.ú	Filename:úArray:NúShould look like:rH   rI   úValues does not match.©r4   rc   rŠ  r   r’   r“   r3   r1   ©r$   rŠ  r(   r(   r)   Útest01“  s    
zUnicodeFilename.test01c                 C   sD   | j  ¡  tjr.td| jƒ tdt | j¡ƒ |  t | j¡¡ dS )z6Checking  tables.is_hdf5_file with a Unicode filename.rè  ú tables.is_hdf5_file?:N©	r4   r0   r   r’   r“   r3   r%   rC  ru   rF   r(   r(   r)   Útest02  s
    
zUnicodeFilename.test02c                 C   sF   | j  ¡  tjr.td| jƒ tdt | j¡ƒ |  t | j¡d¡ dS )z2Checking is_pytables_file with a Unicode filename.rè  úis_pytables_file?:FN©	r4   r0   r   r’   r“   r3   r%   rM  r%  rF   r(   r(   r)   Útest03¦  s
    
zUnicodeFilename.test03c                 C   s2   t j |j¡}t j|| |j|d}||d d …< d S )N)ÚshapeÚatom)r%   ZAtomZ
from_dtypeÚdtypeZCArrayrõ  )r¬   Údatark   rö  r¹   r(   r(   r)   Ú_store_carray¯  s    zUnicodeFilename._store_carrayc                 C   sœ   | j  ¡  t | jd¡| _ | j j}| j  |d¡}d}t t 	ddd¡¡}t
 ¡ * t
 dt¡ |  |||¡ W d   ƒ n1 s€0    Y  | j  |d¡}d S )	Nr]   Z	face_datau   data at 40Â°Cgffffffö¿gffffffö?iô  r_  Zvertex_data)r4   r0   r%   r/   r3   rc   rh   rj   ZsinhZlinspacerÃ   rÄ   rb  r   rù  )r$   rc   rk   Z
array_namerø  r(   r(   r)   Ú-test_store_and_load_with_non_ascii_attributesµ  s    

,z=UnicodeFilename.test_store_and_load_with_non_ascii_attributes)r?   r@   rA   rå  ræ  r   rî  rñ  rô  Ústaticmethodrù  rú  rB   r(   r(   r&   r)   râ  ‚  s   
		
râ  )rT   rW   z%PEP 519 was implemented in Python 3.6c                       s<   e Zd Zdd„ Z‡ fdd„Zdd„ Zdd„ Zd	d
„ Z‡  ZS )ÚPathLikeFilenamec                 C   s   ddl m} |tjddƒS )Nr   )ÚPathr*   rš  )Úpathlibrý  r+   r,   )r$   rý  r(   r(   r)   ræ  Æ  s    z!PathLikeFilename._getTempFileNamec                    s0   t t| ƒ ¡  | j ddddg¡| _|  ¡  d S rç  )r   rü  r   r4   rd   rŠ  r€   rF   r&   r(   r)   r   Ê  s    zPathLikeFilename.setUpc                 C   sZ   | j jj}tjr<td| jƒ td|dd… ƒ tdddgƒ |  |dd… ddgd¡ dS )z@Checking creating a file with a PathLike object as the filename.rè  ré  Nrê  rH   rI   rë  rì  rí  r(   r(   r)   rî  Ò  s    
zPathLikeFilename.test01c                 C   sD   | j  ¡  tjr.td| jƒ tdt | j¡ƒ |  t | j¡¡ dS )zEChecking  tables.is_hdf5_file with a PathLike object as the filename.rè  rï  Nrð  rF   r(   r(   r)   rñ  Ü  s
    
zPathLikeFilename.test02c                 C   sF   | j  ¡  tjr.td| jƒ tdt | j¡ƒ |  t | j¡d¡ dS )zAChecking is_pytables_file with a PathLike object as the filename.rè  rò  FNró  rF   r(   r(   r)   rô  å  s
    
zPathLikeFilename.test03)	r?   r@   rA   ræ  r   rî  rñ  rô  rB   r(   r(   r&   r)   rü  Â  s
   
	rü  c                       sh   e Zd Z‡ fdd„Z‡ fdd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Z‡  ZS )ÚFilePropertyTestCasec                    s$   t t| ƒ ¡  t d¡| _d | _d S )Nr*   )r   rÿ  r   r+   r,   r3   r4   rF   r&   r(   r)   r   ð  s    zFilePropertyTestCase.setUpc                    s<   | j r| j  ¡  tj | j¡r*t | j¡ tt| ƒ 	¡  d S rD   )
r4   r0   r9   rs   rœ  r3   r:   r   rÿ  rA  rF   r&   r(   r)   rA  õ  s
    
zFilePropertyTestCase.tearDownc                 C   s„   t  d¡}t  |j¡|jj }tj| jdd| _	| j	 
| j	jd|¡ | j	 ¡ }| j	 ¡  t | j¡d }|  ||¡ |  ||¡ d S )N)éÐ  r   r<   rR  rG   rW   )rj   ZzerosÚprodrõ  r÷  Úitemsizer%   r/   r3   r4   rd   rc   Zget_filesizer0   r9   Ústatr4  r1   )r$   rø  ZdatasizeZh5_filesizeZfs_filesizer(   r(   r)   Útest_get_filesizeý  s    


z&FilePropertyTestCase.test_get_filesizec                 C   s@   t j| jdd| _| j | jjdddg¡ |  | j ¡ d¡ d S )Nr<   rR  rG   rH   rI   r   ©r%   r/   r3   r4   rd   rc   r1   Úget_userblock_sizerF   r(   r(   r)   Útest01_null_userblock_size  s    z/FilePropertyTestCase.test01_null_userblock_sizec                 C   s\   t j| jdd| _| j | jjdddg¡ | j ¡  t j| jdd| _|  | j ¡ d¡ d S )Nr<   rR  rG   rH   rI   rŽ   r   ©	r%   r/   r3   r4   rd   rc   r0   r1   r  rF   r(   r(   r)   Útest02_null_userblock_size  s
    
z/FilePropertyTestCase.test02_null_userblock_sizec                 C   sF   d}t j| jd|d| _| j | jjdddg¡ |  | j ¡ d¡ d S )Nr   r<   ©r†   Zuser_block_sizerG   rH   rI   r  ©r$   ZUSER_BLOCK_SIZEr(   r(   r)   Útest03_null_userblock_size  s    ÿz/FilePropertyTestCase.test03_null_userblock_sizec                 C   sF   d}t j| jd|d| _| j | jjdddg¡ |  | j ¡ |¡ d S )Né   r<   r
  rG   rH   rI   r  r  r(   r(   r)   Útest01_userblock_size  s    ÿz*FilePropertyTestCase.test01_userblock_sizec                 C   sb   d}t j| jd|d| _| j | jjdddg¡ | j ¡  t j| jdd| _|  | j ¡ |¡ d S )	Nr  r<   r
  rG   rH   rI   rŽ   rR  r  r  r(   r(   r)   Útest02_userblock_size%  s    ÿ
z*FilePropertyTestCase.test02_userblock_sizec                 C   s    d}| j ttj| jd|d d S )Nrr  r<   r
  ©r-   r=   r%   r/   r3   r  r(   r(   r)   Útest_small_userblock_size.  s    ÿz.FilePropertyTestCase.test_small_userblock_sizec                 C   s    d}| j ttj| jd|d d S )Ni  r<   r
  r  r  r(   r(   r)   Útest_invalid_userblock_size3  s    ÿz0FilePropertyTestCase.test_invalid_userblock_size)r?   r@   rA   r   rA  r  r  r	  r  r  r  r  r  rB   r(   r(   r&   r)   rÿ  ï  s   	rÿ  zBlosc not availablec                   @   s   e Zd ZedƒZdd„ ZdS )ÚBloscBigEndianzblosc_bigendian.h5c              	   C   sH   dD ]>}t jd|d}| j d| ¡}|  t ||dd… ¡d¡ qdS )z9Checking compatibility with Blosc on big-endian machines.)Zi1Zi2Zi4Zi8r€  )r÷  rÓ   NzError in big-endian data!)rj   rà  r4   rœ   ru   r   rÍ  )r$   Z	dset_namer]   Zdsetr(   r(   r)   Útest00_bigendian>  s    ÿzBloscBigEndian.test00_bigendianN)r?   r@   rA   r   r3   r  r(   r(   r(   r)   r  :  s   r  c                 C   sj   t  | ¡}tjrtd| ƒ |jj d¡}tjr6tdƒ t|ƒ tjrLtdƒ | 	¡  |d urf| 
d¡ d S )NzAbout to load: z	(f0 < 10)z"Got the iterator, about to iteratezSucceeded in one iteration
ZDone)r%   r/   r   r’   r“   rc   rM   Úwherer®  r0   ry  )ÚfnÚqoutÚfpZrowsr(   r(   r)   Ú_workerM  s    

r  z$multiprocessing module not available)Zgnuzgnu/kfreebsdz8multiprocessing module is not supported on Hurd/kFreeBSDc                   @   s   e Zd Zdd„ ZdS )ÚBloscSubprocessc              	   C   s(  t jddd}ztdƒ}t dd„ t|ƒD ƒd¡}t |d¡6}|j|j	d	|tj
d
dd|d fd W d   ƒ n1 s|0    Y  tjr”tdƒ t|ƒ tjrªtdƒ zt ¡ }W n tyÐ   tdƒ Y n:0 tjt||fd}d|_| ¡  | ¡ }tjr
t|ƒ W t |¡ nt |¡ 0 d S )Nzmultiproc-blosc9-r*   rã  g    €OAc                 s   s    | ]}||d  |d fV  qdS )rI   rT   Nr(   )rÔ  rˆ  r(   r(   r)   Ú	<genexpr>n  s   ÿz4BloscSubprocess.test_multiprocess.<locals>.<genexpr>zi4,i8,f8r<   rM   é	   Zblosc)Z	complevelZcomplibrT   )Úfiltersr$  z**** Running from main process:z**** Running from subprocess:z*Permission denied due to /dev/shm settingsr  T)r+   r,   Úintrj   Zfromiterr†  r%   r/   re   rc   ZFiltersr   r’   r“   r  Úmpr…  ÚOSErrorZProcessZdaemonr  r‡  r9   r:   )r$   r3   ÚsizeZsar4   r  ZpsÚresultr(   r(   r)   Útest_multiprocessi  s<    
ÿÿý$
z!BloscSubprocess.test_multiprocessN)r?   r@   rA   r#  r(   r(   r(   r)   r  c  s   r  c                       sX   e Zd Z‡ fdd„Z‡ fdd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
‡  ZS )ÚHDF5ErrorHandlingc                    s   t t| ƒ ¡  tjj| _d S rD   )r   r$  r   r%   r8   ÚDEFAULT_H5_BACKTRACE_POLICYÚ_old_policyrF   r&   r(   r)   r   Ž  s    zHDF5ErrorHandling.setUpc                    s   | j tj_tt| ƒ ¡  d S rD   )r&  r%   r8   r%  r   r$  rA  rF   r&   r(   r)   rA  ’  s    
zHDF5ErrorHandling.tearDownc              	   C   s¢   d}t jddd}z~t|dƒ}| || ¡ W d   ƒ n1 sB0    Y  tjtj|gtjtjd}| 	¡ \}}|  
d| d¡¡ W t |¡ nt |¡ 0 d S )	Nz›
import tables
tables.silence_hdf5_messages(False)
tables.silence_hdf5_messages()
try:
    tables.open_file(r'%s')
except tables.HDF5ExtError, e:
    pass
úhdf5-error-handling-ú.pyrã  r<   ©ÚstdoutÚstderrú	HDF5-DIAGÚascii)r+   r,   r7   r@  Ú
subprocessÚPopenrz  Ú
executableÚPIPEÚcommunicater½   Údecoder9   r:   ©r$   Úcoder|  r  Úpr*  r+  r(   r(   r)   Útest_silence_messages–  s    
,þz'HDF5ErrorHandling.test_silence_messagesc              	   C   s¢   d}t jddd}z~t|dƒ}| || ¡ W d   ƒ n1 sB0    Y  tjtj|gtjtjd}| 	¡ \}}|  
d| d¡¡ W t |¡ nt |¡ 0 d S )	Nz
import tables
tables.silence_hdf5_messages()
tables.silence_hdf5_messages(False)
try:
    tables.open_file(r'%s')
except tables.HDF5ExtError as e:
    pass
r'  r(  rã  r<   r)  r,  r-  )r+   r,   r7   r@  r.  r/  rz  r0  r1  r2  rÕ   r3  r9   r:   r4  r(   r(   r)   Útest_enable_messages¯  s    
,þz&HDF5ErrorHandling.test_enable_messagesc              	   C   sJ   t  d¡}t|dƒ ¡  z t |¡}| ¡  W t |¡ nt |¡ 0 d S )Nr*   r6   )r+   r,   r7   r0   r%   r/   r9   r:   r2   r(   r(   r)   Ú_raise_exterrorÈ  s    


z!HDF5ErrorHandling._raise_exterrorc                 C   sN   dt j_|  t j¡}|  ¡  W d   ƒ n1 s20    Y  |  |jj¡ d S )NT)r%   r8   r%  r-   r9  r”   Ú	exceptionÚh5backtrace©r$   Úcmr(   r(   r)   Útest_h5_backtrace_quietÒ  s    &z)HDF5ErrorHandling.test_h5_backtrace_quietc                 C   sp   dt j_|  t j¡}|  ¡  W d   ƒ n1 s20    Y  |  |jj¡ t|jƒ}|  	|jjd d |¡ d S )NÚVERBOSEéÿÿÿÿ)
r%   r8   r%  r-   r9  r”   r:  r;  rr   rÕ   )r$   r=  Úmsgr(   r(   r)   Útest_h5_backtrace_verboseÚ  s    &
z+HDF5ErrorHandling.test_h5_backtrace_verbosec                 C   sN   dt j_|  t j¡}|  ¡  W d   ƒ n1 s20    Y  |  |jj¡ d S )NF)r%   r8   r%  r-   r9  rO  r:  r;  r<  r(   r(   r)   Útest_h5_backtrace_ignoreä  s    &z*HDF5ErrorHandling.test_h5_backtrace_ignore)r?   r@   rA   r   rA  r7  r8  r9  r>  rB  rC  rB   r(   r(   r&   r)   r$    s   

r$  c                   @   sl   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )ÚTestDescriptionc                 C   s2   G dd„ dt ƒ}G dd„ d|ƒ}|  d|j¡ d S )Nc                   @   s   e Zd Zeƒ ZdS )zFTestDescription.test_isdescription_inheritance.<locals>.TestDescParentN)r?   r@   rA   r   Úcr(   r(   r(   r)   ÚTestDescParentð  s   rF  c                   @   s   e Zd ZdS )z@TestDescription.test_isdescription_inheritance.<locals>.TestDescN)r?   r@   rA   r(   r(   r(   r)   ÚTestDescó  s   rG  rE  )r   rÕ   rS  )r$   rF  rG  r(   r(   r)   Útest_isdescription_inheritanceî  s    z.TestDescription.test_isdescription_inheritancec                 C   sž   t  ddtfg¡}t|ƒ\}}|  d|j¡ |  d|j¡ |  t|jƒd¡ |  |jd t	¡ |  |jd t	¡ |  |jd jt j
¡ |  |jd jt¡ d S )N©Úcol1Úint16Úcol2rJ  rI   )rj   r÷  Úfloatr   rÕ   Ú_v_colobjectsr1   r    r[  r   rK  )r$   r‰  ÚdescrÚ	byteorderr(   r(   r)   Útest_descr_from_dtypeø  s    z%TestDescription.test_descr_from_dtypec                 C   sJ   ddg}t  |¡}t|ƒ\}}|  t|jƒd¡ |  t|jƒddg¡ d S )N))Z	timestampr‰  Zu4))zunit (cluster) idÚunitZu2rI   r‰  rR  )rj   r÷  r   r1   r    Ú_v_namesÚsorted)r$   Úheaderr‰  rO  rP  r(   r(   r)   Ú test_descr_from_dtype_rich_dtype	  s    ÿ
z0TestDescription.test_descr_from_dtype_rich_dtypec                 C   sª   t  ddg¡}t  dd|fg¡}t|ƒ\}}|  |j¡ |  d|j¡ |  d|j¡ |  t|jƒd¡ |  	|jd t
¡ |  t|jd tjƒ¡ |  |jd jt j¡ d S )N©ÚxrK  ©ÚyrK  ©ÚtimeÚfloat64Úvaluer\  rI   )rj   r÷  r   ru   Ú_v_is_nestedrÕ   rN  r1   r    r[  r   Ú
isinstancer%   r   r]  ©r$   Zd1Zd_comprO  rP  r(   r(   r)   Útest_descr_from_dtype_comp_01	  s$    þþÿz-TestDescription.test_descr_from_dtype_comp_01c                 C   sØ   t  ddg¡}t  dd|dffg¡}|  t¡ t|ƒ\}}W d   ƒ n1 sP0    Y  |  |j¡ |  d|j¡ |  d|j¡ |  	t
|jƒd¡ |  |jd t¡ |  t|jd tjƒ¡ |  	|jd jt j¡ d S )NrW  rY  r[  r^  )rH   r\  rI   )rj   r÷  rY  rZ  r   ru   r_  rÕ   rN  r1   r    r[  r   r`  r%   r   r]  ra  r(   r(   r)   Útest_descr_from_dtype_comp_02$	  s&    þ
þ*ÿz-TestDescription.test_descr_from_dtype_comp_02c                 C   s:   G dd„ dt ƒ}t ddtfg¡}t|ƒ}|  ||¡ d S )Nc                   @   s   e Zd Zeƒ Zeƒ ZdS )zLTestDescription.test_dtype_from_descr_is_description.<locals>.TestDescParentN©r?   r@   rA   r   rJ  r	   rL  r(   r(   r(   r)   rF  =	  s   rF  rI  rL  ©r   rj   r÷  rM  r   r1   ©r$   rF  r÷  r‰  r(   r(   r)   Ú$test_dtype_from_descr_is_description;	  s    z4TestDescription.test_dtype_from_descr_is_descriptionc                 C   s<   G dd„ dt ƒ}t ddtfg¡}t|ƒ ƒ}|  ||¡ d S )Nc                   @   s   e Zd Zeƒ Zeƒ ZdS )zUTestDescription.test_dtype_from_descr_is_description_instance.<locals>.TestDescParentNrd  r(   r(   r(   r)   rF  H	  s   rF  rI  rL  re  rf  r(   r(   r)   Ú-test_dtype_from_descr_is_description_instanceF	  s    
z=TestDescription.test_dtype_from_descr_is_description_instancec                 C   sF   G dd„ dt ƒ}t ddtfg¡}t|ƒ jƒ}t|ƒ}|  ||¡ d S )Nc                   @   s   e Zd Zeƒ Zeƒ ZdS )zRTestDescription.test_dtype_from_descr_description_instance.<locals>.TestDescParentNrd  r(   r(   r(   r)   rF  S	  s   rF  rI  rL  )r   rj   r÷  rM  r   rS  r   r1   )r$   rF  r÷  Zdesctiptionr‰  r(   r(   r)   Ú*test_dtype_from_descr_description_instanceQ	  s
    z:TestDescription.test_dtype_from_descr_description_instancec                 C   s4   t  ddtfg¡}ttƒ tƒ dœƒ}|  ||¡ d S )NrI  rL  )rJ  rL  )rj   r÷  rM  r   r   r	   r1   )r$   r÷  r‰  r(   r(   r)   Útest_dtype_from_descr_dict]	  s    z*TestDescription.test_dtype_from_descr_dictc                 C   s   |   ttg ¡ d S rD   )r-   r=   r   rF   r(   r(   r)   Ú"test_dtype_from_descr_invalid_typed	  s    z2TestDescription.test_dtype_from_descr_invalid_typec                 C   sD   G dd„ dt ƒ}t|dd}|  |d jd¡ |  |d jd¡ d S )Nc                   @   s   e Zd Zeƒ Zeƒ ZdS )zGTestDescription.test_dtype_from_descr_byteorder.<locals>.TestDescParentNrd  r(   r(   r(   r)   rF  j	  s   rF  ú>)rP  rJ  rL  )r   r   r1   rP  )r$   rF  r‰  r(   r(   r)   Útest_dtype_from_descr_byteorderh	  s    z/TestDescription.test_dtype_from_descr_byteorderc                 C   sb   dt  ¡ i}t|ƒ}|  t|jƒt| ¡ ƒ¡ |  |jt	j
¡ |  t|jj ¡ ƒt| ¡ ƒ¡ d S )Nr¬   )r%   r   r   r1   rT  rS  Úkeysr[  Z_v_dtyperj   r÷  ru   Úfields)r$   ÚdrO  r(   r(   r)   Útest_str_namess	  s    
ÿzTestDescription.test_str_namesN)r?   r@   rA   rH  rQ  rV  rb  rc  rg  rh  ri  rj  rk  rm  rq  r(   r(   r(   r)   rD  í  s   
	rD  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚTestAtomc                 C   s¤   d}t |d}|  |jd¡ |  |jt tj|f¡¡ |  |j|jjj¡ |  |jd¡ |  |j	t
|ƒ¡ |  |j|¡ |  |j|jt |¡ ¡ |  |jd¡ d S )N©r€  r€  ©rõ  g        rM  r]  )r   r1   Údfltr÷  rj   r]  r  ÚbaseÚkindÚndimr    rõ  r!  r  Útype)r$   rõ  r]   r(   r(   r)   Útest_atom_attributes01~	  s    
zTestAtom.test_atom_attributes01c                 C   s(   d}t |d}| ¡ }|  |j|¡ d S ©Nrs  rt  )r   rc  r1   rõ  )r$   rõ  r]   Úaar(   r(   r)   Útest_atom_copy01Œ	  s    
zTestAtom.test_atom_copy01c                 C   s(   d}t |d}| ¡ }|  |j|¡ d S ©Nç       @©ru  )r   rc  r1   ru  )r$   ru  r]   r|  r(   r(   r)   Útest_atom_copy02’	  s    
zTestAtom.test_atom_copy02c                 C   sR   d}d}t ||d}|j| d}|  |j|¡ |  |j|¡ |  |j| ¡ d S )Nrs  r  )rõ  ru  r€  )r   rc  r1   rõ  r%  ru  )r$   rõ  ru  r]   r|  r(   r(   r)   Útest_atom_copy_override˜	  s    z TestAtom.test_atom_copy_overrideN)r?   r@   rA   rz  r}  r  r‚  r(   r(   r(   r)   rr  }	  s   rr  c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚTestColc                 C   s(   d}t |d}| ¡ }|  |j|¡ d S r{  )r
   rc  r1   rõ  )r$   rõ  rE  Úccr(   r(   r)   Útest_col_copy01£	  s    
zTestCol.test_col_copy01c                 C   s(   d}t |d}| ¡ }|  |j|¡ d S r~  )r
   rc  r1   ru  )r$   ru  rE  r„  r(   r(   r)   Útest_col_copy02©	  s    
zTestCol.test_col_copy02c                 C   sb   d}d}d}t |||d}|jdd}|  |j|¡ |  |j|¡ |  |j|¡ |  |jd¡ d S )Nrs  r  rT   )rõ  ru  ÚposrI   )r‡  )r
   rc  r1   rõ  ru  r%  Z_v_pos)r$   rõ  ru  r‡  rE  r„  r(   r(   r)   Útest_col_copy_override¯	  s    zTestCol.test_col_copy_overrideN)r?   r@   rA   r…  r†  rˆ  r(   r(   r(   r)   rƒ  ¢	  s   rƒ  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚTestSysattrCompatibilityc                 C   sD   t dƒ}t |d¡}|  |j¡ W d   ƒ n1 s60    Y  d S )Nz
python2.h5rŽ   ©r   r%   r/   ru   Zisopenr2   r(   r(   r)   Útest_open_python2¼	  s    z*TestSysattrCompatibility.test_open_python2c                 C   sD   t dƒ}t |d¡}|  |j¡ W d   ƒ n1 s60    Y  d S )Nz
python3.h5rŽ   rŠ  r2   r(   r(   r)   Útest_open_python3Á	  s    z*TestSysattrCompatibility.test_open_python3N)r?   r@   rA   r‹  rŒ  r(   r(   r(   r)   r‰  »	  s   r‰  c                  C   sP  t  ¡ } d}t|ƒD ]4}|  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t	¡¡ |  t  t
¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ |  t  t¡¡ q| S )NrH   )r   Z	TestSuiter†  ZaddTestZ	makeSuiter   r7  r;  r<  r=  rh  r‹  r™  rÅ  râ  rü  rÿ  r  r  r$  rD  rr  rƒ  r‰  )ZtheSuiteZniterrˆ  r(   r(   r)   ÚsuiteÇ	  s.    r  Ú__main__)ZdefaultTest)N)Vr9   rz  rw   Úplatformr+   rÃ   rƒ  r.  r„  Zmultiprocessingr  Zmultiprocessing_importedÚImportErrorrj   r%   Ztables.flavorr   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   Ztables.parametersr   Ztables.descriptionr   r   Ztables.testsr   Ztables.tests.commonr   r   r   ZTestCaser   ZTempFileMixinrC   r7  r;  r<  r=  ZskipIfr¬   Úversion_infor!   rÃ  rh  r‹  r™  rÅ  ÚsystemÚlowerÚgetfilesystemencodingrâ  rü  rÿ  Zblosc_availZTestFileMixinr  r  r  r$  rD  rr  rƒ  r‰  r  r?   Z
parse_argvÚargvZprint_versionsÚmainr(   r(   r(   r)   Ú<module>   s    
P5        C 3
þ-_  )sÿ=ÿ+K
ÿÿ%` %
