B
    ™i‚\yr ã               @   sº  d dl mZ d dl m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d dlZd dlZd dlmZ d dlmZ yd dlZdZW n ek
r¨   dZY nX 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l0m1Z1 d dl2m3Z3m4Z4 d dl2m5Z6 G dd„ de6ƒZ7G dd„ de1j8e6ƒZ9G dd„ de9ƒZ:G dd„ de9ƒZ;G dd„ de9ƒZ<G dd„ de1j8e6ƒZ=e3 >ej?dkrêej@dk pôejAjBdkd¡G dd „ d e1j8e6ƒƒZCG d!d"„ d"e1j8e6ƒZDG d#d$„ d$e1j8e6ƒZEG d%d&„ d&e1j8e6ƒZFe3 >d'e G¡  H¡ kd(¡e3 >e I¡ d)kd*¡G d+d,„ d,e1j8e6ƒƒƒZJe3 >ej@d-k d.¡G d/d0„ d0e1j8e6ƒƒZKG d1d2„ d2e6ƒZLe3 >e1jM d3¡G d4d5„ d5e1jNe6ƒƒZOdKd6d7„ZPe3 >e d8¡e3 >e G¡  H¡ d9kd:¡e3 >e1jM d3¡G d;d<„ d<e6ƒƒƒƒZQG d=d>„ d>e6ƒZRG d?d@„ d@e6ƒZSG dAdB„ dBe6ƒZTG dCdD„ dDe6ƒZUG dEdF„ dFe6ƒZVdGdH„ ZWeXdIkr¶e1 YejZ¡ e1 [¡  e3j\dHdJ dS )Lé    )Úprint_function)Úabsolute_importN)Úrange)ÚzipTF)Ú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.7/site-packages/tables/tests/test_basics.pyr#   .   s    zOpenFileFailureTestCase.setUpc          	   C   sJ   t  d¡}|  t¡ t |¡}| ¡  W dQ R X |  | jt	| j
ƒ¡ dS )z(Checking opening of a non existing file.z.h5N)ÚtempfileÚmktempÚassertRaisesÚIOErrorr)   Ú	open_fileÚcloseÚassertEqualr&   r$   r'   )r(   Úh5fnameÚh5filer+   r+   r,   Útest01_open_file6   s
    

z(OpenFileFailureTestCase.test01_open_filec          	   C   sl   t  d¡}t|dƒ ¡  zB|  tj¡ t |¡}| ¡  W dQ R X |  | j	t
| jƒ¡ W dt |¡ X dS )z.Checking opening of an existing non HDF5 file.z.h5ÚwbN)r-   r.   Úopenr2   r/   r)   ÚHDF5ExtErrorr1   r3   r&   r$   r'   ÚosÚremove)r(   r4   r5   r+   r+   r,   Útest02_open_file@   s    

z(OpenFileFailureTestCase.test02_open_filec          	   C   sF   t  d¡}t |d¡}| ¡  z|  ttj|d¡ W dt |¡ X dS )z7Checking opening of an existing file with invalid mode.z.h5ÚwZabN)	r-   r.   r)   r1   r2   r/   Ú
ValueErrorr:   r;   )r(   r4   r5   r+   r+   r,   Útest03_open_fileQ   s    
z(OpenFileFailureTestCase.test03_open_file)Ú__name__Ú
__module__Ú__qualname__r#   r6   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"   rD   r#   ÚpopulateFile)r(   )r*   r+   r,   r#   d   s    zOpenFileTestCase.setUpc             C   sH  | 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dddddddg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é   é   zArray example)ÚtitleÚtableZvar1zTable exampleé)   ÚanarrayzArray titleÚatablezTable titleÚagroupzGroup titleé*   Úanarray1é   é   é   é   é   zArray title 1Úanarray2zArray title 2Zatable1zTable title 1)rG   é   Úazu1,f4,a1)ZformatsÚatable2zTable title 2Úagroup2zGroup title 2Úagroup3zGroup title 3Úagroup4zGroup title 4)r5   ÚrootÚcreate_arrayÚcreate_tabler
   Ú_v_attrsÚtestattrÚcreate_groupÚattrsÚnumpyZrecrF   )r(   r]   ÚgroupÚarray1ZraZgroup3r+   r+   r,   rE   h   s0    

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_newrG   rH   zArray example)rI   ÚArrayN)r5   r^   r]   rF   rc   ZCLASSr3   Ú
capitalize)r(   Zclass_r+   r+   r,   Útest00_newFile’   s    zOpenFileTestCase.test00_newFilec          	   C   sX   t  ¡ }z>t tj |d¡¡}t |d¡}|  	|tj
¡ W d Q R X W d t |¡ X d S )Nztest.h5r=   )r-   ÚmkdtempÚsixÚ	text_typer:   ÚpathÚjoinr)   r1   Ú
assertTrueÚFileÚshutilÚrmtree)r(   Útemp_dirr4   r5   r+   r+   r,   Útest00_newFile_unicode_filename   s    z0OpenFileTestCase.test00_newFile_unicode_filenamec          	   C   sX   t  ¡ }z>t tj |d¡¡}t |d¡}|  	|tj
¡ W d Q R X W d t |¡ X d S )Nztest.h5r=   )r-   rj   rd   Zstr_r:   rm   rn   r)   r1   ro   rp   rq   rr   )r(   rs   r4   r5   r+   r+   r,   Ú!test00_newFile_numpy_str_filename¦   s    z2OpenFileTestCase.test00_newFile_numpy_str_filenamec          	   C   sX   t  ¡ }z>t tj |d¡¡}t |d¡}|  	|tj
¡ W d Q R X W d t |¡ X d S )Nztest.h5r=   )r-   rj   rd   Zunicode_r:   rm   rn   r)   r1   ro   rp   rq   rr   )r(   rs   r4   r5   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ÚTITLEzArray exampleN)Ú_reopenrw   r5   r]   rF   Úget_attrr3   )r(   rI   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.zr+)Úmoderw   Úarray2rQ   rR   zTitle example 2)rI   )rw   rx   N)ry   rw   r5   r^   r]   r}   rz   r3   )r(   rI   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)rX   )r|   rw   r}   rQ   rR   zTitle example 2)rI   )rw   rx   N)ry   rw   r5   r^   r]   r}   rz   r3   )r(   rI   r+   r+   r,   Útest02b_appendFile2Ó   s    z$OpenFileTestCase.test02b_appendFile2c          	   C   s^   | j d| jd | jj| jjdddgdd | j | jd |  t¡ | jjj W d	Q R X d	S )
z;Checking appending objects to an existing file in "w" mode.r=   )r|   rw   r}   rQ   rR   zTitle example 2)rI   )rw   N)ry   rw   r5   r^   r]   r/   ÚLookupErrorrF   )r(   r+   r+   r,   Útest03_appendErrorFileå   s    z'OpenFileTestCase.test03_appendErrorFilec          	   C   s,   |   t¡ tjdd| jd W dQ R X dS )z0Checking opening a non-existing file for readingznonexistent.h5Úr)r|   rw   N)r/   r0   r)   r1   rw   )r(   r+   r+   r,   Útest04a_openErrorFileõ   s    z&OpenFileTestCase.test04a_openErrorFilec             C   sZ   | j d| jd tjr"td| jƒ | jjj d¡}| jjj}|  	|dk	¡ |  
|d¡ dS )z2Checking alternate root access to the object tree.z/agroup)Úroot_ueprw   z
File tree dump:rx   NzArray title 1)ry   rw   r   ÚverboseÚprintr5   r]   rP   rz   ro   r3   )r(   rI   rP   r+   r+   r,   Útest04b_alternateRootFileü   s    

z*OpenFileTestCase.test04b_alternateRootFilec          	   C   s*   |   t¡ | jd| jd W dQ R X dS )z>Checking non-existent alternate root access to the object treez/nonexistent)r„   rw   N)r/   ÚRuntimeErrorry   rw   )r(   r+   r+   r,   Únotest04c_alternateRootFile  s    z,OpenFileTestCase.notest04c_alternateRootFilec          	   C   s¢   | j d| jd |  t¡ | j | jjj¡ W dQ R X | jj| jjddd | j | jd |  t¡ | jjj W dQ R X |  t¡ | j 	d¡ W dQ R X dS )	z&Checking removing a group recursively.zr+)r|   rw   NrN   rG   )Ú	recursive)rw   z/agroup/agroup3)
ry   rw   r/   r   r5   Úremove_noder]   rN   r€   Úget_node)r(   r+   r+   r,   Útest05a_removeGroupRecursively  s    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Q R X | j	j
| j	jddd	 |  t¡ | j	jj W dQ R X |  t¡ | j	 d
¡ W dQ R X dS )zKChecking removing a group recursively and access to it
        immediately.Ú
