a
    =Â×_l ã                   @   s–  d Z ddlZddlZddlZddlmZ ddlZddlmZm	Z	 ddl
Z
ddl
mZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZ G dd„ deƒZG dd„ dejeƒZG dd„ deƒZ G dd„ deƒZ!G dd„ deƒZ"G dd„ deƒZ#G dd„ deƒZ$G dd„ deƒZ%G dd„ dejeƒZ&G dd„ de&ƒZ'G dd „ d e&ƒZ(G d!d"„ d"e&ƒZ)G d#d$„ d$e&ƒZ*G d%d&„ d&e&ƒZ+G d'd(„ d(e&ƒZ,G d)d*„ d*ejeƒZ-G d+d,„ d,e-ƒZ.G d-d.„ d.e-ƒZ/G d/d0„ d0ej0eƒZ1G d1d2„ d2ej0eƒZ2G d3d4„ d4ejeƒZ3G d5d6„ d6ejeƒZ4G d7d8„ d8eƒZ5G d9d:„ d:ej0eƒZ6G d;d<„ d<ejeƒZ7d=d>„ Z8e9d?kr’e :ej;¡ e <¡  ej=d>d@ dS )AzIThis test unit checks node attributes that are persistent (AttributeSet).é    N)ÚLooseVersion)Úassert_array_equalÚassert_almost_equal)ÚIsDescriptionÚ	Int32AtomÚ	StringColÚIntColÚInt16ColÚFloatColÚ
Float32Col)ÚDataTypeWarning)ÚNODE_CACHE_SLOTS)Úcommon)ÚunittestÚtest_filename)ÚPyTablesTestCasec                   @   s.   e Zd ZeddZeƒ Zeƒ Ze	ƒ Z
eƒ ZdS )ÚRecordé   )ÚitemsizeN)Ú__name__Ú
__module__Ú__qualname__r   Zvar1r   Zvar2r	   Zvar3r
   Zvar4r   Zvar5© r   r   ú;lib/python3.9/site-packages/tables/tests/test_attributes.pyr      s
   