z<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=z,Running %s.test05b_removeGroupRecursively...zr+)r|   rw   rN   NrG   )rŠ   z/agroup/agroup3)r   r…   r†   r*   r@   ry   rw   r/   r   r5   r‹   r]   r€   rN   rŒ   )r(   r+   r+   r,   Útest05b_removeGroupRecursively.  s    
z/OpenFileTestCase.test05b_removeGroupRecursivelyc          	   C   s2   | j d| jd |  t¡ | jj`W dQ R X dS )z0Checking removing a node using ``__delattr__()``zr+)r|   rw   N)ry   rw   r/   ÚAttributeErrorr5   r]   rN   )r(   r+   r+   r,   Útest06_removeNodeWithDelH  s    z)OpenFileTestCase.test06_removeNodeWithDelc          	   C   sT   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W dQ R X dS )z7Checking removing a lonely group from an existing file.zr+)r|   rw   rZ   )rw   N)ry   rw   r5   r‹   r]   r/   r€   rZ   )r(   r+   r+   r,   Útest06a_removeGroupR  s
    z$OpenFileTestCase.test06a_removeGroupc          	   C   sT   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W dQ R X dS )z/Checking removing Leaves from an existing file.zr+)r|   rw   rL   )rw   N)ry   rw   r5   r‹   r]   r/   r€   rL   )r(   r+   r+   r,   Útest06b_removeLeaf`  s
    z#OpenFileTestCase.test06b_removeLeafc          	   C   sF   | j d| jd | j | jjd¡ |  t¡ | jjj W dQ R X dS )z3Checking removing Leaves and access it immediately.zr+)r|   rw   rL   N)ry   rw   r5   r‹   r]   r/   r€   rL   )r(   r+   r+   r,   Útest06c_removeLeafm  s    z#OpenFileTestCase.test06c_removeLeafc          	   C   s<   | j d| jd |  t¡ | j | jjd¡ W dQ R X dS )z%Checking removing a non-existent nodezr+)r|   rw   ÚnonexistentN)ry   rw   r/   r€   r5   r‹   r]   )r(   r+   r+   r,   Útest06d_removeLeafw  s    z#OpenFileTestCase.test06d_removeLeafc          	   C   sT   | j d| jd | j | jjd¡ | j | jd |  t¡ | jjj W dQ R X dS )z/Checking removing Tables from an existing file.zr+)r|   rw   rM   )rw   N)ry   rw   r5   r‹   r]   r/   r€   rM   )r(   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Q R X dS )z;Checking renaming a leave and access it after a close/open.zr+)r|   rw   rV   )rw   z	/anarray2rG   N)ry   rw   r5   Úrename_noder]   rL   rV   r3   Ú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Q R X dS )z7Checking renaming Leaves and accesing them immediately.zr+)r|   rw   rV   z	/anarray2rG   N)ry   rw   r5   r˜   r]   rL   rV   r3   r™   rš   r›   r/   r€   )r(   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.zr+)r|   rw   rV   ÚhelloN)ry   rw   r5   r˜   r]   rL   rV   rc   rx   r3   rI   )r(   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 )z/Checking renaming a Group under a nested group.zr+)r|   rw   Úanarray3zArray title 2N)
ry   rw   r5   r˜   r]   rN   rV   r¡   r3   Ú_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Q R X | jjj}| jj|ddd |  d| jk¡ |  | jjj	|k¡ dS )z-Checking renaming a node to an existing name.zr+)r|   rw   rF   NT)Ú	overwritez/anarray)
ry   rw   r/   r   r5   r˜   r]   rL   ro   rF   )r(   rL   r+   r+   r,   Útest08_renameToExistingLeafÆ  s    
z,OpenFileTestCase.test08_renameToExistingLeafc          
   C   s`   | j d| jd t ¡ > tjdtd |  t¡ | j | jj	j
d¡ W dQ R X W dQ R X dS )z4Checking renaming a node to a non-valid natural namezr+)r|   rw   Úerror)Úcategoryzarray 2N)ry   rw   ÚwarningsÚcatch_warningsÚfilterwarningsr   r/   r5   r˜   r]   rL   )r(   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Q R X |  t¡ | j 
d¡ W dQ R X dS )	z;Checking renaming a Group and access it after a close/open.zr+)r|   rw   r[   )rw   z/agroup3z/agroup3/agroup3Nz/agroup/agroup3)ry   rw   r5   r˜   r]   rN   r[   r3   Ú_v_namerš   rŒ   r/   r€   )r(   re   Ú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Q R X |  t¡ | j 
d¡ W dQ R X dS )z4Checking renaming a Group and access it immediately.zr+)r|   rw   r[   z/agroup3z/agroup3/agroup3Nz/agroup/agroup3)ry   rw   r5   r˜   r]   rN   r[   r3   r­   rš   rŒ   r/   r€   )r(   re   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.zr+)r|   rw   r[   ÚHelloN)ry   rw   r5   r˜   r]   rN   r[   r`   rx   r3   r¢   )r(   re   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 )z/Checking renaming a Group under a nested group.zr+)r|   rw   r\   zGroup title 3N)
ry   rw   r5   r˜   r]   rN   r[   r\   r3   r¢   )r(   re   r+   r+   r,   Útest09d_renameGroup"  s    z$OpenFileTestCase.test09d_renameGroupc             C   s–   | j d| jd | jjjjj}|  |dk	¡ | jjdddd |  d| jk¡ |  d	| jk¡ x2d
D ]*}|  || jk¡ |  	|| j 
|¡j¡ qdW dS )z>Checking renaming a Group with nested groups in the LRU cache.zr+)r|   rw   Nú/rN   Zagroup_)r™   Únewnamez/agroup_/agroup4z/agroup)z/agroup_z/agroup_/agroup3z/agroup_/agroup3/agroup4)ry   rw   r5   r]   rN   r[   r\   ro   r˜   r3   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	Q R X d	S )
z9Checking moving a leave and access it after a close/open.zr+)r|   rw   r´   ÚnewgrouprV   )rw   z/newgroup/anarray2rH   N)ry   rw   r5   rb   Ú	move_noder]   rL   r¹   rV   r3   r™   rš   r›   r/   r€   )r(   r¹   rœ   r+   r+   r,   Útest10_moveLeafA  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Q R X dS )	z;Checking moving a leave and access it without a close/open.zr+)r|   rw   r´   r¹   rV   z/newgroup/anarray2rH   N)ry   rw   r5   rb   rº   r]   rL   r¹   rV   r3   r™   rš   r›   r/   r€   )r(   r¹   rœ   r+   r+   r,   Útest10b_moveLeafU  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.zr+)r|   rw   r´   r¹   rV   rŸ   N)ry   rw   r5   rb   rº   r]   rL   r¹   rV   rc   rx   r3   rI   )r(   r¹   rœ   r+   r+   r,   Útest10c_moveLeaff  s    z!OpenFileTestCase.test10c_moveLeafc          	   C   sD   | j d| jd |  t¡  | j | jjj| jjd¡ W dQ R X dS )z+Checking moving a leaf to an existing name.zr+)r|   rw   rF   N)ry   rw   r/   r   r5   rº   r]   rL   )r(   r+   r+   r,   Útest10d_moveToExistingLeafs  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	Q R X d	S )
z9Checking moving a table and access it after a close/open.zr+)r|   rw   r´   r¹   rY   )rw   z/newgroup/atable2rH   N)ry   rw   r5   rb   rº   r]   rM   r¹   rY   r3   r™   rš   r›   r/   r€   )r(   r¹   Útable_r+   r+   r,   Útest10_2_moveTable}  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Q R X dS )	z;Checking moving a table and access it without a close/open.zr+)r|   rw   r´   r¹   rY   z/newgroup/atable2rH   N)ry   rw   r5   rb   rº   r]   rM   r¹   rY   r3   r™   rš   r›   r/   r€   )r(   r¹   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.zr+)r|   rw   r´   r¹   rY   z/newgroup/atable2rH   rG   N)ry   rw   r5   rb   r]   rM   Úrowrº   r¹   rY   r3   r™   rš   r›   rJ   Ú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.zr+)r|   rw   r´   r¹   rY   rŸ   N)ry   rw   r5   rb   rº   r]   rM   r¹   rY   rc   rx   r3   rI   )r(   r¹   r¿   r+   r+   r,   Útest10_2c_moveTable¼  s    z$OpenFileTestCase.test10_2c_moveTablec          	   C   sD   | j d| jd |  t¡  | j | jjj| jjd¡ W dQ R X dS )z,Checking moving a table to an existing name.zr+)r|   rw   rJ   N)ry   rw   r/   r   r5   rº   r]   rM   )r(   r+   r+   r,   Útest10_2d_moveToExistingTableÉ  s    z.OpenFileTestCase.test10_2d_moveToExistingTablec             C   sN   | j d| jd | jjj}| jj|| jjddd | jjj}|  ||k¡ dS )z<Checking moving a table to an existing name, overwriting it.zr+)r|   rw   rJ   T)r¥   N)ry   rw   r5   r]   rM   rº   rJ   ro   )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
Q R X |  t¡ | j d¡ W d
Q R X d
S )z9Checking moving a Group and access it after a close/open.zr+)r|   rw   r¹   r[   )rw   z/newgroup/agroup3rH   z/newgroup/agroup3/agroup3rQ   Nz/agroup/agroup3)ry   rw   r5   rb   r]   rº   rN   r¹   r[   r3   r­   rš   r›   rŒ   r/   r€   )r(   r¹   re   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	Q R X |  t¡ | j d
¡ W d	Q R X d	S )z2Checking moving a Group and access it immediately.zr+)r|   rw   r¹   r[   z/newgroup/agroup3rH   z/newgroup/agroup3/agroup3rQ   Nz/agroup/agroup3)ry   rw   r5   rb   r]   rº   rN   r¹   r[   r3   r­   rš   r›   rŒ   r/   r€   )r(   r¹   re   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.zr+)r|   rw   r¹   r[   r±   N)ry   rw   r5   rb   r]   rº   rN   r¹   r[   r`   rx   Zholar3   r¢   )r(   r¹   re   r+   r+   r,   Útest11c_moveGroup  s    z"OpenFileTestCase.test11c_moveGroupc          	   C   sD   | j d| jd |  t¡  | j | jjj| jjd¡ W dQ R X dS )z,Checking moving a group to an existing name.zr+)r|   rw   rZ   N)ry   rw   r/   r   r5   rº   r]   rN   )r(   r+   r+   r,   Útest11d_moveToExistingGroup)  s    z,OpenFileTestCase.test11d_moveToExistingGroupc             C   sN   | j d| jd | jjj}| jj|| jjddd | jjj}|  ||k¡ dS )z<Checking moving a group to an existing name, overwriting it.zr+)r|   rw   rN   T)r¥   N)ry   rw   r5   r]   rZ   rº   rN   ro   )r(   rÉ   rÊ   r+   r+   r,   Ú$test11e_moveToExistingGroupOverwrite3  s    

z5OpenFileTestCase.test11e_moveToExistingGroupOverwritec             C   sJ   | j d| jd | jjj}| j || jjd¡ | jjj}|  ||k¡ dS )z#Checking moving a node over itself.zr+)r|   rw   rF   N)ry   rw   r5   r]   rF   rº   ro   )r(   rÉ   rÊ   r+   r+   r,   Útest12a_moveNodeOverItself@  s
    

z+OpenFileTestCase.test12a_moveNodeOverItselfc          	   C   sD   | j d| jd |  t¡  | j | jjj| jjj¡ W dQ R X dS )z$Checking moving a group into itself.zr+)r|   rw   N)ry   rw   r/   r   r5   rº   r]   rZ   )r(   r+   r+   r,   Útest12b_moveGroupIntoItselfL  s    z,OpenFileTestCase.test12b_moveGroupIntoItselfc             C   sH   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||k¡ dS )zCopying a leaf.zr+)r|   rw   N)ry   rw   r5   Ú	copy_noder]   rF   rZ   ro   )r(   Únew_noderÊ   r+   r+   r,   Útest13a_copyLeafU  s
    z!OpenFileTestCase.test13a_copyLeafc             C   sH   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||k¡ dS )zCopying a group.zr+)r|   rw   N)ry   rw   r5   rÓ   r]   rZ   rN   ro   )r(   rÔ   rÊ   r+   r+   r,   Útest13b_copyGroupa  s
    z"OpenFileTestCase.test13b_copyGroupc             C   sH   | j d| jd | j | jjj| jjj¡}| jjjj}|  ||k¡ dS )zCopying a group into itself.zr+)r|   rw   N)ry   rw   r5   rÓ   r]   rZ   ro   )r(   rÔ   rÊ   r+   r+   r,   Útest13c_copyGroupSelfm  s
    z&OpenFileTestCase.test13c_copyGroupSelfc             C   sˆ   | j d| jd | jj| jjj| jjjdd}| jjjj}|  ||k¡ |j}|  |dk	¡ |j	}|  |dk	¡ |j
}|  |dk	¡ dS )zRecursively copying a group.zr+)r|   rw   T)rŠ   N)ry   rw   r5   rÓ   r]   rN   rZ   ro   rP   rV   r[   )r(   rÔ   rÊ   Z	dstChild1Z	dstChild2Z	dstChild3r+   r+   r,   Útest13d_copyGroupRecursivey  s    z+OpenFileTestCase.test13d_copyGroupRecursivec          	   C   s    | j d| jd t d¡}tj|d| jd}zZ| jj| jj|jdd}|j}|  	||k¡ |  	d|k¡ |  	d|k¡ |  	d	|k¡ W d
| 
¡  t |¡ X d
S )zARecursively copying the root group into the root of another file.zr+)r|   rw   z.h5r=   T)rŠ   z/agroupz/agroup/anarray1z/agroup/agroup3N)ry   rw   r-   r.   r)   r1   r5   rÓ   r]   ro   r2   r:   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}zj| dd¡ | jj| jj	|j	j
dd}|j	j
}|  ||k¡ |  d	|k¡ |  d
|k¡ |  d|k¡ W d| ¡  t |¡ X dS )z@Recursively copying the root group into a group in another file.zr+)r|   rw   z.h5r=   r´   rZ   T)rŠ   z/agroup2/agroupz/agroup2/agroup/anarray1z/agroup2/agroup/agroup3N)ry   rw   r-   r.   r)   r1   rb   r5   rÓ   r]   rZ   ro   r2   r:   r;   )r(   rÙ   rÚ   rÔ   rÊ   r+   r+   r,   Útest13f_copyRootRecursive¡  s    
z*OpenFileTestCase.test13f_copyRootRecursivec             C   sJ   | j d| jd | jj}|  |dk	¡ | jt| jj| jj| jjdd dS )z/Recursively copying the root group into itself.zr+)r|   rw   NT)rŠ   )ry   rw   r5   r]   ro   r/   r0   rÓ   )r(   rZ   r+   r+   r,   Útest13g_copyRootItself¹  s
    z'OpenFileTestCase.test13g_copyRootItselfc          	   C   s@   | j d| jd |  t¡ | jj| jjjdd W dQ R X dS )zCopying over an existing node.zr+)r|   rw   rN   )rµ   N)ry   rw   r/   r   r5   rÓ   r]   rZ   )r(   r+   r+   r,   Útest14a_copyNodeExistingÄ  s    z)OpenFileTestCase.test14a_copyNodeExistingc             C   sD   | j d| jd | jj| jjjddd}| jjj}|  ||k¡ dS )z.Copying over an existing node, overwriting it.zr+)r|   rw   rN   T)rµ   r¥   N)ry   rw   r5   rÓ   r]   rZ   rN   ro   )r(   rÔ   rÊ   r+   r+   r,   Ú!test14b_copyNodeExistingOverwriteÍ  s
    

z2OpenFileTestCase.test14b_copyNodeExistingOverwritec          	   C   s’   | j d| jd t d¡}tj|d| jd}zL| jj| jjj	j
|jd}| jj| jj|jddd}|j}|  ||k¡ W d| ¡  t |¡ X dS )	z<Copying over an existing node in other file, overwriting it.zr+)r|   rw   z.h5r=   )Z	newparentT)r¥   rŠ   N)ry   rw   r-   r.   r)   r1   r5   rÓ   r]   rN   rP   ro   r2   r:   r;   )r(   rÙ   rÚ   rÔ   rÊ   r+   r+   r,   Ú"test14b2_copyNodeExistingOverwriteÙ  s    


z3OpenFileTestCase.test14b2_copyNodeExistingOverwritec          	   C   s@   | j d| jd |  t¡ | jj| jjjdd W dQ R X dS )zCopying over self.zr+)r|   rw   rN   )rµ   N)ry   rw   r/   r   r5   rÓ   r]   rN   )r(   r+   r+   r,   Útest14c_copyNodeExistingSelfð  s    z-OpenFileTestCase.test14c_copyNodeExistingSelfc          	   C   sB   | j d| jd |  t¡ | jj| jjjddd W dQ R X dS )z'Copying over self, trying to overwrite.zr+)r|   rw   rN   T)rµ   r¥   N)ry   rw   r/   r   r5   rÓ   r]   rN   )r(   r+   r+   r,   Ú%test14d_copyNodeExistingOverwriteSelfù  s    z6OpenFileTestCase.test14d_copyNodeExistingOverwriteSelfc          	   C   sH   | j d| jd |  t¡$ | jj| jjj| jjjdd W dQ R X dS )z(Recursively copying a group into itself.zr+)r|   rw   T)rŠ   N)ry   rw   r/   r   r5   rÓ   r]   rN   )r(   r+   r+   r,   Útest14e_copyGroupSelfRecursive  s    z/OpenFileTestCase.test14e_copyGroupSelfRecursivec             C   sN   | j d| jd | jjj}| j || jjjd¡ | jjjj}|  ||k¡ dS )z.Moving and renaming a node in a single action.zr+)r|   rw   rF   N)	ry   rw   r5   r]   rP   rº   rN   rF   ro   )r(   rÉ   rÊ   r+   r+   r,   Útest15a_oneStepMove  s
    
z$OpenFileTestCase.test15a_oneStepMovec             C   sJ   | j d| jd | j | jjj| jjjd¡}| jjjj}|  ||k¡ dS )z/Copying and renaming a node in a single action.zr+)r|   rw   rF   N)	ry   rw   r5   rÓ   r]   rP   rN   rF   ro   )r(   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}|  ||k¡ |  |j	j
|j	j
¡ |  |jjj
|jjj
¡ |  |j ¡ |j ¡ ¡ dS )z&Copying full data and user attributes.zr+)r|   rw   Ú	groupcopyT)rµ   rŠ   N)ry   rw   r5   r]   rN   rÓ   ræ   ro   r3   r`   ra   rP   rc   Ú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}|  ||k¡ |  t	|j
d
ƒ¡ |  t	|jjd
ƒ¡ |  |j ¡ ddd… |j ¡ ¡ dS )z,Copying partial data and no user attributes.zr+)r|   rw   ræ   TFr   rS   rH   )rµ   rŠ   ZcopyuserattrsÚstartÚstopÚstepra   N)ry   rw   r5   r]   rN   rÓ   ræ   ro   ÚassertFalseÚhasattrr`   rP   rc   r3   rç   )r(   rÉ   rÔ   rÊ   r+   r+   r,   Útest16b_partialCopy6  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	}|  
||k¡ |  |jj|jj¡ |  |jjjj|jjjj¡ |  |jj ¡ |jj ¡ ¡ W d| ¡  t |¡ X dS )	z:Copying full data and user attributes (from file to file).zr+)r|   rw   z.h5r=   ræ   T)rµ   rŠ   N)ry   rw   r-   r.   r)   r1   r5   r]   rÓ   ræ   ro   r3   r`   ra   rN   rP   rc   rç   r2   r:   r;   )r(   rÙ   rÚ   rÉ   rÔ   rÊ   r+   r+   r,   Útest16c_fullCopyI  s&    



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.zr+)r|   rw   Ú	tablecopyrW   )rµ   Ú
chunkshape)rW   N)	ry   rw   r5   r]   rJ   rÓ   r3   rñ   ÚassertNotEqual)r(   ÚsrcTableÚnewTabler+   r+   r,   Útest17a_CopyChunkshapee  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.zr+)r|   rw   rð   Úkeep)rµ   rñ   N)ry   rw   r5   r]   rJ   rÓ   r3   rñ   )r(   ró   rô   r+   r+   r,   Útest17b_CopyChunkshapep  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.zr+)r|   rw   rð   rW   )rµ   rñ   Z
tablecopy2ÚautoN)ry   rw   r5   r]   rJ   rÓ   r3   rñ   )r(   ró   rô   Z	newTable2r+   r+   r,   Útest17c_CopyChunkshapez  s    
z'OpenFileTestCase.test17c_CopyChunkshapec             C   s\   | j | jd xH| jjj| jjjgD ]0}| ¡  |  dt|ƒk¡ |  dt	|ƒk¡ q$W dS )z'Representing a closed node as a string.)rw   ÚclosedN)
ry   rw   r5   r]   rN   rL   Ú_f_closero   ÚstrÚrepr)r(   r£   r+   r+   r,   Útest18_closedRepr†  s
    z"OpenFileTestCase.test18_closedReprc             C   s<   | j d| jd | j ¡ }tjr*td|ƒ |  |dk¡ dS )z*Checking that the 'fileno()' method works.r‚   )r|   rw   zValue of fileno():r   N)ry   rw   r5   Úfilenor   r…   r†   ro   )r(   Úfdr+   r+   r,   Útest19_fileno  s
    

zOpenFileTestCase.test19_fileno)Lr@   rA   rB   r#   rE   ri   rt   ru   rv   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  rC   r+   r+   )r*   r,   rD   b   s   *			

	




			



rD   c               @   s   e Zd ZeZeedZdS )ÚNodeCacheOpenFile)rw   N)r@   rA   rB   r   rw   ÚdictÚopen_kwargsr+   r+   r+   r,   r    s   r  c               @   s   e Zd ZdZeedZdS )ÚNoNodeCacheOpenFiler   )rw   N)r@   rA   rB   rw   r  r  r+   r+   r+   r,   r  ¢  s   r  c               @   s   e Zd Ze ZeedZdS )ÚDictNodeCacheOpenFile)rw   N)r@   rA   rB   r   rw   r  r  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 )Nz.h5r=   zHello!)
r"   r  r#   r-   r.   Útxtfiler8   ÚfilehÚwriter2   )r(   )r*   r+   r,   r#   ­  s
    zCheckFileTestCase.setUpc                s(   | j  ¡  t | j¡ tt| ƒ ¡  d S )N)r	  r2   r:   r;   r  r"   r  ÚtearDown)r(   )r*   r+   r,   r  ¶  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)rF   rG   rH   zTitle example)rI   z
isHDF5File(%s) ==> %dN)r5   r^   r]   r2   r   r…   r†   r4   r)   Úis_hdf5_filer3   )r(   r+   r+   r,   Útest00_isHDF5File»  s    
z#CheckFileTestCase.test00_isHDF5Filec             C   s   t  | j¡}|  |dk¡ dS )z3Checking  tables.is_hdf5_file function (FALSE case)r   N)r)   r  r  ro   )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/   r0   r)   r  )r(   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)	r5   r2   r:   Úchmodr4   r/   r0   r)   r  )r(   r+   r+   r,   Útest01x_isHDF5File_unreadableØ  s    
z/CheckFileTestCase.test01x_isHDF5File_unreadablec             C   s\   | j j| j jdddgdd | j  ¡  t | j¡}tjrJt	ƒ  t	d| ƒ |  
|dk¡ dS )	z.Checking is_pytables_file function (TRUE case)rF   rG   rH   zTitle example)rI   z&
PyTables format version number ==> %sz1.0N)r5   r^   r]   r2   r)   Úis_pytables_filer4   r   r…   r†   ro   )r(   r  r+   r+   r,   Útest02_isPyTablesFileà  s    
z'CheckFileTestCase.test02_isPyTablesFilec             C   s6   t  | j¡}tjr$tƒ  td| ƒ |  |dk¡ dS )z/Checking is_pytables_file function (FALSE case)z&
PyTables format version number ==> %sN)r)   r  r  r   r…   r†   ro   )r(   r  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Q R X dS )z(Checking opening of a generic HDF5 file.zex-noattr.h5r‚   )r|   z/columnsZGroup)Z	classnameÚcolumnsZTDCrg   Úpressurez$Array object with type H5T_ARRAY -->zArray contents -->Nz	/detectorrJ   ZTable)
r   r)   r1   rŒ   r3   r­   r   r…   r†   rý   )r(   r4   r5   r  rœ   ÚuirJ   r+   r+   r,   Útest04_openGenericHDF5Fileÿ  s    z,CheckFileTestCase.test04_openGenericHDF5Filec          
   C   sR   t dƒ}t |¡6}|  t¡ | d¡}W dQ R X |  t|tƒ¡ W dQ R X dS )z@Checking failure loading resulting in an ``UnImplemented`` node.zsmpl_unsupptype.h5z/CompoundChunkedN)	r   r)   r1   ÚassertWarnsÚUserWarningrŒ   ro   Ú