r   c                       sô   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd7d
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e ejd2 d3k d4¡d5d6„ ƒZ‡  Z S )8ÚCreateTestCasec                    s^   t t| ƒ ¡  | jj| _| j | jdtd¡| _| j | jddgd¡| _	| j 
| jdd¡| _d S ©NÚatablezTable titleÚanarrayé   úArray titleÚagroupúGroup title)Úsuperr   ÚsetUpÚh5fileÚrootÚcreate_tabler   ÚtableÚcreate_arrayÚarrayÚcreate_groupÚgroup©Úself©Ú	__class__r   r   r#       s    
ÿÿÿzCreateTestCase.setUpc                 C   sØ   d}| j  | jjdd| ¡ | j  | jjdd| ¡ | j  | jjdd| ¡ | jrztjr`t	dƒ | j
d| jd | j j| _|  | j  | jjd¡d| ¡ |  | j  | jjd¡d| ¡ |  | j  | jjd¡d| ¡ d	S )
z7Checking setting large string attributes (File methods)é   Úattr1ÚpÚaÚnú(closing file version)úr+©ÚmodeÚnode_cache_slotsN)r$   Úset_node_attrr%   r    r   r   Úcloser   ÚverboseÚprintÚ_reopenr9   ÚassertEqualÚget_node_attr©r-   Z
attrlengthr   r   r   Útest01_setAttributes.   s$    
ÿÿÿz#CreateTestCase.test01_setAttributesc                 C   s2   | j r.tjrtdƒ | jd| jd | jj| _d S )Nr5   r6   r7   )r;   r   r<   r=   r>   r9   r$   r%   r,   r   r   r   ÚreopenH   s
    zCreateTestCase.reopenc                 C   sB   |   ¡  |  || jjj¡ |  || jjj¡ |  || jjj¡ d S ©N)rC   ÚassertNotInr%   r    Ú_v_attrsr   Úattrsr   )r-   Únamer   r   r   Úcheck_missingP   s    zCreateTestCase.check_missingÚ c                 C   sð  |   |¡ | j | jj||¡ | j | jj||¡ | j | jj||¡ |  ¡  |  | j 	| jj|¡|¡ |  | j 	| jj|¡|¡ |  | j 	| jj|¡|¡ | j 
| jj|¡ | j 
| jj|¡ | j 
| jj|¡ |   |¡ | jj ||¡ | jj ||¡ | jj ||¡ |  ¡  |  | jj |¡|¡ |  | jj |¡|¡ |  | jj |¡|¡ | jj |¡ | jj |¡ | jj |¡ |   |¡ t| jjj||ƒ t| jjj||ƒ t| jjj||ƒ |  ¡  |  t| jjj|ƒ|¡ |  t| jjj|ƒ|¡ |  t| jjj|ƒ|¡ t| jjj|ƒ t| jjj|ƒ t| jjj|ƒ |   |¡ || jjj|< || jjj|< || jjj|< |  ¡  |  | jjj| |¡ |  | jjj| |¡ |  | jjj| |¡ | jjj|= | jjj|= | jjj|= |   |¡ dS )z*Check validity of attribute name filteringN)rI   r$   r:   r%   r    r   r   rC   r?   r@   Údel_node_attrÚ
_f_setattrÚset_attrÚ
_f_getattrÚget_attrZ
_f_delattrZdel_attrÚsetattrrF   rG   ÚgetattrÚdelattr)r-   rH   Úvalr   r   r   Ú
check_nameW   sZ    



zCreateTestCase.check_namec                 C   s’   t  ¡ F t  dtj¡ |  d¡ |  d¡ |  d¡ |  d¡ W d  ƒ n1 sT0    Y  |  t| jd¡ |  t| jd¡ |  t| jd	¡ dS )
z!Checking attribute names validityÚignorer3   za:bz/a/bÚ.NrJ   Ú__members__r   )	ÚwarningsÚcatch_warningsÚsimplefilterÚtablesÚNaturalNameWarningrT   ÚassertRaisesÚ
ValueErrorÚ	TypeErrorr,   r   r   r   Útest01a_setAttributes“   s    



(z$CreateTestCase.test01a_setAttributesc                 C   sÀ   d}| j j dd| ¡ | j j dd| ¡ | j j dd| ¡ | jrntjrTt	dƒ | j
d| jd | jj | _ |  | j j d¡d| ¡ |  | j j d¡d| ¡ |  | j j d¡d| ¡ d	S )
z7Checking setting large string attributes (Node methods)r0   r1   r2   r3   r4   r5   r6   r7   N)r%   r    rL   r   rM   r   r;   r   r<   r=   r>   r9   r$   r?   rN   rO   rA   r   r   r   Útest02_setAttributesŸ   s     
ÿÿz#CreateTestCase.test02_setAttributesc                 C   s¨   d}d| | j j_d| | jj_d| | jj_| jr\tjrBt	dƒ | j
d| jd | jj| _|  | jjjjd| ¡ |  | jjjjd| ¡ |  | jjjjd| ¡ dS )	z?Checking setting large string attributes (AttributeSet methods)r0   r2   r3   r4   r5   r6   r7   N)r+   rF   r1   r'   rG   r)   r;   r   r<   r=   r>   r9   r$   r%   r?   r    r   r   rA   r   r   r   Útest03_setAttributes¶   s    
z#CreateTestCase.test03_setAttributesc                 C   sÀ  d| j j_d| j j_d| j j_tjr6td| j j ¡ ƒ d| j	j
_d| j	j
_d| j	j
_tjrltd| j	j
 ¡ ƒ d| jj
_d| jj
_d| jj
_tjr¢td| jj
 ¡ ƒ | jrÐtjr¶tdƒ | jd| jd | jj| _| jj}|  |j d¡g d	¢¡ |  |j d
¡g d¢¡ |  |j d¡g d¢¡ | jj}|  |j
 ¡ g d¢¡ |  |j
 d
¡g d¢¡ |  |j
 d¡g d¢¡ | jj}|  |j
 ¡ g d¢¡ |  |j
 d
¡g d¢¡ |  |j
 d¡g d¢¡ dS )zChecking listing attributes.Ú1Ú2Ú3úAttribute list:r5   r6   r7   Úuser©ÚpqÚqrÚrsÚsys)ÚCLASSÚTITLEÚVERSIONÚall©rm   rn   ro   ri   rj   rk   ©r3   ÚbÚc)rm   ÚFIELD_0_FILLÚFIELD_0_NAMEÚFIELD_1_FILLÚFIELD_1_NAMEÚFIELD_2_FILLÚFIELD_2_NAMEÚFIELD_3_FILLÚFIELD_3_NAMEÚFIELD_4_FILLÚFIELD_4_NAMEÚNROWSrn   ro   )rm   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   rn   ro   r3   rs   rt   ©ÚiÚjÚk)rm   ÚFLAVORrn   ro   )rm   r„   rn   ro   r   r‚   rƒ   N)r+   rF   ri   rj   rk   r   r<   r=   Ú_f_listr'   rG   r3   rt   rs   r)   rƒ   r‚   r   r;   r>   r9   r$   r%   r    r?   r   r   ©r-   r    r   r   r   r   r   Útest04_listAttributesÌ   s\    









ÿÿÿ	ÿ
þ
þz$CreateTestCase.test04_listAttributesc                 C   s  d| j j_d| j j_d| j j_| j j`| jrTtjr:tdƒ | j	d| j
d | jj| _| jj}tjrrtd|j ¡ ƒ |  |j ¡ dd	g¡ tjr td
|j d¡ƒ |  |j d¡g d¢¡ |j`tjrÔtd|j ¡ ƒ |  |j ¡ d	g¡ tjrþtd
|j ¡ ƒ |  |j d¡g d¢¡ dS )zChecking removing attributes.rc   rd   re   r5   r6   r7   rf   rj   rk   úAttribute list in disk:rp   ©rm   rn   ro   rj   rk   ©rm   rn   ro   rk   N)r+   rF   ri   rj   rk   r;   r   r<   r=   r>   r9   r$   r%   r    r…   r?   ©r-   r    r   r   r   Útest05_removeAttributes  s6    



ÿÿz&CreateTestCase.test05_removeAttributesc                 C   s0  d| j j_d| j j_d| j j_| j | j d¡ | jr\tj	rBt
dƒ | jd| jd | jj| _| jj}tj	rzt
d|j ¡ ƒ |  |j ¡ d	d
g¡ tj	r¨t
d|j d¡ƒ |  |j d¡g d¢¡ | j | jd	d¡ tj	rèt
d|j ¡ ƒ |  |j ¡ d
g¡ tj	rt
d|j ¡ ƒ |  |j d¡g d¢¡ dS )z9Checking removing attributes (using File.del_node_attr())rc   rd   re   ri   r5   r6   r7   rf   rj   rk   rˆ   rp   r‰   r    rŠ   N)r+   rF   ri   rj   rk   r$   rK   r;   r   r<   r=   r>   r9   r%   r    r…   r?   r‹   r   r   r   Útest05b_removeAttributes7  s6    



ÿÿz'CreateTestCase.test05b_removeAttributesc                 C   sb   t jrtdƒ td| jjjƒ | jj`|  | jj d¡ddg¡ t jr^tdƒ td| jjjƒ dS )z$Checking removing system attributes.zBefore removing CLASS attributezSystem attrs:rl   rn   ro   zAfter removing CLASS attributeN)	r   r<   r=   r+   rF   Z_v_attrnamessysrm   r?   r…   r,   r   r   r   Útest06_removeAttributes^  s    ÿz&CreateTestCase.test06_removeAttributesc                 C   sÄ   d| j j_d| j j_d| j j_| j j dd¡ | jr\tjrBt	dƒ | j
d| jd | jj| _| jj}tjrzt	d	|j ¡ ƒ |  |j ¡ g d
¢¡ tjr¨t	d|j d¡ƒ |  |j d¡g d¢¡ dS )zChecking renaming attributes.rc   rd   re   ri   Úopr5   r6   r7   rf   )r   rj   rk   rˆ   rp   )rm   rn   ro   r   rj   rk   N)r+   rF   ri   rj   rk   Ú	_f_renamer;   r   r<   r=   r>   r9   r$   r%   r    r…   r?   r‹   r   r   r   Útest07_renameAttributesl  s$    



ÿz&CreateTestCase.test07_renameAttributesc                 C   sp   t jrtdƒ td| jjjƒ | jj dd¡ t jrLtdƒ td| jjjƒ | jj}|  	|j 
d¡g d¢¡ dS )	z$Checking renaming system attributes.zBefore renaming CLASS attributez
All attrs:rm   r   zAfter renaming CLASS attributerp   )rn   ro   r   N)r   r<   r=   r+   rF   Z_v_attrnamesr   r%   r    r?   r…   r‹   r   r   r   Útest08_renameAttributes‡  s    ÿz&CreateTestCase.test08_renameAttributesc                 C   sò   d| j j_d| j j_d| j j_d| j j_d| j j_g d¢| j j_| jrntjrTtdƒ | j	d| j
d	 | jj| _| jj}tjrŠtd
|jjƒ |  |jjd¡ |  |jjd¡ |  |jjg d¢¡ tjrÖtd|j d¡ƒ |  |j d¡g d¢¡ dS )z Checking overwriting attributes.rc   rd   re   Ú4é   )r   r”   é   r5   r6   r7   zValue of Attribute pq:rˆ   rp   rq   N)r+   rF   ri   rj   rk   r;   r   r<   r=   r>   r9   r$   r%   r    r?   r…   r‹   r   r   r   Útest09_overwriteAttributes˜  s,    