isinstancer   )r(   r4   r5   r£   r+   r+   r,   Útest04b_UnImplementedOnLoading  s
    	z0CheckFileTestCase.test04b_UnImplementedOnLoadingc          
   C   sN   t  tdƒ¡6}|  t¡ | d¡}W dQ R X |  t|tƒ¡ W dQ R X dS )zVChecking opening of HDF5 files containing scalar dataset of
        UnImlemented type.z	scalar.h5z/variable length stringN)	r)   r1   r   r  r  rŒ   ro   r  r   )r(   r5   r£   r+   r+   r,   Útest04c_UnImplementedScalar+  s    z-CheckFileTestCase.test04c_UnImplementedScalarc          
   C   s–   t dƒ}tj|ddv}|  t|jd¡ t ¡  t d¡ | d¡}W dQ R X |  	|j
d¡ tjrrtdt|ƒƒ |  t|j| jjd	¡ W dQ R X dS )
z7Checking that an UnImplemented object cannot be copied.zsmpl_unsupptype.h5r‚   )r|   z/CompoundChunkedÚignoreNZCompoundChunkedzUnImplement object -->Únewui)r   r)   r1   r  r  rŒ   r©   rª   Úsimplefilterr3   r­   r   r…   r†   rý   Úcopyr5   r]   )r(   r4   r5   r  r+   r+   r,   Útest05_copyUnimplemented4  s    

z*CheckFileTestCase.test05_copyUnimplementedc             C   s    t dƒ}tj|dd€}| |jjd¡}|  |jd¡ tj	rJt
dt|ƒƒ t ¡ : tjdtd |  t¡ | | jjd¡ W d	Q R X W d	Q R X W d	Q R X d	S )
z7Checking that an UnImplemented object cannot be copied.zex-noattr.h5r‚   )r|   r  zUnImplement object -->r§   )r¨   r!  N)r   r)   r1   rŒ   r]   r  r3   r­   r   r…   r†   rý   r©   rª   r«   r  r/   r#  r5   )r(   rÙ   rÚ   r  r+   r+   r,   Ú_test05_copyUnimplementedG  s    
z+CheckFileTestCase._test05_copyUnimplemented)r@   rA   rB   r#   r  r  r  r  r   Z
skipUnlessrí   r:   r  r  r  r  r  r  r  r$  r%  rC   r+   r+   )r*   r,   r  ¬  s   		&	r  Únt)rQ   Ú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"   r(  r#   r5   Zcreate_carrayr)   Z	Int64Atomr2   )r(   )r*   r+   r,   r#   b  s    zThreadingTestCase.setUpc                s¶   t  ¡ ‰ ‡ fdd„‰‡ fdd„‰| j}‡‡fdd„}g }tjj ¡ }x4tdƒD ](}t j|||fd}| 	¡  | 
|¡ qNW x tdƒD ]}|  | ¡ d	¡ q„W x|D ]}| ¡  q¢W d S )
Nc           	      s   ˆ  t j| |ŽS Q R X d S )N)r)   r1   )ÚargsÚkwargs)Úlockr+   r,   Úsyncronized_open_filek  s    z5ThreadingTestCase.test.<locals>.syncronized_open_filec          	      s   ˆ  | j ||ŽS Q R X d S )N)r2   )r(   r+  r,  )r-  r+   r,   Úsyncronized_close_fileo  s    z6ThreadingTestCase.test.<locals>.syncronized_close_filec                s„   yRˆ| dd}|j jdd…dd…f }| ¡ | ¡   krBdksHn t‚ˆ |ƒ W n" tk
rt   | t ¡ ¡ Y nX | d¡ d S )	Nr‚   )r|   é   é   é   é   r   ÚOK)	r]   r)  ÚmaxÚminÚAssertionErrorÚ	ExceptionÚputÚsysÚexc_info)ÚfilenameÚqÚfZarr)r/  r.  r+   r,   Úrunu  s    "z#ThreadingTestCase.test.<locals>.runé
   )Útargetr+  r4  )Ú	threadingZLockr4   rk   ZmovesZqueueÚQueuer   ZThreadré   rÄ   r3   Úgetrn   )r(   r<  r?  Zthreadsr=  ÚiÚtr+   )r-  r/  r.  r,   Útesth  s    
zThreadingTestCase.test)r@   rA   rB   r#   rG  rC   r+   r+   )r*   r,   r(  ^  s   r(  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   s|   | j j}| j  |ddg¡}d}|  tt|d|¡ |  |j|k¡ |  | d¡|k¡ |`|  |j|k¡ |  	t
t|d¡ dS )z-Setting a Python attribute over a child node.rG  rG   ÚfoobarN)r5   r]   r^   r  r   Úsetattrro   rG  Ú_f_get_childr/   r   Údelattr)r(   r]   ÚchildÚattrr+   r+   r,   Útest00_attrOverChild‘  s    z(PythonAttrsTestCase.test00_attrOverChildc             C   s‚   | j }|j}d}||_|  t|j|ddg¡ | d¡}|  |j|k¡ |  | d¡|k¡ |`|  |j|k¡ |  	t
t|d¡ dS )z/Creating a child node under a Python attribute.rI  rG  rG   z/testN)r5   r]   rG  r  r   r^   rŒ   ro   rK  r/   r   rL  )r(   r5   r]   rN  rM  r+   r+   r,   Útest01_childUnderAttr§  s    
z)PythonAttrsTestCase.test01_childUnderAttrc             C   sv   | j }| dddg¡}| dddg¡}||_||_|  |j|k¡ |  |j|k¡ |  t|jd¡ |  t|jd¡ dS )z9Assigning a ``Node`` value as an attribute to a ``Leaf``.r´   rf   rG   r}   z/array1/array2z/array2/array3N)r5   r^   r}   rf   ro   r/   r   rŒ   )r(   r5   rf   r}   r+   r+   r,   Útest02_nodeAttrInLeaf¿  s    
z)PythonAttrsTestCase.test02_nodeAttrInLeafc             C   s   | j }|j}| dddg¡}||_|  tt|d|¡ |  |j|k¡ |  |j|k¡ |  	t
|jd¡ |  | d¡|k¡ |`|  	tt|d¡ dS )z:Assigning a ``Node`` value as an attribute to a ``Group``.r´   rF   rG   z/arrayAliasz/arrayN)r5   r]   r^   Z
arrayAliasr  r   rJ  ro   rF   r/   r   rŒ   r   rL  )r(   r5   r]   rF   r+   r+   r,   Útest03_nodeAttrInGroupÓ  s    z*PythonAttrsTestCase.test03_nodeAttrInGroupN)r@   rA   rB   Ú__doc__rO  rP  rQ  rR  r+   r+   r+   r,   rH  Ž  s
   rH  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   sJ   | j  ¡  tjdd}z|  t| j j|¡ W dtj 	|¡rDt 