ÿz)CreateTestCase.test09_overwriteAttributesc                 C   sÆ   d| j j_d| j j_d| j j_| j j | jj¡ | jr^t	j
rDtdƒ | jd| jd | jj| _| jj}t	j
r|td|j ¡ ƒ |  |j ¡ g d¢¡ t	j
rªtd	|j d
¡ƒ |  |j d
¡g d¢¡ dS )zChecking copying attributes.rc   rd   re   r5   r6   r7   rf   rh   úComplete attribute list:rp   ©rm   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   rn   ro   ri   rj   rk   N)r+   rF   ri   rj   rk   Ú_f_copyr%   r   r;   r   r<   r=   r>   r9   r$   r…   r?   ©r-   r   r   r   r   Útest10a_copyAttributes·  s$    



ÿz%CreateTestCase.test10a_copyAttributesc                 C   sÈ   d| j j_d| j j_d| j j_| j | j | jj¡ | j	r`t
jrFtdƒ | jd| jd | jj| _| jj}t
jr~td|j ¡ ƒ |  |j ¡ g d¢¡ t
jr¬td	|j d
¡ƒ |  |j d
¡g d¢¡ dS )z-Checking copying attributes (copy_node_attrs)rc   rd   re   r5   r6   r7   rf   rh   r—   rp   r˜   N)r+   rF   ri   rj   rk   r$   Zcopy_node_attrsr%   r   r;   r   r<   r=   r>   r9   r…   r?   rš   r   r   r   Útest10b_copyAttributesÚ  s$    



ÿz%CreateTestCase.test10b_copyAttributesc                 C   s¢   d| j jd< d| j jd< | j | j | jd¡ | jrZtjr@tdƒ | j	d| j
d | jj| _| jj}tjrztd	|j d
¡ƒ |  |jd d¡ |  |jd d¡ dS )z0Checking copying attributes during group copies.ZGROUP2rm   ú1.3ro   Úagroup2r5   r6   r7   r—   rp   N)r+   rF   r$   Ú	copy_noder%   r;   r   r<   r=   r>   r9   rž   r…   r?   )r-   rž   r   r   r   Útest10c_copyAttributesý  s    
z%CreateTestCase.test10c_copyAttributesc                 C   s¤   | j j}d|jd< d|jd< | j || j d¡ | jr\tjrBtdƒ | j	d| j
d | jj | _ | j j}tjr|td	|j d
¡ƒ |  |jd d¡ |  |jd d¡ dS )z/Checking copying attributes during leaf copies.ZTABLE2rm   r   ro   Úatable2r5   r6   r7   r—   rp   N)r%   r   rF   r$   rŸ   r;   r   r<   r=   r>   r9   r¡   r…   r?   )r-   r   r¡   r   r   r   Útest10d_copyAttributes  s    


z%CreateTestCase.test10d_copyAttributesc                 C   s"   | j j}d|_|  |d d¡ dS )z#Checking the __getitem__ interface.rc   ri   N)r+   rF   ri   r?   ©r-   rG   r   r   r   Útest11a_getitem(  s    zCreateTestCase.test11a_getitemc                 C   s$   | j j}d|d< |  |d d¡ dS )z#Checking the __setitem__ interface.rd   ri   N)r+   rF   r?   r£   r   r   r   Útest11b_setitem/  s    zCreateTestCase.test11b_setitemc                 C   s(   | j j}d|_|d= |  d| ¡ ¡ dS )z#Checking the __delitem__ interface.rc   ri   N)r+   rF   ri   rE   r…   r£   r   r   r   Útest11c_delitem6  s    zCreateTestCase.test11c_delitemc                 C   s,   | j j}|  t|jd¡ |  t|jd¡ dS )z<Checking that KeyError is raised in __getitem__/__delitem__.ri   N)r+   rF   r]   ÚKeyErrorÚ__getitem__Ú__delitem__r£   r   r   r   Útest11d_KeyError>  s    zCreateTestCase.test11d_KeyErrorc                 C   s€   t  ddgddgg¡}|| jjd< |j ¡ | jjd< |j| jjd< t| jjd |ƒ t| jjd |jƒ t| jjd |jƒ dS )	z7Checking setting 2D and non-contiguous NumPy attributesr   r   r”   r•   r3   rs   rt   N)Únumpyr)   rG   ÚTÚcopyr   )r-   Údatar   r   r   Útest_2d_non_contiguousE  s    z%CreateTestCase.test_2d_non_contiguousr   r•   z2Special method `__dir__()` introduced in Python-3.c              	   C   s<  t jr tddƒ td| jj ƒ | jj}d}d}||fD ]}d||< q8d}d}||fD ]B}t ¡ & t 	d	t
j¡ d||< W d
  ƒ qV1 sŽ0    Y  qVt|ƒ}|  d|¡ |  d|¡ |  | d¡d¡ |  ||¡ |  ||¡ |  | |¡d¡ |  ||¡ |  ||¡ |  | |¡d¡ |  tt|ƒƒt|ƒ¡ d
S )zChecking AttributeSet.__dir__Ú
z<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=zRunning %s.test12_dir...Z	good_attrZBETTER_ATTRr   Z5badzSYS%rU   Nr/   r™   )r   r<   r=   r/   r   r+   rF   rX   rY   rZ   r[   r\   ÚdirZassertInr?   ÚcountrE   ZassertSequenceEqualÚsortedÚset)r-   ZattrsetZ	user_attrZsys_attrr3   Zbad_userZbad_sysZcompletionsr   r   r   Ú
test12_dir]  s6    


(ÿzCreateTestCase.test12_dir)rJ   )!r   r   r   r#   rB   rC   rI   rT   r`   ra   rb   r‡   rŒ   r   rŽ   r‘   r’   r–   r›   rœ   r    r¢   r¤   r¥   r¦   rª   r¯   r   ÚskipIfrl   Úversion_inforµ   Ú__classcell__r   r   r.   r   r      s4   
<D''##r   c                   @   s   e Zd ZdZeZeedZdS )ÚNotCloseCreateF©r9   N©r   r   r   r;   r   r9   ÚdictÚopen_kwargsr   r   r   r   r¹   Œ  s   r¹   c                   @   s   e Zd ZdZeZeedZdS )ÚCloseCreateTrº   Nr»   r   r   r   r   r¾   ’  s   r¾   c                   @   s   e Zd ZdZdZeedZdS )ÚNoCacheNotCloseCreateFr   rº   N©r   r   r   r;   r9   r¼   r½   r   r   r   r   r¿   ˜  s   r¿   c                   @   s   e Zd ZdZdZeedZdS )ÚNoCacheCloseCreateTr   rº   NrÀ   r   r   r   r   rÁ   ž  s   rÁ   c                   @   s    e Zd ZdZe ZeedZdS )ÚDictCacheNotCloseCreateFrº   Nr»   r   r   r   r   rÂ   ¤  s   rÂ   c                   @   s    e Zd ZdZe ZeedZdS )ÚDictCacheCloseCreateTrº   Nr»   r   r   r   r   rÃ   ª  s   rÃ   c                       s4  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&‡  Z'S )IÚTypesTestCasec                    sT   d| j i| _tt| ƒ ¡  | jj| _| j | jddgd¡| _| j 	| jdd¡| _
d S )NÚallow_paddingr   r   r   r    r!   )rÅ   r½   r"   rÄ   r#   r$   r%   r(   r)   r*   r+   r,   r.   r   r   r#   ²  s    
ÿÿzTypesTestCase.setUpc                 C   sÊ   d| j j_d| j j_d| j j_tjrTtd| j jjƒ td| j jjƒ td| j jjƒ | jrŠtjrhtdƒ | j	dd | j
j| _| j
jj| _ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d	S )
z6Checking setting Bool attributes (scalar, Python case)TFúpq -->úqr -->úrs -->r5   r6   ©r8   N©r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   r?   r,   r   r   r   Útest00a_setBoolAttributes¾  s     