|¡ X dS )zTest copying a closed file.z.h5)ÚsuffixN)r5   r2   r-   r.   r/   r   Z	copy_filer:   rm   Úexistsr;   )r(   Zh5cfnamer+   r+   r,   Útest00_fileCopyFileClosedñ  s    
z'StateTestCase.test00_fileCopyFileClosedc             C   s<   | j  ¡  y| j  ¡  W n tk
r6   |  d¡ Y nX dS )z$Test closing an already closed file.z&could not close an already closed fileN)r5   r2   r   Úfail)r(   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)r5   r2   r/   r   rÅ   )r(   r+   r+   r,   Útest02_fileFlushClosed  s    
z$StateTestCase.test02_fileFlushClosedc             C   s<   |   d¡ y| j ¡  W n tk
r6   |  d¡ Y nX dS )zFlushing a read-only file.r‚   z could not flush a read-only fileN)ry   r5   rÅ   r   rX  )r(   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´   rG  N)r5   r2   r/   r   rb   )r(   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´   rG  N)ry   r/   r   r5   rb   )r(   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´   rG  N)r5   rb   r2   r/   r   r‹   )r(   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´   rG  r‚   N)r5   rb   ry   r/   r   r‹   )r(   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Útest2z/test1N)r5   rb   r2   r/   r   rº   )r(   r+   r+   r,   Útest08_fileMoveNodeClosed6  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`  ra  r‚   z/test1N)r5   rb   ry   r/   r   rº   )r(   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`  ra  z/test1N)r5   rb   r2   r/   r   rÓ   )r(   r+   r+   r,   Útest10_fileCopyNodeClosedH  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‚   z/test1ra  N)r5   rb   ry   r/   r   rÓ   )r(   r+   r+   r,   Útest11_fileCopyNodeROQ  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´   rG  z/testN)r5   rb   r2   r/   r   rŒ   )r(   r+   r+   r,   Útest13_fileGetNodeClosedY  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`  ra  N)r5   rb   r2   r/   r   ÚnextZ
walk_nodes)r(   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´   rG  z/testÚfooÚbarN)r5   rb   r2   r/   r   Úset_node_attrÚdel_node_attr)r(   r+   r+   r,   Útest15_fileAttrClosedh  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´   rG  z/testri  r‚   rj  N)r5   rb   rk  ry   r/   r   rl  )r(   r+   r+   r,   Útest16_fileAttrROr  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´   ra  N)
r5   Úenable_undorb   r2   r/   r   Zis_undo_enabledZget_current_markZundoZdisable_undo)r(   r+   r+   r,   Útest17_fileUndoClosed}  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´   rG  r‚   FN)r5   ro  rb   ry   r3   Z_undoEnabled)r(   r+   r+   r,   Útest18_fileUndoROˆ  s    

zStateTestCase.test18_fileUndoROc             C   sÎ   | j  dd¡}| j  dd¡}| ¡  |  t|jd¡ |  t| j j|¡ y| j  d¡}W n tk
rt   |  d¡ Y nX |  |j	dkd¡ |  |j	d	kd¡ | j  d¡}|  |j	dkd
¡ |  |j	d	k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)
r5   rb   rû   r/   r   rK  rŒ   rX  ro   Z	_v_isopen)r(   rr  rs  Zg2_Zg1_r+   r+   r,   Útest19a_getNode’  s&    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´   rF   rG   rH   zTitle example)rI   N)r5   r^   r/   Ú	NameErrorrŒ   )r(   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|¡ y| j jddd W n tk
rz   |  d¡ Y nX |  t|j¡ |  	d	| j k¡ |  	d| j k¡ d
S )zTest removing a closed node.r´   re   z/grouprF   rG   T)rŠ   z!closed node has not been reloadedz/group/arrayN)
r5   rb   r^   rû   r/   r   Z	_f_remover‹   rX  ro   )r(   re   rF   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´   rG  ri  r`   z/testN)
r5   rb   r`   rG  rû   r/   r   Úgetattrr3   Zget_node_attr)r(   r£   Z	nodeAttrsrN  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´   rG  z/testri  r‚   rj  N)r5   rb   rk  ry   r/   r   )r(   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´   rG  r`   N)r5   rb   r2   r/   r   rx  )r(   r£   r+   r+   r,   Útest22_fileClosesNodeð  s    
z#StateTestCase.test22_fileClosesNodec          
   C   s*  | j  dddddg¡ | 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Q R X W dQ R X dS )z6Testing reopening a file and closing it several times.r´   rG  rG   rH   rQ   r‚   r'  z(h5file1) open_count:z(h5file1) test[1]:z(h5file2) open_count:z(h5file2) test[1]:N)r5   r^   r2   r)   r1   r4   r3   Z
open_countr%   Ú_FILE_OPEN_POLICYr/   r>   r   r…   r†   r]   rG  )r(   Zh5file1rÚ   r+   r+   r,   Útest23_reopenFileø  s(    
zStateTestCase.test23_reopenFileN)r@   rA   rB   rS  rW  rY  rZ  r[  r\  r]  r^  r_  rb  rc  rd  re  rf  rh  rm  rn  rp  rq  rt  rv  rw  ry  rz  r{  r}  r+   r+   r+   r,   rT  í  s4   

			

!	
rT  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 )Nz/arrayz/scalarT)r"   r~  ry   r5   rŒ   rF   Úscalar)r(   r|   )r*   r+   r,   ry     s    zFlavorTestCase._reopenc                s:   t t| ƒ ¡  | j dd| j¡| _| j dd| j¡| _d S )Nr´   rF   r  )	r"   r~  r#   r5   r^   Ú
array_datarF   Úscalar_datar  )r(   )r*   r+   r,   r#   !  s    zFlavorTestCase.setUpc             C   s   |   tt| jdd¡ dS )zSetting an invalid flavor.Úflavorri  N)r/   r   rJ  rF   )r(   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‚   )r|   r‚  N)ry   r/   r   rJ  rF   r)   r‚  Úinternal_flavor)r(   r+   r+   r,   Útest01_readonly+  s    zFlavorTestCase.test01_readonlyc             C   sX   xRt D ]J}|| j_|  | jj|¡ t| j|ƒ}| jdd… }|  t |||¡¡ qW dS )z%Changing the flavor and reading data.N)	r   rF   r‚  r3   r   r€  ro   r   Úallequal)r(   r‚  ÚidataÚodatar+   r+   r,   Útest02_change3  s    
zFlavorTestCase.test02_changec             C   sF   x@t D ]8}|| j_|  | jj|¡ | jdd |  | jj|¡ qW dS )zStoring a changed flavor.zr+)r|   N)r   rF   r‚  r3   ry   )r(   r‚  r+   r+   r,   Útest03_store=  s
    
zFlavorTestCase.test03_storec          	   C   sb   | j j}d| j j_| jdd t| j|ƒ}|  t¡ | j  	¡ }W dQ R X |  
t |||¡¡ dS )z&Reading a dataset of a missing flavor.rI  r‚   )r|   N)rF   r‚  r`   ÚFLAVORry   r   r€  r  r   rç   ro   r   r†  )r(   r‚  r‡  rˆ  r+   r+   r,   Útest04_missingF  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)
rF   r‚  r3   rc   r‹  r)   r„  r/   r   rx  )r(   r+   r+   r,   Útest05_deleteQ  s    zFlavorTestCase.test05_deletec       	   	   C   sÒ   dd„ | j | jgD ƒ}dd„ |D ƒ}x|D ]}| j d|¡}|`q*W xˆdD ]€}|  |¡ xpt||ƒD ]b\}}|dkr| j d|¡}| d|¡}n|dkr¦| j d|¡}|  |jt	jj
d|j|jf ¡ qdW qJW d	S )
z0Copying a node with a deleted flavor (see #100).c             S   s   g | ]
}|j ‘qS r+   )r­   )Ú.0r£   r+   r+   r,   ú
<listcomp>^  s    z5FlavorTestCase.test06_copyDeleted.<locals>.<listcomp>c             S   s   g | ]}d | ‘qS )z%s_copyr+   )rŽ  r™   r+   r+   r,   r  _  s    r´   )zr+r‚   zr+r‚   z)flavor of node ``%s`` is not internal: %rN)rF   r  r5   rŒ   r‚  ry   r   r#  r3   r)   r„  rš   )	r(   ZsnamesZdnamesr™   r£   ZfmodeZsnameZdnameZsnoder+   r+   r,   Útest06_copyDeleted[  s     


z!FlavorTestCase.test06_copyDeletedc          
   C   sÚ   t tjjƒ}tjj ¡ }tjj ¡ }tjj ¡ }tjj ¡ }zFtjj	g d |  
ttjjƒt|ƒk ¡ |  
ttjjƒt|ƒk ¡ W d |d d … tjjd d …< tjj |¡ tjj |¡ tjj |¡ tjj |¡ X d S )N)rö   )Úlistr)   r‚  r   Ú	alias_mapr#  Úconverter_mapÚidentifier_mapÚdescription_mapZrestrict_flavorsro   r$   Úupdate)r(   r   r’  r“  r”  r•  r+   r+   r,   Útest07_restrict_flavorsp  s    z&FlavorTestCase.test07_restrict_flavors)r‚   )r@   rA   rB   rS  rd   Úaranger€  Zint32r  ry   r#   rƒ  r…  r‰  rŠ  rŒ  r  r  r—  rC   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 )Nz.h5)ÚprefixrU  )r-   r.   Úunicode_prefix)r(   r+   r+   r,   Ú_getTempFileNameŒ  s    z UnicodeFilename._getTempFileNamec                s0   t t| ƒ ¡  | j ddddg¡| _|  ¡  d S )Nr´   rG  rG   rH   )r"   rš  r#   r5   r^   rG  ry   )r(   )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.z	Filename:zArray:NzShould look like:rG   rH   zValues does not match.)r5   r]   rG  r   r…   r†   r4   r3   )r(   rG  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.z	Filename:z tables.is_hdf5_file?:N)	r5   r2   r   r…   r†   r4   r)   r  ro   )r(   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.z	Filename:zis_pytables_file?:FN)	r5   r2   r   r…   r†   r4   r)   r  rò   )r(   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™   Údatare   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 Q R X | j  |d¡}d S )	NrX   Z	face_datau   data at 40Â°Cgffffffö¿gffffffö?iô  r   Zvertex_data)r5   r2   r)   r1   r4   r]   rb   rd   ZsinhZlinspacer©   rª   r"  r   r¥  )r(   r]   re   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@   rA   rB   rœ  r  r#   rž  rŸ  r   Ústaticmethodr¥  r¦  rC   r+   r+   )r*   r,   rš  †  s   
		rš  )rQ   rT   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   )ÚPathz.h5)rU  )Zpathlibr©  r-   r.   )r(   r©  r+   r+   r,   r  Ê  s    z!PathLikeFilename._getTempFileNamec                s0   t t| ƒ ¡  | j ddddg¡| _|  ¡  d S )Nr´   rG  rG   rH   )r"   r¨  r#   r5   r^   rG  ry   )r(   )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.z	Filename:zArray:NzShould look like:rG   rH   zValues does not match.)r5   r]   rG  r   r…   r†   r4   r3   )r(   rG  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.z	Filename:z tables.is_hdf5_file?:N)	r5   r2   r   r…   r†   r4   r)   r  ro   )r(   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.z	Filename:zis_pytables_file?:FN)	r5   r2   r   r…   r†   r4   r)   r  rò   )r(   r+   r+   r,   r   é  s
    