z'TypesTestCase.test00a_setBoolAttributesc                 C   s  t  d¡| jj_t  d¡| jj_t  d¡| jj_tjrft	d| jjjƒ t	d| jjjƒ t	d| jjjƒ | j
rœtjrzt	dƒ | jdd | jj| _| jjj| _|  | jjjjt j¡ |  | jjjjt j¡ |  | jjjjt j¡ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d	S )
z5Checking setting Bool attributes (scalar, NumPy case)TFrÆ   rÇ   rÈ   r5   r6   rÉ   N)r«   Zbool_r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   ÚassertIsInstancer?   r,   r   r   r   Útest00b_setBoolAttributesÖ  s&    
z'TypesTestCase.test00b_setBoolAttributesc                 C   sÜ   t  d¡| jj_t  d¡| jj_t  d¡| jj_tjrftd| jjjƒ td| jjjƒ td| jjjƒ | j	rœtjrztdƒ | j
dd | jj| _| jjj| _|  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d	S )
z4Checking setting Bool attributes (NumPy, 0-dim case)TFrÆ   rÇ   rÈ   r5   r6   rÉ   N)r«   r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   r?   r,   r   r   r   Útest00c_setBoolAttributesñ  s     
z'TypesTestCase.test00c_setBoolAttributesc                 C   s  t  dg¡| jj_t  dgg¡| jj_t  ddgddgg¡| jj_tjrxtd| jjjƒ td| jjjƒ td| jjjƒ | j	r®tjrŒtdƒ | j
dd | jj| _| jjj| _t| jjjjt  dg¡ƒ t| jjjjt  dgg¡ƒ t| jjjjt  ddgddgg¡ƒ d	S )
z7Checking setting Bool attributes (NumPy, multidim case)TFrÆ   rÇ   rÈ   r5   r6   rÉ   N)r«   r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   r   r,   r   r   r   Útest00d_setBoolAttributes	  s$    
ÿz'TypesTestCase.test00d_setBoolAttributesc                 C   s  d| j j_d| j j_d| j j_tjrTtd| j jjƒ td| j jjƒ td| j jjƒ | jrŠtjrhtdƒ | j	dd	 | j
j| _| j
jj| _ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d
S )z5Checking setting Int attributes (scalar, Python case)r   r”   r•   rÆ   rÇ   rÈ   r5   r6   rÉ   N)r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   r«   Zint_r?   r,   r   r   r   Útest01a_setIntAttributes"  s&    



z&TypesTestCase.test01a_setIntAttributesc                 C   s´   g d¢}|D ]}t | jj|tjd|dƒ qtjrR|D ]}td|t| jj|ƒƒ q6| jrˆtjrftdƒ | j	dd | j
j| _| j
jj| _|D ]"}tt| jj|ƒtjd|dƒ qŒdS )	z4Checking setting Int attributes (scalar, NumPy case)©Zint8Zint16Zint32Zint64Zuint8Zuint16Zuint32r   ©Údtypeútype, value-->r5   r6   rÉ   N©rP   r)   rG   r«   r   r<   r=   rQ   r;   r>   r$   r%   r   r   ©r-   Ú
checktypesrÓ   r   r   r   Útest01b_setIntAttributes=  s$    ÿ
ÿz&TypesTestCase.test01b_setIntAttributesc                 C   s²   g d¢}|D ]"}t | jj|tjddg|dƒ q| jrftjrDtdƒ | jdd | j	j
| _
| j	j
j| _|D ]B}tjrŠtd|t| jj|ƒƒ tt| jj|ƒtjddg|dƒ qjd	S )
z;Checking setting Int attributes (unidimensional NumPy case)rÑ   r   r”   rÒ   r5   r6   rÉ   rÔ   N©rP   r)   rG   r«   r;   r   r<   r=   r>   r$   r%   r   rQ   r   rÖ   r   r   r   Útest01c_setIntAttributesX  s"     
ÿÿz&TypesTestCase.test01c_setIntAttributesc                 C   sÎ   g d¢}|D ]0}t jg d¢|dddd… }t| jj||ƒ q| jrttjrRtdƒ | jdd | j	j
| _
| j	j
j| _|D ]P}t jg d¢|dddd… }tjr´td	|t| jj|ƒƒ tt| jj|ƒ|ƒ qxdS )
z@Checking setting Int attributes (unidimensional, non-contiguous)rÑ   )r   r”   r•   r   rÒ   Nr”   r5   r6   rÉ   rÔ   )r«   r)   rP   rG   r;   r   r<   r=   r>   r$   r%   r   rQ   r   ©r-   r×   rÓ   Zarrr   r   r   Útest01d_setIntAttributesq  s"    
ÿz&TypesTestCase.test01d_setIntAttributesc                 C   sÂ   g d¢}|D ]*}t | jj|tjddgddgg|dƒ q| jrntjrLtdƒ | jdd | j	j
| _
| j	j
j| _|D ]J}tjr’td	|t| jj|ƒƒ tt| jj|ƒtjddgddgg|dƒ qrd
S )ú:Checking setting Int attributes (bidimensional NumPy case)rÑ   r   r”   r•   rÒ   r5   r6   rÉ   rÔ   NrÙ   rÖ   r   r   r   Útest01e_setIntAttributes‹  s&    
ÿ
ÿÿz&TypesTestCase.test01e_setIntAttributesc                 C   s  d| j j_d| j j_d| j j_tjrTtd| j jjƒ td| j jjƒ td| j jjƒ | jrŠtjrhtdƒ | j	dd	 | j
j| _| j
jj| _ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d
S )z+Checking setting Float (double) attributes.ç      ð?ç       @g      @rÆ   rÇ   rÈ   r5   r6   rÉ   N)r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   r«   Zfloat_r?   r,   r   r   r   Útest02a_setFloatAttributes¥  s&    



z(TypesTestCase.test02a_setFloatAttributesc                 C   sª   ddg}|D ]}t | jj|tjd|dƒ qtjrR|D ]}td|t| jj|ƒƒ q6| jrˆtjrftdƒ | j	dd | j
j| _| j
jj| _|D ]}tt| jj|ƒdƒ qŒd	S )
z6Checking setting Float attributes (scalar, NumPy case)Úfloat32Úfloat64çš™™™™™ñ?rÒ   rÔ   r5   r6   rÉ   N©rP   r)   rG   r«   r   r<   r=   rQ   r;   r>   r$   r%   r   r   rÖ   r   r   r   Útest02b_setFloatAttributesÁ  s$    
ÿÿ
z(TypesTestCase.test02b_setFloatAttributesc                 C   s¼   ddg}|D ]"}t | jj|tjddg|dƒ qtjrV|D ]}td|t| jj|ƒƒ q:| jrŒtjrjtdƒ | j	dd	 | j
j| _| j
jj| _|D ]&}tt| jj|ƒtjddg|dƒ qd
S )z=Checking setting Float attributes (unidimensional NumPy case)râ   rã   rä   çÍÌÌÌÌÌ @rÒ   rÔ   r5   r6   rÉ   NrÕ   rÖ   r   r   r   Útest02c_setFloatAttributesÜ  s(    
ÿÿ
ÿz(TypesTestCase.test02c_setFloatAttributesc                 C   sØ   ddg}|D ]0}t jg d¢|dddd… }t| jj||ƒ qtjrd|D ]}td|t| jj|ƒƒ qH| jrštjrxtd	ƒ | j	d
d | j
j| _| j
jj| _|D ]4}t jg d¢|dddd… }tt| jj|ƒ|ƒ qždS )zJChecking setting Float attributes (unidimensional,
        non-contiguous)râ   rã   )rä   rç   çÍÌÌÌÌÌ@gffffff@rÒ   r   Nr”   rÔ   r5   r6   rÉ   )r«   r)   rP   rG   r   r<   r=   rQ   r;   r>   r$   r%   r   r   rÛ   r   r   r   Útest02d_setFloatAttributesö  s$    ÿ
z(TypesTestCase.test02d_setFloatAttributesc                 C   sÌ   ddg}|D ]*}t | jj|tjddgddgg|dƒ qtjr^|D ]}td|t| jj|ƒƒ qB| jr”tjrrtdƒ | j	d	d
 | j
j| _| j
jj| _|D ].}tt| jj|ƒtjddgddgg|dƒ q˜dS )rÝ   râ   rã   rä   rç   ré   rÒ   rÔ   r5   r6   rÉ   NrÕ   rÖ   r   r   r   Útest02e_setFloatAttributes  s*    
ÿÿ
þz(TypesTestCase.test02e_setFloatAttributesc                 C   sÞ   ddg| j j_d| j j_dddœ| j j_tjr^td| j jjƒ td| j jjƒ td	| j jjƒ | jr”tjrrtd
ƒ | j	dd | j
j| _| j
jj| _ |  | jjjjddg¡ |  | jjjjd¡ |  | jjjjdddœ¡ dS )z#Checking setting Object attributes.rß   r”   ©r   r”   gÍÌÌÌÌ@@r   )ZddfZdsdrÆ   rÇ   rÈ   r5   r6   rÉ   NrÊ   r,   r   r   r   Útest03_setObjectAttributes,  s     

z(TypesTestCase.test03_setObjectAttributesc                 C   s  d| j j_d| j j_d| j j_tjrTtd| j jjƒ td| j jjƒ td| j jjƒ | jrŠtjrhtdƒ | j	dd	 | j
j| _| j
jj| _ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d
S )z0Checking setting string attributes (scalar case)ÚfooZbarÚbazrÆ   rÇ   rÈ   r5   r6   rÉ   N)r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   r«   Zstr_r?   r,   r   r   r   Útest04a_setStringAttributesE  s&    