zPathLikeFilename.test03)	r@   rA   rB   r  r#   rž  rŸ  r   rC   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 )Nz.h5)r"   rª  r#   r-   r.   r4   r5   )r(   )r*   r+   r,   r#   ô  s    zFilePropertyTestCase.setUpc                s<   | j r| j  ¡  tj | j¡r*t | j¡ tt| ƒ 	¡  d S )N)
r5   r2   r:   rm   rV  r4   r;   r"   rª  r  )r(   )r*   r+   r,   r  ù  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 }|  ||k¡ |  ||¡ d S )N)iÐ  iÐ  r=   )r|   rF   rT   )rd   ZzerosÚprodr¡  r£  Úitemsizer)   r1   r4   r5   r^   r]   Zget_filesizer2   r:   Ústatro   r3   )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=   )r|   rF   rG   rH   r   )r)   r1   r4   r5   r^   r]   r3   Úget_userblock_size)r(   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=   )r|   rF   rG   rH   r‚   r   )	r)   r1   r4   r5   r^   r]   r2   r3   r¯  )r(   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|   Úuser_block_sizerF   rG   rH   )r)   r1   r4   r5   r^   r]   r3   r¯  )r(   Ú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 )Ni   r=   )r|   r²  rF   rG   rH   )r)   r1   r4   r5   r^   r]   r3   r¯  )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 )	Ni   r=   )r|   r²  rF   rG   rH   r‚   )r|   )	r)   r1   r4   r5   r^   r]   r2   r3   r¯  )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 )Nr1  r=   )r|   r²  )r/   r>   r)   r1   r4   )r(   r³  r+   r+   r,   Útest_small_userblock_size2  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)   r1   r4   )r(   r³  r+   r+   r,   Útest_invalid_userblock_size7  s    z0FilePropertyTestCase.test_invalid_userblock_size)r@   rA   rB   r#   r  r®  r°  r±  r´  rµ  r¶  r·  r¸  rC   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   sL   xFdD ]>}t jd|d}| j d| ¡}|  t ||dd… ¡d¡ qW dS )z9Checking compatibility with Blosc on big-endian machines.)Zi1Zi2Zi4Zi8r@  )r£  r´   NzError in big-endian data!)rd   r˜  r5   rŒ   ro   r   r†  )r(   Z	dset_namerX   Zdsetr+   r+   r,   Útest00_bigendianB  s
    
zBloscBigEndian.test00_bigendianN)r@   rA   rB   r   r4   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 k	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)   r1   r   r…   r†   r]   rJ   Úwhererg  r2   r9  )ÚfnÚqoutÚfpZrowsr+   r+   r,   Ú_workerQ  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¡,}|j|j	d	|tj
d
dd|d fd W d Q R X tjr~tdƒ t|ƒ tjr”tdƒ yt ¡ }W n tk
r¼   tdƒ Y n8X tjt||fd}d|_| ¡  | ¡ }tjrôt|ƒ W d t |¡ X d S )Nzmultiproc-blosc9-z.h5)r›  rU  g    €OAc             s   s    | ]}||d  |d fV  qdS )rH   rQ   Nr+   )rŽ  rE  r+   r+   r,   ú	<genexpr>r  s   z4BloscSubprocess.test_multiprocess.<locals>.<genexpr>zi4,i8,f8r=   rJ   é	   Zblosc)Z	complevelZcomplibrQ   )Úfiltersrñ   z**** Running from main process:z**** Running from subprocess:z*Permission denied due to /dev/shm settings)rA  r+  T)r-   r.   Úintrd   Zfromiterr   r)   r1   r_   r]   ZFiltersr   r…   r†   r¿  ÚmprC  ÚOSErrorZProcessZdaemonré   rD  r:   r;   )r(   r4   ÚsizeZsar5   r½  ZpsÚresultr+   r+   r,   Útest_multiprocessm  s4    
z!BloscSubprocess.test_multiprocessN)r@   rA   rB   rÉ  r+   r+   r+   r,   rÀ  g  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 )N)r"   rÊ  r#   r)   r9   ÚDEFAULT_H5_BACKTRACE_POLICYÚ_old_policy)r(   )r*   r+   r,   r#   ’  s    zHDF5ErrorHandling.setUpc                s   | j tj_tt| ƒ ¡  d S )N)rÌ  r)   r9   rË  r"   rÊ  r  )r(   )r*   r+   r,   r  –  s    
zHDF5ErrorHandling.tearDownc          	   C   s†   d}t jddd}zbt|dƒ}| || ¡ W d Q R X tjtj|gtjtjd}| 	¡ \}}|  
d| d¡k¡ W d t |¡ X 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
zhdf5-error-handling-z.py)r›  rU  r=   )ÚstdoutÚstderrz	HDF5-DIAGÚascii)r-   r.   r8   r
  Ú
subprocessÚPopenr:  Ú
executableÚPIPEÚcommunicaterì   Údecoder:   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}zbt|dƒ}| || ¡ W d Q R X tjtj|gtjtjd}| 	¡ \}}|  
d| d¡k¡ W d t |¡ X 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
zhdf5-error-handling-z.py)r›  rU  r=   )rÍ  rÎ  z	HDF5-DIAGrÏ  )r-   r.   r8   r
  rÐ  rÑ  r:  rÒ  rÓ  rÔ  ro   rÕ  r:   r;   )r(   rÖ  r<  r¾  r×  rÍ  rÎ  r+   r+   r,   Útest_enable_messages³  s    	
z&HDF5ErrorHandling.test_enable_messagesc          	   C   s@   t  d¡}t|dƒ ¡  zt |¡}| ¡  W d t |¡ X d S )Nz.h5r7   )r-   r.   r8   r2   r)   r1   r:   r;   )r(   r4   r5   r+   r+   r,   Ú_raise_exterrorÌ  s    

z!HDF5ErrorHandling._raise_exterrorc          	   C   s>   dt j_|  t j¡}|  ¡  W d Q R X |  |jjd k¡ d S )NT)r)   r9   rË  r/   rÚ  rì   Ú	exceptionÚh5backtrace)r(   Úcmr+   r+   r,   Útest_h5_backtrace_quietÖ  s    z)HDF5ErrorHandling.test_h5_backtrace_quietc          	   C   sb   dt j_|  t j¡}|  ¡  W d Q R X |  |jjd k¡ t|jƒ}|  	|jjd d |k¡ d S )NÚVERBOSEéÿÿÿÿ)
r)   r9   rË  r/   rÚ  rì   rÛ  rÜ  rü   ro   )r(   rÝ  Úmsgr+   r+   r,   Útest_h5_backtrace_verboseÞ  s    
z+HDF5ErrorHandling.test_h5_backtrace_verbosec          	   C   s>   dt j_|  t j¡}|  ¡  W d Q R X |  |jjd k¡ d S )NF)r)   r9   rË  r/   rÚ  ro   rÛ  rÜ  )r(   rÝ  r+   r+   r,   Útest_h5_backtrace_ignoreè  s    z*HDF5ErrorHandling.test_h5_backtrace_ignore)r@   rA   rB   r#   r  rØ  rÙ  rÚ  rÞ  râ  rã  rC   r+   r+   )r*   r,   rÊ  ‘  s   