z)TypesTestCase.test04a_setStringAttributesc                 C   s|   t  dg¡| jj_tjr(td| jjjƒ | jr^tjr<tdƒ | jdd | j	j
| _
| j	j
j| _t| j
jjjt  dg¡ƒ dS )z?Checking setting string attributes (unidimensional 1-elem case)rî   rÆ   r5   r6   rÉ   N©r«   r)   rG   ri   r   r<   r=   r;   r>   r$   r%   r   r   r,   r   r   r   Útest04b_setStringAttributes`  s    
z)TypesTestCase.test04b_setStringAttributesc                 C   s’   t  dg¡| jj_tjr(td| jjjƒ | jrttjr<tdƒ | jdd | j	j
| _
| j	j
j| _tjrttd| jjjƒ t| j
jjjt  dg¡ƒ dS )zMChecking setting string attributes (empty unidimensional
        1-elem case)rJ   rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest04c_setStringAttributesr  s    

ÿz)TypesTestCase.test04c_setStringAttributesc                 C   s€   t  ddg¡| jj_tjr*td| jjjƒ | jr`tjr>tdƒ | jdd | j	j
| _
| j	j
j| _t| j
jjjt  ddg¡ƒ dS )z?Checking setting string attributes (unidimensional 2-elem case)rî   Úbar3rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest04d_setStringAttributesˆ  s    
ÿz)TypesTestCase.test04d_setStringAttributesc                 C   s€   t  ddg¡| jj_tjr*td| jjjƒ | jr`tjr>tdƒ | jdd | j	j
| _
| j	j
j| _t| j
jjjt  ddg¡ƒ dS )zMChecking setting string attributes (empty unidimensional
        2-elem case)rJ   rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest04e_setStringAttributes›  s    
z)TypesTestCase.test04e_setStringAttributesc                 C   s   t  ddgddgg¡| jj_tjr2td| jjjƒ | jrhtjrFtdƒ | jdd | j	j
| _
| j	j
j| _t| j
jjjt  ddgddgg¡ƒ d	S )
z>Checking setting string attributes (bidimensional 4-elem case)rî   Úfoo2Úfoo3Zfoo4rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest04f_setStringAttributes®  s     
ÿ

ÿÿz)TypesTestCase.test04f_setStringAttributesc                 C   s  d| j j_d| j j_d| j j_tjrTtd| j jjƒ td| j jjƒ td| j jjƒ | jrŠtjrhtdƒ | j	dd	 | j
j| _| j
jj| _ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjtj¡ |  | jjjjd¡ |  | jjjjd¡ |  | jjjjd¡ d
S )z-Checking setting Complex (python) attributes.y      ð?       @y       @      @y      @      @rÆ   rÇ   rÈ   r5   r6   rÉ   N)r)   rG   ri   rj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   r«   Zcomplex_r?   r,   r   r   r   Útest05a_setComplexAttributesÃ  s&    



z*TypesTestCase.test05a_setComplexAttributesc                 C   sª   ddg}|D ]}t | jj|tjd|dƒ qtjrR|D ]}td|t| jj|ƒƒ q6| jrˆtjrftdƒ | j	dd | j
j| _| j
jj| _|D ]}tt| jj|ƒdƒ qŒd	S )
z8Checking setting Complex attributes (scalar, NumPy case)Ú	complex64Ú
complex128yš™™™™™ñ?       @rÒ   rÔ   r5   r6   rÉ   Nrå   rÖ   r   r   r   Útest05b_setComplexAttributesß  s$    
ÿÿ
z*TypesTestCase.test05b_setComplexAttributesc                 C   s¼   ddg}|D ]"}t | jj|tjddg|dƒ qtjrV|D ]}td|t| jj|ƒƒ q:| jrŒtjrjtdƒ | j	dd	 | j
j| _| j
jj| _|D ]&}tt| jj|ƒtjddg|dƒ qd
S )z?Checking setting Complex attributes (unidimensional NumPy case)rû   rü   rä   rç   rÒ   rÔ   r5   r6   rÉ   NrÕ   rÖ   r   r   r   Útest05c_setComplexAttributesú  s(    
ÿÿ
ÿz*TypesTestCase.test05c_setComplexAttributesc                 C   sÌ   ddg}|D ]*}t | jj|tjddgddgg|dƒ qtjr^|D ]}td|t| jj|ƒƒ qB| jr”tjrrtdƒ | j	d	d
 | j
j| _| j
jj| _|D ].}tt| jj|ƒtjddgddgg|dƒ q˜dS )rÝ   rû   rü   rä   rç   ré   rÒ   rÔ   r5   r6   rÉ   NrÕ   rÖ   r   r   r   Útest05d_setComplexAttributes  s*    
ÿÿ
þz*TypesTestCase.test05d_setComplexAttributesc                 C   s  d| j j_d| j j_d| j j_tjrbtjdkrBt	dt
| j jjƒƒ t	d| j jjƒ t	d| j jjƒ | jr˜tjrvt	dƒ | jd	d
 | jj| _| jjj| _ |  | j jjtj¡ |  | j jjtj¡ |  | j jjtj¡ |  | j jjd¡ |  | j jjd¡ |  | j jjd¡ dS )z1Checking setting unicode attributes (scalar case)õ	   paraÅ€lelrJ   rï   Zwin32rÆ   rÇ   rÈ   r5   r6   rÉ   N)r)   rG   ri   rj   rk   r   r<   rl   Úplatformr=   Úreprr;   r>   r$   r%   r   rÌ   r«   Zunicode_r?   r,   r   r   r   Útest06a_setUnicodeAttributes/  s(    




z*TypesTestCase.test06a_setUnicodeAttributesc                 C   sz   t  dg¡| jj_tjr(td| jjjƒ | jr^tjr<tdƒ | jdd | j	j
| _
| j	j
j| _t| jjjt  dg¡ƒ dS )z@Checking setting unicode attributes (unidimensional 1-elem case)r   rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest06b_setUnicodeAttributesN  s    


ÿz*TypesTestCase.test06b_setUnicodeAttributesc                 C   sœ   t jdgdd| jj_tjr,td| jjjƒ | jr|tjr@tdƒ | jdd | j	j
| _
| j	j
j| _tjr|tdt| jjjƒƒ t| jjjt jdgddƒ dS )	zNChecking setting unicode attributes (empty unidimensional
        1-elem case)rJ   ÚU1rÒ   rÆ   r5   r6   rÉ   N)r«   r)   rG   ri   r   r<   r=   r;   r>   r$   r%   r   r  r   r,   r   r   r   Útest06c_setUnicodeAttributesa  s    

ÿz*TypesTestCase.test06c_setUnicodeAttributesc                 C   s~   t  ddg¡| jj_tjr*td| jjjƒ | jr`tjr>tdƒ | jdd | j	j
| _
| j	j
j| _t| jjjt  ddg¡ƒ dS )z@Checking setting unicode attributes (unidimensional 2-elem case)r   rô   rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest06d_setUnicodeAttributesz  s    

ÿz*TypesTestCase.test06d_setUnicodeAttributesc                 C   s†   t jddgdd| jj_tjr.td| jjjƒ | jrdtjrBtdƒ | jdd | j	j
| _
| j	j
j| _t| jjjt jddgddƒ dS )	zNChecking setting unicode attributes (empty unidimensional
        2-elem case)rJ   r  rÒ   rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest06e_setUnicodeAttributes  s    

ÿz*TypesTestCase.test06e_setUnicodeAttributesc                 C   sŽ   t  ddgddgg¡| jj_tjr2td| jjjƒ | jrhtjrFtdƒ | jdd | j	j
| _
| j	j
j| _t| jjjt  ddgddgg¡ƒ d	S )
z?Checking setting unicode attributes (bidimensional 4-elem case)r   r÷   rø   u
   paraÅ€lel4rÆ   r5   r6   rÉ   Nrñ   r,   r   r   r   Útest06f_setUnicodeAttributes¡  s     
ÿ