rÊ  c               @   s†   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e ejdkd¡dd„ ƒZdS )ÚTestDescriptionc             C   s4   G dd„ dt ƒ}G dd„ d|ƒ}|  d|jk¡ d S )Nc               @   s   e Zd Zeƒ ZdS )zFTestDescription.test_isdescription_inheritance.<locals>.TestDescParentN)r@   rA   rB   r   Úcr+   r+   r+   r,   ÚTestDescParentô  s   ræ  c               @   s   e Zd ZdS )z@TestDescription.test_isdescription_inheritance.<locals>.TestDescN)r@   rA   rB   r+   r+   r+   r,   ÚTestDesc÷  s   rç  rå  )r   ro   r  )r(   ræ  rç  r+   r+   r,   Útest_isdescription_inheritanceò  s    z.TestDescription.test_isdescription_inheritancec             C   sª   t  ddtfg¡}t|ƒ\}}|  d|jk¡ |  d|jk¡ |  t|jƒd¡ |  t|jd t	ƒ¡ |  t|jd t	ƒ¡ |  |jd jt j
¡ |  |jd jt¡ d S )N)Úcol1Úint16Úcol2ré  rH   )rd   r£  Úfloatr   ro   Ú_v_colobjectsr3   r$   r  r	   rê  )r(   rF  Ú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	timestamprF  Zu4))zunit (cluster) idÚunitZu2rH   rF  rñ  )rd   r£  r   r3   r$   Ú_v_namesÚsorted)r(   ÚheaderrF  rî  rï  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k¡ |  d|jk¡ |  t|jƒd¡ |  t|jd t	ƒ¡ |  t|jd t
jƒ¡ |  |jd jt j¡ d S )N)Úxrê  )Úyrê  )ÚtimeÚfloat64Úvaluerø  rH   )rd   r£  r   ro   Ú_v_is_nestedrí  r3   r$   r  r	   r)   r   rù  )r(   Úd1Úd_comprî  rï  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 Q R X |  |j¡ |  d|jk¡ |  d|jk¡ |  t	|jƒd¡ |  t
|jd tƒ¡ |  t
|jd tjƒ¡ |  |jd jt j¡ d S )N)rö  rê  )r÷  rê  )rø  rù  rú  )rG   rø  rH   )rd   r£  r  r  r   ro   rû  rí  r3   r$   r  r	   r)   r   rù  )r(   rü  rý  rî  rï  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@   rA   rB   r   ré  r   rë  r+   r+   r+   r,   ræ  A	  s   ræ  )ré  rê  rë  )r   rd   r£  rì  r   r3   )r(   ræ  r£  rF  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>.TestDescParentN)r@   rA   rB   r   ré  r   rë  r+   r+   r+   r,   ræ  L	  s   ræ  )ré  rê  rë  )r   rd   r£  rì  r   r3   )r(   ræ  r£  rF  r+   r+   r,   Ú-test_dtype_from_descr_is_description_instanceJ	  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>.TestDescParentN)r@   rA   rB   r   ré  r   rë  r+   r+   r+   r,   ræ  W	  s   ræ  )ré  rê  rë  )r   rd   r£  rì  r   r  r   r3   )r(   ræ  r£  ZdesctiptionrF  r+   r+   r,   Ú*test_dtype_from_descr_description_instanceU	  s
    z:TestDescription.test_dtype_from_descr_description_instancec             C   s4   t  ddtfg¡}ttƒ tƒ dœƒ}|  ||¡ d S )N)ré  rê  rë  )ré  rë  )rd   r£  rì  r   r   r   r3   )r(   r£  rF  r+   r+   r,   Útest_dtype_from_descr_dicta	  s    z*TestDescription.test_dtype_from_descr_dictc             C   s   |   ttg ¡ d S )N)r/   r>   r   )r(   r+   r+   r,   Ú"test_dtype_from_descr_invalid_typeh	  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>.TestDescParentN)r@   rA   rB   r   ré  r   rë  r+   r+   r+   r,   ræ  n	  s   ræ  ú>)rï  ré  rë  )r   r   r3   rï  )r(   ræ  rF  r+   r+   r,   Útest_dtype_from_descr_byteorderl	  s    z/TestDescription.test_dtype_from_descr_byteorderc             C   sf   dt  ¡ i}t|ƒ}|  t|jƒt| ¡ ƒ¡ |  t|j	t
jƒ¡ |  t|j	j ¡ ƒt| ¡ ƒ¡ d S )Nr™   )r)   r   r   r3   ró  rò  Úkeysro   r  Ú_v_dtyperd   r£  Úfields)r(   Údrî  r+   r+   r,   Útest_str_namesw	  s    zTestDescription.test_str_names)rQ   zrequires Python 2c             C   s¨   t  d¡t ¡ i}t|ƒ}|  t|jƒt| ¡ ƒ¡ |  	t
|jtjƒ¡ g }x:t| ¡ ƒD ]*}t
|t jƒrz| | ¡ ¡ qZ| |¡ qZW |  	t|jj ¡ ƒt|ƒ¡ d S )Nr™   )rk   rl   r)   r   r   r3   ró  rò  r  ro   r  r  rd   r£  r‘  rÄ   Úencoder	  )r(   r
  rî  r  Úkeyr+   r+   r,   Útest_unicode_names€	  s    z"TestDescription.test_unicode_namesN)r@   rA   rB   rè  rð  rõ  rþ  rÿ  r   r  r  r  r  r  r  r   ÚskipIfr:  Úversion_infor  r+   r+   r+   r,   rä  ñ  s   
		rä  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        rì  rù  )r   r3   Údfltr£  rd   rù  r¬  ÚbaseZkindÚndimr$   r¡  rÇ  r«  Útype)r(   r¡  rX   r+   r+   r,   Útest_atom_attributes01“	  s    
zTestAtom.test_atom_attributes01c             C   s(   d}t |d}| ¡ }|  |j|¡ d S )N)r@  r@  )r¡  )r   r#  r3   r¡  )r(   r¡  rX   Úaar+   r+   r,   Útest_atom_copy01¡	  s    
zTestAtom.test_atom_copy01c             C   s(   d}t |d}| ¡ }|  |j|¡ d S )Ng       @)r  )r   r#  r3   r  )r(   r  rX   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 )N)r@  r@  g       @)r¡  r  )r  )r   r#  r3   r¡  rò   r  )r(   r¡  r  rX   r  r+   r+   r,   Útest_atom_copy_override­	  s    z TestAtom.test_atom_copy_overrideN)r@   rA   rB   r  r  r  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 )ÚTestColc             C   s(   d}t |d}| ¡ }|  |j|¡ d S )N)r@  r@  )r¡  )r   r#  r3   r¡  )r(   r¡  rå  Úccr+   r+   r,   Útest_col_copy01¸	  s    
zTestCol.test_col_copy01c             C   s(   d}t |d}| ¡ }|  |j|¡ d S )Ng       @)r  )r   r#  r3   r  )r(   r  rå  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 )N)r@  r@  g       @rQ   )r¡  r  ÚposrH   )r  )r   r#  r3   r¡  r  rò   Z_v_pos)r(   r¡  r  r  rå  r  r+   r+   r,   Útest_col_copy_overrideÄ	  s    zTestCol.test_col_copy_overrideN)r@   rA   rB   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   s0   t dƒ}t |d¡}|  |j¡ W d Q R X d S )Nz
python2.h5r‚   )r   r)   r1   ro   Úisopen)r(   r4   r5   r+   r+   r,   Útest_open_python2Ñ	  s    z*TestSysattrCompatibility.test_open_python2c          	   C   s0   t dƒ}t |d¡}|  |j¡ W d Q R X d S )Nz
python3.h5r‚   )r   r)   r1   ro   r"  )r(   r4   r5   r+   r+   r,   Útest_open_python3Ö	  s    z*TestSysattrCompatibility.test_open_python3N)r@   rA   rB   r#  r$  r+   r+   r+   r,   r!  Ð	  s   r!  c              C   sV  t  ¡ } d}xBt|ƒ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W | S )NrG   )r   Z	TestSuiter   ZaddTestZ	makeSuiter!   r  r  r  r  r(  rH  rT  r~  rš  r¨  rª  r¹  rÀ  rÊ  rä  r  r  r!  )ZtheSuiteZniterrE  r+   r+   r,   ÚsuiteÜ	  s.    r%  Ú__main__)ZdefaultTest)N)]Z
__future__r   r   r:   r:  Zsix.moves.queuerk   rq   Úplatformr-   r©   rB  rÐ  Z	six.movesr   r   ZmultiprocessingrÅ  Zmultiprocessing_importedÚImportErrorrd   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TempFileMixinrD   r  r  r  r  r  r™   r  r%   r|  r(  rH  rT  r~  ÚsystemÚlowerÚgetfilesystemencodingrš  r¨  rª  Zblosc_availZTestFileMixinr¹  r¿  rÀ  rÊ  rä  r  r  r!  r%  r@   Z
parse_argvÚargvZprint_versionsÚmainr+   r+   r+   r,   Ú<module>   s    
P5        C 3
-_  )r=+K
%` "%