ÿÿz*TypesTestCase.test06f_setUnicodeAttributesc                 C   s>  t jd| jd}t  d|¡| jj_t  d|¡| jj_t  dg|¡| jj_	t
jr~td| jjjƒ td| jjjƒ td| jjj	ƒ | jr´t
jr’td	ƒ | jd
d | jj| _| jjj| _|  | jjjt j¡ |  | jjjt j¡ |  | jjj	t j¡ t| jjjt  d|¡ƒ t| jjjt  d|¡ƒ t| jjj	t  dg|¡ƒ dS )z-Checking setting RecArray (NumPy) attributes.úi4,f8©Zalignr”   ©r”   r”   ©r   rà   rÆ   rÇ   rÈ   r5   r6   rÉ   N©r«   rÓ   ÚalignedÚzerosr)   rG   ri   Úonesrj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   Úndarrayr   ©r-   Zdtr   r   r   Útest07a_setRecArrayAttributes¶  s(    
z+TypesTestCase.test07a_setRecArrayAttributesc                 C   sB  t  dddgfg¡}t  d|¡| jj_t  d|¡| jj_t  dg|¡| jj_t	j
r‚td| jjjƒ td| jjjƒ td	| jjjƒ | jr¸t	j
r–td
ƒ | jdd | jj| _| jjj| _|  | jjjt j¡ |  | jjjt j¡ |  | jjjt j¡ t| jjjt  d|¡ƒ t| jjjt  d|¡ƒ t| jjjt  dg|¡ƒ dS )z4Checking setting nested RecArray (NumPy) attributes.Úf1)r  Úi2©Úf2Zf8r”   r  )r  rÆ   rÇ   rÈ   r5   r6   rÉ   )rì   N©r«   rÓ   r  r)   rG   ri   r  rj   rk   r   r<   r=   r;   r>   r$   r%   r   rÌ   r  r   r  r   r   r   Útest07b_setRecArrayAttributesÓ  s(    
z+TypesTestCase.test07b_setRecArrayAttributesc                 C   sZ  t jdddgfgdd}t  d|¡| jj_t  d|¡| jj_t  dd	gd
ffg|¡| jj_t	j
rtd| jjjƒ td| jjjƒ td| jjjƒ | jrÆt	j
r¤tdƒ | jdd | jj| _| jjj| _|  | jjjt j¡ |  | jjjt j¡ |  | jjjt j¡ t| jjjt  d|¡ƒ t| jjjt  d|¡ƒ t| jjjt  dd	gdffg|¡ƒ dS )z=Checking setting multidim nested RecArray (NumPy) attributes.r  )r  r  )r”   r  Tr  r”   r  r   r•   rà   rÆ   rÇ   rÈ   r5   r6   rÉ   Nr  r  r   r   r   Útest07c_setRecArrayAttributesñ  s,    
ÿz+TypesTestCase.test07c_setRecArrayAttributesc                 C   s@  t jd| jd}t  d|¡| jj_t  d|¡| jj_t  dg|¡| jj_	t
jr~td| jjjƒ td| jjjƒ td| jjj	ƒ | jr¶t
jr’td	ƒ | jd
dd | jj| _| jjj| _|  | jjjt j¡ |  | jjjt j¡ |  | jjj	t j¡ t| jjjt  d|¡ƒ t| jjjt  d|¡ƒ t| jjj	t  dg|¡ƒ dS )ziChecking setting aligned RecArray (NumPy) attributes with `allow_aligned` param set to False when reopen.r
  r  r”   r  r  rÆ   rÇ   rÈ   r5   r6   F)r8   Zallow_alignNr  r  r   r   r   Ú!test08_setRecArrayNotAllowPadding  s(    
z/TypesTestCase.test08_setRecArrayNotAllowPadding)(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Ä   °  sH    rÄ   c                   @   s   e Zd ZdZdZdZdS )ÚNotCloseTypesTestCaseFN©r   r   r   rÅ   r  r;   r   r   r   r   r  /  s   r  c                   @   s   e Zd ZdZdZdZdS )ÚNoCloseAlignedTypesTestCaseTFNr  r   r   r   r   r  5  s   r  c                   @   s   e Zd ZdZdZdZdS )Ú"CloseNotAlignedPaddedTypesTestCaseFTNr  r   r   r   r   r   ;  s   r   c                   @   s   e Zd ZdZdZdZdS )ÚCloseTypesTestCaseTFNr  r   r   r   r   r!  A  s   r!  c                   @   s   e Zd ZdZdZdZdS )ÚCloseAlignedTypesTestCaseFTNr  r   r   r   r   r"  G  s   r"  c                   @   s   e Zd ZdZdZdZdS )ÚCloseAlignedPaddedTypesTestCaseTNr  r   r   r   r   r#  L  s   r#  c                       s.   e Zd ZeddZ‡ fdd„Zdd„ Z‡  ZS )ÚNoSysAttrsTestCaseF)Zpytables_sys_attrsc                    s^   t t| ƒ ¡  | jj| _| j | jdtd¡| _| j | jddgd¡| _	| j 
| jdd¡| _d S r   )r"   r$  r#   r$   r%   r&   r   r'   r(   r)   r*   r+   r,   r.   r   r   r#   U  s    
ÿÿÿzNoSysAttrsTestCase.setUpc                 C   s°  d| j j_d| j j_d| j j_tjr6td| j j ¡ ƒ d| j	j
_d| j	j
_d| j	j
_tjrltd| j	j
 ¡ ƒ d| jj
_d| jj
_d| jj
_tjr¢td| jj
 ¡ ƒ | jrÌtjr¶tdƒ | jdd | jj| _| jj}|  |j d¡g d	¢¡ |  |j d
¡g ¡ |  |j d¡g d	¢¡ | jj}|  |j
 ¡ g d¢¡ |  |j
 d
¡g ¡ |  |j
 d¡g d¢¡ | jj}|  |j
 ¡ g d¢¡ |  |j
 d
¡g ¡ |  |j
 d¡g d¢¡ dS )z6Checking listing attributes (no system attrs version).rc   rd   re   rf   r5   r6   rÉ   rg   rh   rl   rp   rr   r€   N)r+   rF   ri   rj   rk   r   r<   r=   r…   r'   rG   r3   rt   rs   r)   rƒ   r‚   r   r;   r>   r$   r%   r    r?   r   r   r†   r   r   r   Útest00_listAttributesc  s@    









z(NoSysAttrsTestCase.test00_listAttributes)r   r   r   r¼   r½   r#   r%  r¸   r   r   r.   r   r$  R  s   
r$  c                   @   s   e Zd ZdZdS )ÚNoSysAttrsNotCloseFN©r   r   r   r;   r   r   r   r   r&  ‘  s   r&  c                   @   s   e Zd ZdZdS )ÚNoSysAttrsCloseTNr'  r   r   r   r   r(  •  s   r(  c                   @   s2   e Zd ZedƒZe eej	ƒdk d¡dd„ ƒZ
dS )ÚCompatibilityTestCasezissue_368.h5z1.9.0zrequires numpy >= 1.9c                 C   s   |   | j dd¡d¡ d S )Nú/Zpy2_pickled_unicodeÚabc)r?   r$   r@   r,   r   r   r   Útest_pickled_unicode_attrsœ  s    ÿz0CompatibilityTestCase.test_pickled_unicode_attrsN)r   r   r   r   Úh5fnamer   r¶   r   r«   Ú__version__r,  r   r   r   r   r)  ™  s
   ÿr)  c                   @   s@   e Zd ZedƒZe ejd dko.ejd dk d¡dd„ ƒZ	d	S )
ÚPicklePy2UnpicklePy3TestCasezissue_560.h5r   r•   r   r   zbug not fixed on python3<=3.3.c                 C   sF   |   | j dd¡tj¡ | j dd¡}|   |t¡ |  |d d¡ d S )Nr*  Zpy2_pickled_datetimeZpy2_pickled_dictÚszjust a string)rÌ   r$   r@   Údatetimer¼   r?   )r-   Údr   r   r   Útest_pickled_datetime_object´  s    þz9PicklePy2UnpicklePy3TestCase.test_pickled_datetime_objectN)
r   r   r   r   r-  r   r¶   rl   r·   r3  r   r   r   r   r/  ±  s
   ÿr/  c                   @   s   e Zd Zdd„ ZdS )ÚSegFaultPythonTestCasec                 C   s‚   d| j jj_|  | j jjjd¡ d| j jj_|  | j jjjd¡ |  ¡  |  | j jjjd¡ |  | j jjjd¡ tjr~t	dƒ dS )z;Checking workaround for Python unpickle problem (see #253).Ú0z0.z3Great! '0' and '0.' values can be safely retrieved.N)
r$   r%   rF   Ztrouble1r?   Ztrouble2r>   r   r<   r=   r,   r   r   r   Útest00_segfaultÍ  s    z&SegFaultPythonTestCase.test00_segfaultN)r   r   r   r6  r   r   r   r   r4  Ë  s   r4  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚEmbeddedNullsTestCasec                 C   sD   d}|| j jj_|  | j jjj|¡ |  ¡  |  | j jjj|¡ d S )Nzstring with a null byte   in it©r$   r%   rF   rH   r?   r>   ©r-   Úvaluer   r   r   Útest_unicodeß  s
    z"EmbeddedNullsTestCase.test_unicodec                 C   sD   d}|| j jj_|  | j jjj|¡ |  ¡  |  | j jjj|¡ d S )Ns   string with a null byte   in itr8  r9  r   r   r   Ú
test_bytesé  s
    z EmbeddedNullsTestCase.test_bytesN)r   r   r   r;  r<  r   r   r   r   r7  Ü  s   
r7  c                       s@   e Zd Z‡ fdd„Z‡ fdd„Zdd„ Zdd„ Zd	d
„ Z‡  ZS )ÚVlenStrAttrTestCasec                    s*   t t| ƒ ¡  tdƒ| _t | j¡| _d S )Nzvlstr_attr.h5)r"   r=  r#   r   r-  r[   Z	open_filer$   r,   r.   r   r   r#   õ  s    
zVlenStrAttrTestCase.setUpc                    s   | j  ¡  tt| ƒ ¡  d S rD   )r$   r;   r"   r=  ÚtearDownr,   r.   r   r   r>  ú  s    
zVlenStrAttrTestCase.tearDownc                 C   s$   d}|   | j d|¡| d¡¡ dS )z5Checking file with variable length string attributes.Zvlen_str_scalarr*  ÚasciiN)r?   r$   r@   Úencode)r-   Úattrr   r   r   Útest01_vlen_str_scalarþ  s    ÿz*VlenStrAttrTestCase.test01_vlen_str_scalarc                 C   sT   d}| j  d|¡}|  |jd¡ t|ƒD ]&\}}d||f }|  || d¡¡ q(dS )z:Checking file with variable length string attributes (1d).Zvlen_str_arrayr*  r   z%s_%dr?  N©r$   r@   r?   ÚndimÚ	enumerater@  )r-   rA  ÚvÚidxÚitemr:  r   r   r   Útest02_vlen_str_array  s    z)VlenStrAttrTestCase.test02_vlen_str_arrayc                 C   sh   d}| j  d|¡}|  |jd¡ t|ƒD ]:\}}t|ƒD ](\}}d|||f }|  || d¡¡ q8q(dS )z:Checking file with variable length string attributes (2d).Zvlen_str_matrixr*  r”   z%s_%d%dr?  NrC  )r-   rA  ÚmÚrowZrowdataÚcolrH  r:  r   r   r   Útest03_vlen_str_matrix  s    z*VlenStrAttrTestCase.test03_vlen_str_matrix)	r   r   r   r#   r>  rB  rI  rM  r¸   r   r   r.   r   r=  ô  s
   
r=  c                   @   s   e Zd ZedƒZdd„ ZdS )ÚUnsupportedAttrTypeTestCasezattr-u16.h5c                 C   s   |   tt| j¡ dS )z$Checking file with unsupported type.N)ZassertWarnsr   r  r$   r,   r   r   r   Útest00_unsupportedType  s    z2UnsupportedAttrTypeTestCase.test00_unsupportedTypeN)r   r   r   r   r-  rO  r   r   r   r   rN    s   rN  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚSpecificAttrsTestCasec                 C   s<   | j  ddtƒ d¡}tjr(td|jjƒ |  |jjd¡ dS )z'Testing EArray specific attrs (create).r*  Úea)r”   r   r   ú	EXTDIM-->r   N)	r$   Úcreate_earrayr   r   r<   r=   rG   ÚEXTDIMr?   ©r-   rQ  r   r   r   Útest00_earray'  s    z#SpecificAttrsTestCase.test00_earrayc                 C   sP   | j  ddtƒ d¡}|  d¡ | j jj}tjr<td|j	j
ƒ |  |j	j
d¡ dS )z%Testing EArray specific attrs (open).r*  rQ  )r   r   r   ÚrrR  r   N)r$   rS  r   r>   r%   rQ  r   r<   r=   rG   rT  r?   rU  r   r   r   Útest01_earray/  s    

z#SpecificAttrsTestCase.test01_earrayN)r   r   r   rV  rX  r   r   r   r   rP  %  s   rP  c                  C   sp  t  ¡ } d}t|ƒD ]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  t¡¡ |  t  t¡¡ |  t  t¡¡ q| S )Nr   )r   Z	TestSuiteÚrangeZaddTestZ	makeSuiter¹   r¾   r¿   rÁ   rÂ   rÃ   r  r!  r   r  r"  r#  r&  r(  r)  r/  r4  r7  r=  rN  rP  )ZtheSuiteZniterr   r   r   r   Úsuite:  s2    rZ  Ú__main__)ZdefaultTest)>Ú__doc__rl   r1  rX   Zdistutils.versionr   r«   Znumpy.testingr   r   r[   r   r   r   r   r	   r
   r   Ztables.exceptionsr   Ztables.parametersr   Ztables.testsr   Ztables.tests.commonr   r   r   ZTestCaser   ZTempFileMixinr   r¹   r¾   r¿   rÁ   rÂ   rÃ   rÄ   r  r  r   r!  r"  r#  r$  r&  r(  ZTestFileMixinr)  r/  r4  r7  r=  rN  rP  rZ  r   Z
parse_argvÚargvZprint_versionsÚmainr   r   r   r   Ú<module>   sl   $    q       ?'

