
    d                    t   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Z	ddl
mZ  G d de	j                  Z G d dej        ej                  Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d dej        ej                  Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$ej        ej                  Z G d% d&e          Z G d' d(e          Z  G d) d*ej!        ej                  Z" G d+ d,ej!        ej                  Z# G d- d.ej        ej                  Z$ G d/ d0ej        ej                  Z% G d1 d2ej                  Z& G d3 d4ej!        ej                  Z' G d5 d6ej        ej                  Z(d7 Z)e*d8k    rA ej+        ej,                    ej-                     ej.        /                    d9:           dS dS );zIThis test unit checks node attributes that are persistent (AttributeSet).    N)Version)commonc                       e Zd Z ej        d          Z ej                    Z ej                    Z	 ej
                    Z ej                    ZdS )Record   )itemsizeN)__name__
__module____qualname__tb	StringColvar1IntColvar2Int16Colvar3FloatColvar4
Float32Colvar5     <lib/python3.11/site-packages/tables/tests/test_attributes.pyr   r      sV        2<###D29;;D2;==D2;==D2=??DDDr   r   c                        e Zd Z fdZd Zd Zd ZddZd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )CreateTestCasec                 ^   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supersetUph5filerootcreate_tabler   tablecreate_arrayarraycreate_groupgroupself	__class__s    r   r&   zCreateTestCase.setUp       K$	 [--di.4mE E
 [--di/0c=B B
 [--di.;= =


r   c                    d}| j                             | j        j        dd|z             | j                             | j        j        dd|z             | j                             | j        j        dd|z             | j        rHt          j        rt          d           | 
                    d| j                   | j         j        | _        |                     | j                             | j        j        d          d|z             |                     | j                             | j        j        d          d|z             |                     | j                             | j        j        d          d|z             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_reopenr=   assertEqualget_node_attrr0   
attrlengths     r   test01_setAttributesz#CreateTestCase.test01_setAttributes%   sv    
!!$)"2GS:=MNNN 	!!$)"2GS:=MNNN 	!!$)"3WcJ>NOOO: 	)~ 0.///LLdT5JLKKK(DI22493CWMMz)	+ 	+ 	+22493CWMMz)	+ 	+ 	+22493DgNNz)	+ 	+ 	+ 	+ 	+r   c                     | j         rJt          j        rt          d           |                     d| j                   | j        j        | _        d S d S )Nr9   r:   r;   )r?   r   r@   rA   rB   r=   r'   r(   r0   s    r   reopenzCreateTestCase.reopen?   sX    : 	)~ 0.///LLdT5JLKKK(DIII		) 	)r   c                    |                                   |                     || j        j        j                   |                     || j        j        j                   |                     || j        j        j                   d S N)rJ   assertNotInr(   r"   _v_attrsr   attrsr   )r0   names     r   check_missingzCreateTestCase.check_missingG   so    ty/8999ty/5666ty0677777r    c                    |                      |           | 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)rQ   r'   r>   r(   r"   r   r   rJ   rC   rD   del_node_attr
_f_setattrset_attr
_f_getattrget_attr
_f_delattrdel_attrsetattrrN   rO   getattrdelattr)r0   rP   vals      r   
check_namezCreateTestCase.check_nameM   s   4   !!$)"2D#>>>!!$)"2D#>>>!!$)"3T3???22493CTJJ	 	 	22493CTJJ	 	 	22493DdKK	 	 	 	!!$)"2D999!!$)"2D999!!$)"3T:::4    		##D#...	!!$,,,	""4---)44T::C@@@)22488#>>>*33D993???	##D)))	!!$'''	""4(((4    		 )4555	 &c222	!'s333!1!:DAA3GGG!1!7>>DDD!2!8$??EEE	 )4000	 &---	!'...4    +.	!$''*	t$(+	%)248#>>>)/5s;;;*06<<<I%d+I"4(I#D)4     r   c                    t          j                    5  t          j        dt          j                   |                     d           |                     d           |                     d           |                     d           ddd           n# 1 swxY w Y   |                     t          | j        d           |                     t          | j        d           |                     t          | j        d	           dS )
z!Checking attribute names validityignorer7   za:bz/a/b.NrR   __members__r   )	warningscatch_warningssimplefilterr   NaturalNameWarningr_   assertRaises
ValueError	TypeErrorrI   s    r   test01a_setAttributesz$CreateTestCase.test01a_setAttributes   s   $&& 	! 	!!(B,ABBBOOC   OOE"""OOF###OOC   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	*dor:::*do}EEE)T_a88888s   A4BBBc                    d}| j         j                            dd|z             | j         j                            dd|z             | j         j                            dd|z             | j        rHt          j        rt          d           | 
                    d| j                   | j        j         | _         |                     | j         j                            d          d|z             |                     | j         j                            d          d|z             |                     | j         j                            d          d|z             d	S )
z7Checking setting large string attributes (Node methods)r4   r5   r6   r7   r8   r9   r:   r;   N)r(   r"   rU   r   rV   r   r?   r   r@   rA   rB   r=   r'   rC   rW   rX   rE   s     r   test02_setAttributesz#CreateTestCase.test02_setAttributes   sO    
	##GS:-=>>>	!!'3+;<<< 		""7C*,<===: 	)~ 0.///LLdT5JLKKK(DI)44 J&	( 	( 	()227;;S:=MNNN*33G<<cJ>NOOOOOr   c                 .   d}d|z  | j         j        _        d|z  | j        j        _        d|z  | j        j        _        | j        rHt          j        rt          d           | 
                    d| j                   | j        j        | _        |                     | j        j        j        j        d|z             |                     | j        j        j        j        d|z             |                     | j        j        j        j        d|z             dS )	z?Checking setting large string attributes (AttributeSet methods)r4   r6   r7   r8   r9   r:   r;   N)r.   rN   r5   r*   rO   r,   r?   r   r@   rA   rB   r=   r'   r(   rC   r"   r   r   rE   s     r   test03_setAttributesz#CreateTestCase.test03_setAttributes   s    
$'*$4
!!$z!1
!$z!1
: 	)~ 0.///LLdT5JLKKK(DI 	)28#
:JKKK)/5sZ7GHHH*06j8HIIIIIr   c                    d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r,t          d| j         j                                                   d| j	        j
        _        d| j	        j
        _        d| j	        j
        _        t
          j        r,t          d| j	        j
                                                   d| j        j
        _        d| j        j
        _        d| j        j
        _        t
          j        r,t          d| j        j
                                                   | j        rHt
          j        rt          d           |                     d| j                   | 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:r9   r:   r;   userpqqrrssys)CLASSTITLEVERSIONallr{   r|   r}   rw   rx   ry   r7   bc)r{   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NROWSr|   r}   )r{   r   r   r   r   r   r   r   r   r   r   r   r|   r}   r7   r   r   ijk)r{   FLAVORr|   r}   )r{   r   r|   r}   r   r   r   N)r.   rN   rw   rx   ry   r   r@   rA   _f_listr*   rO   r7   r   r   r,   r   r   r   r?   rB   r=   r'   r(   r"   rC   r   r   r0   r"   r   r   s       r   test04_listAttributesz$CreateTestCase.test04_listAttributes   sA    "%
!$
!$
> 	D#TZ%8%@%@%B%BCCC !
 
 
> 	A#TZ%5%=%=%?%?@@@ !
 
 
> 	A#TZ%5%=%=%?%?@@@: 	)~ 0.///LLdT5JLKKK(DI!0088:L:L:LMMM0077666	8 	8 	80077HHH	J 	J 	J !--//AAA--e44. . .	/ 	/ 	/ 	--e44) ) )		* 		* 		* )#..00///BBBM!!%((333	5 	5 	5 	M!!%((BBB	D 	D 	D 	D 	Dr   c                 \   d| j         j        _        d| j         j        _        d| j         j        _        | j         j        `| j        rHt          j        rt          d           | 	                    d| j
                   | j        j        | _        | j        j        }t          j        r't          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.rq   rr   rs   r9   r:   r;   rt   rx   ry   Attribute list in disk:r~   r{   r|   r}   rx   ry   r{   r|   r}   ry   N)r.   rN   rw   rx   ry   r?   r   r@   rA   rB   r=   r'   r(   r"   r   rC   r0   r"   s     r   test05_removeAttributesz&CreateTestCase.test05_removeAttributes	  s    "%
!$
!$
J": 	)~ 0.///LLdT5JLKKK(DI!> 	@#V_%<%<%>%>???0022T4LAAA> 	M+V_-D-DU-K-KLLL0077BBB	D 	D 	D O> 	@#V_%<%<%>%>???0022TF;;;> 	H+V_-D-D-F-FGGG0077<<<	> 	> 	> 	> 	>r   c                    d| j         j        _        d| j         j        _        d| j         j        _        | j                            | j         d           | j        rHt          j	        rt          d           |                     d| j                   | j        j        | _        | j        j        }t          j	        r't          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())rq   rr   rs   rw   r9   r:   r;   rt   rx   ry   r   r~   r   r"   r   N)r.   rN   rw   rx   ry   r'   rT   r?   r   r@   rA   rB   r=   r(   r"   r   rC   r   s     r   test05b_removeAttributesz'CreateTestCase.test05b_removeAttributes0  s     "%
!$
!$
!!$*d333: 	)~ 0.///LLdT5JLKKK(DI!> 	@#V_%<%<%>%>???0022T4LAAA> 	M+V_-D-DU-K-KLLL0077BBB	D 	D 	D 	!!$)T8<<<> 	@#V_%<%<%>%>???0022TF;;;> 	H+V_-D-D-F-FGGG0077<<<	> 	> 	> 	> 	>r   c                 t   t           j        r.t          d           t          d| j        j        j                   | j        j        `|                     | j        j                            d          ddg           t           j        r0t          d           t          d| j        j        j                   dS dS )z$Checking removing system attributes.zBefore removing CLASS attributezSystem attrs:rz   r|   r}   zAfter removing CLASS attributeN)	r   r@   rA   r.   rN   _v_attrnamessysr{   rC   r   rI   s    r   test06_removeAttributesz&CreateTestCase.test06_removeAttributesW  s     > 	H3444/4:#6#FGGGJ%,44U;;!9-	/ 	/ 	/> 	H2333/4:#6#FGGGGG	H 	Hr   c                    d| j         j        _        d| j         j        _        d| j         j        _        | j         j                            dd           | j        rHt          j        rt          d           | 
                    d| j                   | 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 renaming attributes.rq   rr   rs   rw   opr9   r:   r;   rt   )r   rx   ry   r   r~   )r{   r|   r}   r   rx   ry   N)r.   rN   rw   rx   ry   	_f_renamer?   r   r@   rA   rB   r=   r'   r(   r"   r   rC   r   s     r   test07_renameAttributesz&CreateTestCase.test07_renameAttributese  s[    "%
!$
!$

%%dD111: 	)~ 0.///LLdT5JLKKK(DI!> 	@#V_%<%<%>%>???00224F4F4FGGG> 	M+V_-D-DU-K-KLLL0077HHH	J 	J 	J 	J 	Jr   c                    t           j        r.t          d           t          d| j        j        j                   | j        j                            dd           t           j        r.t          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:r{   r   zAfter renaming CLASS attributer~   )r|   r}   r   N)r   r@   rA   r.   rN   _v_attrnamesr   r(   r"   rC   r   r   s     r   test08_renameAttributesz&CreateTestCase.test08_renameAttributes  s     > 	B3444,
 3 @AAA
%%gt444> 	B2333,
 3 @AAA !0077333	5 	5 	5 	5 	5r   c                 d   d| j         j        _        d| j         j        _        d| j         j        _        d| j         j        _        d| j         j        _        g d| j         j        _        | j        rHt          j        rt          d           | 	                    d| j
        	           | 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.rq   rr   rs   4   )r    r      r9   r:   r;   zValue of Attribute pq:r   r~   r   N)r.   rN   rw   rx   ry   r?   r   r@   rA   rB   r=   r'   r(   r"   rC   r   r   s     r   test09_overwriteAttributesz)CreateTestCase.test09_overwriteAttributes  s    "%
!$
!$
!$
!"
!*
: 	)~ 0.///LLdT5JLKKK(DI!> 	@*FO,>???+S111+Q///+YYY777> 	M+V_-D-DU-K-KLLL0077HHH	J 	J 	J 	J 	Jr   c                     d| j         j        _        d| j         j        _        d| j         j        _        | j         j                            | j        j                   | j        rHt          j
        rt          d           |                     d| j                   | 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.rq   rr   rs   r9   r:   r;   rt   rv   Complete attribute list:r~   r{   r   r   r   r   r   r   r   r   r   r   r   r|   r}   rw   rx   ry   N)r.   rN   rw   rx   ry   _f_copyr(   r   r?   r   r@   rA   rB   r=   r'   r   rC   r0   r   s     r   test10a_copyAttributesz%CreateTestCase.test10a_copyAttributes  s_    "%
!$
!$

##DI$4555: 	)~ 0.///LLdT5JLKKK(DI!> 	@#V_%<%<%>%>???00224F4F4FGGG> 	N,fo.E.Ee.L.LMMM0077, , ,		- 		- 		- 		- 		-r   c                    d| j         j        _        d| j         j        _        d| j         j        _        | j                            | j         | j        j                   | j	        rHt          j        rt          d           |                     d| j                   | 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)rq   rr   rs   r9   r:   r;   rt   rv   r   r~   r   N)r.   rN   rw   rx   ry   r'   copy_node_attrsr(   r   r?   r   r@   rA   rB   r=   r   rC   r   s     r   test10b_copyAttributesz%CreateTestCase.test10b_copyAttributes  s`    "%
!$
!$
##DJ	0@AAA: 	)~ 0.///LLdT5JLKKK(DI!> 	@#V_%<%<%>%>???00224F4F4FGGG> 	N,fo.E.Ee.L.LMMM0077, , ,		- 		- 		- 		- 		-r   c                 0   d| j         j        d<   d| j         j        d<   | j                            | j         | j        d           | j        rHt          j        rt          d           | 	                    d| j
                   | j        j        | _        | j        j        }t          j        r(t          d	|j                            d
                     |                     |j        d         d           |                     |j        d         d           dS )z0Checking copying attributes during group copies.GROUP2r{   1.3r}   agroup2r9   r:   r;   r   r~   N)r.   rN   r'   	copy_noder(   r?   r   r@   rA   rB   r=   r   r   rC   )r0   r   s     r   test10c_copyAttributesz%CreateTestCase.test10c_copyAttributes  s    (0
G$).
I&dj$)Y???: 	)~ 0.///LLdT5JLKKK(DI)#> 	O,g.>.F.Fu.M.MNNN)'2H===))4e<<<<<r   c                 *   | j         j        }d|j        d<   d|j        d<   | j                            || j         d           | j        rHt          j        rt          d           | 	                    d| j
                   | 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.TABLE2r{   r   r}   atable2r9   r:   r;   r   r~   N)r(   r   rN   r'   r   r?   r   r@   rA   rB   r=   r   r   rC   )r0   r   r   s      r   test10d_copyAttributesz%CreateTestCase.test10d_copyAttributes  s    !#+ %*	"fdi;;;: 	)~ 0.///LLdT5JLKKK(DI)#> 	O,g.>.F.Fu.M.MNNN)'2H===))4e<<<<<r   c                 d    | j         j        }d|_        |                     |d         d           dS )z#Checking the __getitem__ interface.rq   rw   N)r.   rN   rw   rC   r0   rO   s     r   test11a_getitemzCreateTestCase.test11a_getitem!  s5     
#tc*****r   c                 `    | j         j        }d|d<   |                     |d         d           dS )z#Checking the __setitem__ interface.rr   rw   N)r.   rN   rC   r   s     r   test11b_setitemzCreateTestCase.test11b_setitem(  s7     
#dtc*****r   c                     | j         j        }d|_        |d= |                     d|                                           dS )z#Checking the __delitem__ interface.rq   rw   N)r.   rN   rw   rM   r   r   s     r   test11c_delitemzCreateTestCase.test11c_delitem/  s@     
#$Ku}}/////r   c                     | j         j        }|                     t          |j        d           |                     t          |j        d           dS )z<Checking that KeyError is raised in __getitem__/__delitem__.rw   N)r.   rN   rh   KeyError__getitem____delitem__r   s     r   test11d_KeyErrorzCreateTestCase.test11d_KeyError7  sJ     
#(E$5t<<<(E$5t<<<<<r   c                     t          j        ddgddgg          }|| j        j        d<   |j                                        | j        j        d<   |j        | j        j        d<   t           j                            | j        j        d         |           t           j                            | j        j        d         |j                   t           j                            | j        j        d         |j                   dS )	z7Checking setting 2D and non-contiguous NumPy attributesr   r    r   r   r7   r   r   N)npr,   rO   Tcopytestingassert_array_equal)r0   datas     r   test_2d_non_contiguousz%CreateTestCase.test_2d_non_contiguous>  s     x!Q!Q()) $
 $
 $


%%dj&6s&;TBBB

%%dj&6s&;TVDDD

%%dj&6s&;TVDDDDDr   c                    t           j        r,t          dd           t          d| j        j        z             | j        j        }d}d}||fD ]}d||<   d}d}||fD ]Q}t          j                    5  t          j	        d	t          j                   d||<   d
d
d
           n# 1 swxY w Y   Rt          |          }|                     d|           |                     d|           |                     |                    d          d           |                     ||           |                     ||           |                     |                    |          d           |                     ||           |                     ||           |                     |                    |          d           |                     t%          t'          |                    t%          |                     d
S )zChecking AttributeSet.__dir__
z<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=zRunning %s.test12_dir...	good_attrBETTER_ATTRr    5badzSYS%ra   Nr1   r   )r   r@   rA   r1   r	   r.   rN   rd   re   rf   r   rg   dirassertInrC   countrM   assertSequenceEqualsortedset)r0   attrset	user_attrsys_attrr7   bad_userbad_syscompletionss           r   
test12_dirzCreateTestCase.test12_dirW  sI    > 	H$	""",t~/FFGGG*%	 X& 	 	AGAJJG$ 	 	A(**  %h0EFFF
               'll 	k;///i---**955q999 	+...h,,,**844a888 	i---;///**955q999 	  K(8(8!9!9!'!4!4	6 	6 	6 	6 	6s   2%B##B'	*B'	)rR   )r	   r
   r   r&   rG   rJ   rQ   r_   rk   rm   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__r1   s   @r   r   r      s       = = = = =+ + +4) ) )8 8 8=! =! =! =!~
9 
9 
9P P P.J J J,BD BD BDH%> %> %>N%> %> %>NH H HJ J J65 5 5"J J J>!- !- !-F!- !- !-F= = =*= = =,+ + ++ + +0 0 0= = =E E E2(6 (6 (6 (6 (6 (6 (6r   r   c                   B    e Zd ZdZej        j        Z ee          Z	dS )NotCloseCreateFr=   N
r	   r
   r   r?   r   
parametersNODE_CACHE_SLOTSr=   dictopen_kwargsr   r   r   r   r     s1        E}5$(8999KKKr   r   c                   B    e Zd ZdZej        j        Z ee          Z	dS )CloseCreateTr   Nr   r   r   r   r   r     s1        E}5$(8999KKKr   r   c                   .    e Zd ZdZdZ ee          ZdS )NoCacheNotCloseCreateFr   r   Nr	   r
   r   r?   r=   r   r   r   r   r   r   r     s,        E$(8999KKKr   r   c                   .    e Zd ZdZdZ ee          ZdS )NoCacheCloseCreateTr   r   Nr   r   r   r   r   r     s,        E$(8999KKKr   r   c                   D    e Zd ZdZej        j         Z ee          Z	dS )DictCacheNotCloseCreateFr   Nr   r   r   r   r   r     s4        E66$(8999KKKr   r   c                   D    e Zd ZdZej        j         Z ee          Z	dS )DictCacheCloseCreateTr   Nr   r   r   r   r   r     s4        E66$(8999KKKr   r   c                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%d$ Z& xZ'S )%TypesTestCasec                 "   d| j         i| _        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/   s    r   r&   zTypesTestCase.setUp  s    +T-?@K$	 [--di/0c=B B
 [--di.;= =


r   c                    d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r]t          d| j         j        j                   t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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 -->r9   r:   r<   Nr,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   rC   rI   s    r   test00a_setBoolAttributesz'TypesTestCase.test00a_setBoolAttributes  s:    #
#
"
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ*03T:::*03U;;;*03T:::::r   c                    t          j        d          | j        j        _        t          j        d          | j        j        _        t          j        d          | j        j        _        t          j        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j                   | j
        rXt          j        rt          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  r9   r:   r  N)r   bool_r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   assertIsInstancerC   rI   s    r   test00b_setBoolAttributesz'TypesTestCase.test00b_setBoolAttributes  s    !htnn
 huoo
 htnn
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdi/58"(CCCdi/58"(CCCdi/58"(CCC*03T:::*03U;;;*03T:::::r   c                 d   t          j        d          | j        j        _        t          j        d          | j        j        _        t          j        d          | j        j        _        t          j        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j                   | j	        rXt          j        rt          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  r9   r:   r  N)r   r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   rC   rI   s    r   test00c_setBoolAttributesz'TypesTestCase.test00c_setBoolAttributes  sR    !htnn
 huoo
 htnn
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ*03T:::*03U;;;*03T:::::r   c                 0   t          j        dg          | j        j        _        t          j        dgg          | j        j        _        t          j        ddgddgg          | j        j        _        t          j        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j                   | j	        rXt          j        rt          d           | 
                    d           | j        j        | _        | j        j        j        | _        t           j                            | j        j        j        j        t          j        dg                     t           j                            | j        j        j        j        t          j        dgg                     t           j                            | j        j        j        j        t          j        ddgddgg                     d	S )
z7Checking setting Bool attributes (NumPy, multidim case)TFr   r  r  r9   r:   r  N)r   r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   r   r   rI   s    r   test00d_setBoolAttributesz'TypesTestCase.test00d_setBoolAttributes  s    !hv..
 hy11
 hue}'EFF
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%di&7&=&@&(hv&6&6	8 	8 	8

%%di&7&=&@&(hy&9&9	; 	; 	;

%%di&7&=&@&(hue}/M&N&N	P 	P 	P 	P 	Pr   c                 0   d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r]t          d| j         j        j                   t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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  r9   r:   r  N)r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   r  r   int_rC   rI   s    r   test01a_setIntAttributesz&TypesTestCase.test01a_setIntAttributes  s     


 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdi/58"'BBBdi/58"'BBBdi/58"'BBB*03Q777*03Q777*03Q77777r   c           	      J   g d}|D ]1}t          | j        j        |t          j        d|                     2t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d           | j
        j        | _        | j
        j        j        | _        |D ]N}t          j                            t          | j        j        |          t          j        d|                     OdS )	z4Checking setting Int attributes (scalar, NumPy case)int8int16int32int64uint8uint16uint32r    dtypetype, value-->r9   r:   r  Nr[   r,   rO   r   r   r@   rA   r\   r?   rB   r'   r(   r   r   r   r0   
checktypesr  s      r   test01b_setIntAttributesz&TypesTestCase.test01b_setIntAttributes5  sO   3 3 3
   	G 	GEDJ$eRXau-E-E-EFFFF > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	D 	DEJ))'$*2BE*J*J*,(1E*B*B*BD D D D	D 	Dr   c           	      H   g d}|D ]3}t          | j        j        |t          j        ddg|                     4| j        rXt
          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        |D ]}t
          j        r)t          d|t          | j        j        |                     t          j                            t          | j        j        |          t          j        ddg|                     d	S )
z;Checking setting Int attributes (unidimensional NumPy case)r  r    r   r  r9   r:   r  r  Nr[   r,   rO   r   r?   r   r@   rA   rB   r'   r(   r   r\   r   r   r  s      r   test01c_setIntAttributesz&TypesTestCase.test01c_setIntAttributesP  sA   3 3 3
   	L 	LEDJ$eRXq!fE-J-J-JKKKK : 	2~ 0.///LLdL###(DI)1DJ 	I 	IE~ 8&dj.668 8 8J))'$*2BE*J*J*,(Aq6*G*G*GI I I I		I 	Ir   c           	      t   g d}|D ]>}t          j        g d|          ddd         }t          | j        j        ||           ?| j        rXt
          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        |D ]}t          j        g d|          ddd         }t
          j        r)t          d	|t          | j        j        |                     t           j                            t          | j        j        |          |           dS )
z@Checking setting Int attributes (unidimensional, non-contiguous)r  )r    r   r   r   r  Nr   r9   r:   r  r  )r   r,   r[   rO   r?   r   r@   rA   rB   r'   r(   r   r\   r   r   r0   r  r  arrs       r   test01d_setIntAttributesz&TypesTestCase.test01d_setIntAttributesi  sW   3 3 3
   	2 	2E(<<<u555ccc:CDJ$eS1111 : 	2~ 0.///LLdL###(DI)1DJ 	/ 	/E(<<<u555ccc:C~ 8&dj.668 8 8J))'$*2BE*J*J*-/ / / /	/ 	/r   c           
      X   g d}|D ]7}t          | j        j        |t          j        ddgddgg|                     8| j        rXt
          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        |D ]}t
          j        r)t          d	|t          | j        j        |                     t          j                            t          | j        j        |          t          j        ddgddgg|                     d
S ):Checking setting Int attributes (bidimensional NumPy case)r  r    r   r   r  r9   r:   r  r  Nr"  r  s      r   test01e_setIntAttributesz&TypesTestCase.test01e_setIntAttributes  sU   3 3 3
   	= 	=EDJ$eHq!fq!f-U;;;= = = = : 	2~ 0.///LLdL###(DI)1DJ   	9 	9E~ 8&dj.668 8 8J))
(%001a&1a&)7779 9 9 9		9 	9r   c                 0   d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r]t          d| j         j        j                   t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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  r9   r:   r  N)r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   r  r   float_rC   rI   s    r   test02a_setFloatAttributesz(TypesTestCase.test02a_setFloatAttributes  s    "
!
!
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdi/58")DDDdi/58")DDDdi/58")DDD*03S999*03S999*03S99999r   c           	      "   ddg}|D ]1}t          | j        j        |t          j        d|                     2t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d           | j
        j        | _        | j
        j        j        | _        |D ]:}t          j                            t          | j        j        |          d           ;d	S )
z6Checking setting Float attributes (scalar, NumPy case)float32float64皙?r  r  r9   r:   r  Nr[   r,   rO   r   r   r@   rA   r\   r?   rB   r'   r(   r   r   assert_almost_equalr  s      r   test02b_setFloatAttributesz(TypesTestCase.test02b_setFloatAttributes  s3     +
 	I 	IEDJ$eRXc-G-G-GHHHH > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	0 	0E J**74:3CU+K+K+.0 0 0 0	0 	0r   c           	      R   ddg}|D ]3}t          | j        j        |t          j        ddg|                     4t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d	           | j
        j        | _        | j
        j        j        | _        |D ]P}t          j                            t          | j        j        |          t          j        ddg|                     Qd
S )z=Checking setting Float attributes (unidimensional NumPy case)r1  r2  r3   @r  r  r9   r:   r  Nr  r  s      r   test02c_setFloatAttributesz(TypesTestCase.test02c_setFloatAttributes  sP     +
 	P 	PEDJ$eRXsCj-N-N-NOOOO > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	M 	MEJ))'$*2BE*J*J*,(C:U*K*K*KM M M M	M 	Mr   c           	      ~   ddg}|D ]>}t          j        g d|          ddd         }t          | j        j        ||           ?t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d	           | 	                    d
           | j
        j        | _        | j
        j        j        | _        |D ][}t          j        g d|          ddd         }t           j                            t          | j        j        |          |           \dS )zJChecking setting Float attributes (unidimensional,
        non-contiguous)r1  r2  )r3  r8  @gffffff@r  r    Nr   r  r9   r:   r  )r   r,   r[   rO   r   r@   rA   r\   r?   rB   r'   r(   r   r   r   r%  s       r   test02d_setFloatAttributesz(TypesTestCase.test02d_setFloatAttributes  sl     +
 	2 	2E(///u===addCCDJ$eS1111 > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	/ 	/E(///u===addCCJ))'$*2BE*J*J*-/ / / /	/ 	/r   c           
      b   ddg}|D ]7}t          | j        j        |t          j        ddgddgg|                     8t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d	
           | j
        j        | _        | j
        j        j        | _        |D ]T}t          j                            t          | j        j        |          t          j        ddgddgg|                     UdS )r)  r1  r2  r3  r8  r;  r  r  r9   r:   r  Nr  r  s      r   test02e_setFloatAttributesz(TypesTestCase.test02e_setFloatAttributes  sp     +
 	E 	EEDJ$eHsCj3*5UCCCE E E E > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	A 	AEJ))
(%003*sCj1???A A A A	A 	Ar   c                    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        rXt
          j        rt          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    )ddfdsdr   r  r  r9   r:   r  Nr  rI   s    r   test03_setObjectAttributesz(TypesTestCase.test03_setObjectAttributes&  sR     #Ah
$
&*155
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ*03c1X>>>*03V<<<*03T!5L5LMMMMMr   c                 0   d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r]t          d| j         j        j                   t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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)foobarbazr   r  r  r9   r:   r  N)r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   r  r   str_rC   rI   s    r   test04a_setStringAttributesz)TypesTestCase.test04a_setStringAttributes?  s    $
#
#
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdi/58"'BBBdi/58"'BBBdi/58"'BBB*03U;;;*03U;;;*03U;;;;;r   c                    t          j        dg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j
        j        j        j        t          j        dg                     dS )z?Checking setting string attributes (unidimensional 1-elem case)rE  r   r9   r:   r  Nr   r,   rO   rw   r   r@   rA   r?   rB   r'   r(   r   r   r   rI   s    r   test04b_setStringAttributesz)TypesTestCase.test04b_setStringAttributesZ  s     !hw//
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%di&7&=&@&(hw&7&7	9 	9 	9 	9 	9r   c                 F   t          j        dg          | j        j        _        t          j        rt          d| j        j        j                   | j        rt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t          j        rt          d| j        j        j                   t           j                            | j
        j        j        j        t          j        dg                     dS )zMChecking setting string attributes (empty unidimensional
        1-elem case)rR   r   r9   r:   r  NrK  rI   s    r   test04c_setStringAttributesz)TypesTestCase.test04c_setStringAttributesm  s     !htnn
 > 	1(DJ,/000: 	5~ 0.///LLdL###(DI)1DJ~ 5h
 0 3444

%%di&7&=&@&(htnn	6 	6 	6 	6 	6r   c                    t          j        ddg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j
        j        j        j        t          j        ddg                     dS )z?Checking setting string attributes (unidimensional 2-elem case)rE  bar3r   r9   r:   r  NrK  rI   s    r   test04d_setStringAttributesz)TypesTestCase.test04d_setStringAttributes  s     !hv77
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%di&7&=&@&(hv&?&?	A 	A 	A 	A 	Ar   c                    t          j        ddg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j
        j        j        j        t          j        ddg                     dS )zMChecking setting string attributes (empty unidimensional
        2-elem case)rR   r   r9   r:   r  NrK  rI   s    r   test04e_setStringAttributesz)TypesTestCase.test04e_setStringAttributes  s     !hBx00
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%di&7&=&@&(hBx&8&8	: 	: 	: 	: 	:r   c                    t          j        ddgddgg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j
        j        j        j        t          j        ddgddgg                     d	S )
z>Checking setting string attributes (bidimensional 4-elem case)rE  foo2foo3foo4r   r9   r:   r  NrK  rI   s    r   test04f_setStringAttributesz)TypesTestCase.test04f_setStringAttributes  s     !h&&9I'JKK
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%di&7&=&@&(h170@0B 'C 'C	D 	D 	D 	D 	Dr   c                 0   d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r]t          d| j         j        j                   t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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  r9   r:   r  N)r,   rO   rw   rx   ry   r   r@   rA   r?   rB   r'   r(   r   r  r   complex_rC   rI   s    r   test05a_setComplexAttributesz*TypesTestCase.test05a_setComplexAttributes  s    '
&
&
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdi/58"+FFFdi/58"+FFFdi/58"+FFF*03X>>>*03X>>>*03X>>>>>r   c           	      "   ddg}|D ]1}t          | j        j        |t          j        d|                     2t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d           | j
        j        | _        | j
        j        j        | _        |D ]:}t          j                            t          | j        j        |          d           ;d	S )
z8Checking setting Complex attributes (scalar, NumPy case)	complex64
complex128y?       @r  r  r9   r:   r  Nr4  r  s      r   test05b_setComplexAttributesz*TypesTestCase.test05b_setComplexAttributes  s3    "<0
 	N 	NEDJ$eRXhe-L-L-LMMMM > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	5 	5E J**74:3CU+K+K+35 5 5 5	5 	5r   c           	      R   ddg}|D ]3}t          | j        j        |t          j        ddg|                     4t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d	           | j
        j        | _        | j
        j        j        | _        |D ]P}t          j                            t          | j        j        |          t          j        ddg|                     Qd
S )z?Checking setting Complex attributes (unidimensional NumPy case)r]  r^  r3  r8  r  r  r9   r:   r  Nr  r  s      r   test05c_setComplexAttributesz*TypesTestCase.test05c_setComplexAttributes  sP    "<0
 	P 	PEDJ$eRXsCj-N-N-NOOOO > 	8# 8 8&dj.668 8 8 8 : 	2~ 0.///LLdL###(DI)1DJ 	M 	MEJ))'$*2BE*J*J*,(C:U*K*K*KM M M M	M 	Mr   c           
      b   ddg}|D ]7}t          | j        j        |t          j        ddgddgg|                     8t          j        r.|D ]+}t          d|t          | j        j        |                     ,| j        rXt          j        rt          d           | 	                    d	
           | j
        j        | _        | j
        j        j        | _        |D ]T}t          j                            t          | j        j        |          t          j        ddgddgg|                     UdS )r)  r]  r^  r3  r8  r;  r  r  r9   r:   r  Nr  r  s      r   test05d_setComplexAttributesz*TypesTestCase.test05d_setComplexAttributes  sp    "<0
 	E 	EEDJ$eHsCj3*5UCCCE E E E > 	?# ? ?&WTZ%5u==? ? ? ? : 	2~ 0.///LLdL###(DI)1DJ 	A 	AEJ))
(%003*sCj1???A A A A	A 	Ar   c                 .   d| j         j        _        d| j         j        _        d| j         j        _        t
          j        rzt          j        dk    r,t          dt          | j         j        j                             t          d| j         j        j                   t          d| j         j        j                   | j        rXt
          j        rt          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ŀlelrR   rG  win32r   r  r  r9   r:   r  N)r,   rO   rw   rx   ry   r   r@   rz   platformrA   reprr?   rB   r'   r(   r   r  r   unicode_rC   rI   s    r   test06a_setUnicodeAttributesz*TypesTestCase.test06a_setUnicodeAttributes)  s    .
 
#
 > 	1|w&&hTZ%5%8 9 9::: (DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdj.12;???dj.12;???dj.12;???),o>>>),b111),e44444r   c                    t          j        dg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j        j        j        t          j        dg                     dS )z@Checking setting unicode attributes (unidimensional 1-elem case)re  r   r9   r:   r  NrK  rI   s    r   test06b_setUnicodeAttributesz*TypesTestCase.test06b_setUnicodeAttributesH  s     !h'899
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%dj&6&9&(h/@&A&A	C 	C 	C 	C 	Cr   c                 ^   t          j        dgd          | j        j        _        t          j        rt          d| j        j        j                   | j        rt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t          j        r,t          dt          | j        j        j                             t           j                            | j        j        j        t          j        dgd                     dS )	zNChecking setting unicode attributes (empty unidimensional
        1-elem case)rR   U1r  r   r9   r:   r  N)r   r,   rO   rw   r   r@   rA   r?   rB   r'   r(   r   rh  r   r   rI   s    r   test06c_setUnicodeAttributesz*TypesTestCase.test06c_setUnicodeAttributes[  s	    !ht4888
 > 	1(DJ,/000: 	;~ 0.///LLdL###(DI)1DJ~ ;hTZ%5%8 9 9:::

%%dj&6&9&(ht4&@&@&@	B 	B 	B 	B 	Br   c                    t          j        ddg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j        j        j        t          j        ddg                     dS )z@Checking setting unicode attributes (unidimensional 2-elem case)re  rP  r   r9   r:   r  NrK  rI   s    r   test06d_setUnicodeAttributesz*TypesTestCase.test06d_setUnicodeAttributest  s     !h'@AA
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%dj&6&9&(h/H&I&I	K 	K 	K 	K 	Kr   c                    t          j        ddgd          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j        j        j        t          j        ddgd                     dS )	zNChecking setting unicode attributes (empty unidimensional
        2-elem case)rR   rn  r  r   r9   r:   r  NrK  rI   s    r   test06e_setUnicodeAttributesz*TypesTestCase.test06e_setUnicodeAttributes  s     !hBxt<<<
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%dj&6&9&(hBxt&D&D&D	F 	F 	F 	F 	Fr   c                    t          j        ddgddgg          | j        j        _        t          j        rt          d| j        j        j                   | j        rXt          j        rt          d           |                     d           | j	        j
        | _
        | j	        j
        j        | _        t           j                            | j        j        j        t          j        ddgddgg                     d	S )
z?Checking setting unicode attributes (bidimensional 4-elem case)re  rU  rV  u
   paraŀlel4r   r9   r:   r  NrK  rI   s    r   test06f_setUnicodeAttributesz*TypesTestCase.test06f_setUnicodeAttributes  s    !h&(A)/1A(B(D E E
 > 	1(DJ,/000: 	2~ 0.///LLdL###(DI)1DJ

%%dj&6&9&(h&0I179I0J0L 'M 'M	N 	N 	N 	N 	Nr   c                 N   t          j        d| j                  }t          j        d|          | j        j        _        t          j        d|          | j        j        _        t          j        dg|          | j        j        _	        t          j        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j	                   | j        rXt          j        rt          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        j        t          j        d|                     t           j                            | j        j        j        t          j        d|                     t           j                            | j        j        j	        t          j        dg|                     dS )z-Checking setting RecArray (NumPy) attributes.i4,f8alignr   r   r   r    r-  r   r  r  r9   r:   r  Nr   r  alignedzerosr,   rO   rw   onesrx   ry   r   r@   rA   r?   rB   r'   r(   r   r  ndarrayr   r   r0   dts     r   test07a_setRecArrayAttributesz+TypesTestCase.test07a_setRecArrayAttributes  s    XgT\222 hq"oo
 gfb11
 hy"55
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdj.12:>>>dj.12:>>>dj.12:>>>

%%dj&6&928Ar??KKK

%%dj&6&9&(gfb&9&9	; 	; 	;

%%dj&6&9&(hy"&=&=	? 	? 	? 	? 	?r   c                 J   t          j        dddgfg          }t          j        d|          | j        j        _        t          j        d|          | j        j        _        t          j        dg|          | j        j        _        t          j
        r]t          d| j        j        j                   t          d| j        j        j                   t          d	| j        j        j                   | j        rXt          j
        rt          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        j        t          j        d|                     t           j                            | j        j        j        t          j        d|                     t           j                            | j        j        j        t          j        dg|                     dS )z4Checking setting nested RecArray (NumPy) attributes.f1)r  i2f2f8r   rz  )r{  r   r  r  r9   r:   r  )r@  Nr   r  r~  r,   rO   rw   r  rx   ry   r   r@   rA   r?   rB   r'   r(   r   r  r  r   r   r  s     r   test07b_setRecArrayAttributesz+TypesTestCase.test07b_setRecArrayAttributes  s    X|\:;<== hq"oo
 gfb11
 h
|R88
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdj.12:>>>dj.12:>>>dj.12:>>>

%%dj&6&9&(hq"oo	7 	7 	7

%%dj&6&9&(gfb&9&9	; 	; 	;

%%dj&6&9&(h	{B&?&?	A 	A 	A 	A 	Ar   c                 b   t          j        dddgfgd          }t          j        d|          | j        j        _        t          j        d|          | j        j        _        t          j        dd	gd
ffg|          | j        j        _        t          j
        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j                   | j        rXt          j
        rt          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        j        t          j        d|                     t           j                            | j        j        j        t          j        d|                     t           j                            | j        j        j        t          j        dd	gdffg|                     dS )z=Checking setting multidim nested RecArray (NumPy) attributes.r  )r  r  )r   r  Trx  r   rz  r    r   r-  r   r  r  r9   r:   r  Nr  r  s     r   test07c_setRecArrayAttributesz+TypesTestCase.test07c_setRecArrayAttributes  s)    X1<@AB$OOO !hq"oo
 gfb11
 h1a&"'8"==
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL###(DI)1DJdj.12:>>>dj.12:>>>dj.12:>>>

%%dj&6&928Ar??KKK

%%dj&6&92762;N;NOOO

%%dj&6&9&(h1a&!/?&D&D	F 	F 	F 	F 	Fr   c                 P   t          j        d| j                  }t          j        d|          | j        j        _        t          j        d|          | j        j        _        t          j        dg|          | j        j        _	        t          j        r]t          d| j        j        j                   t          d| j        j        j                   t          d| j        j        j	                   | j        rYt          j        rt          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        j        t          j        d|                     t           j                            | j        j        j        t          j        d|                     t           j                            | j        j        j	        t          j        dg|                     dS )zqChecking setting aligned RecArray (NumPy) attributes with
        `allow_aligned` param set to False when reopen.rw  rx  r   rz  r{  r   r  r  r9   r:   F)r<   allow_alignNr|  r  s     r   !test08_setRecArrayNotAllowPaddingz/TypesTestCase.test08_setRecArrayNotAllowPadding  s    XgT\222 hq"oo
 gfb11
 hy"55
 > 	1(DJ,/000(DJ,/000(DJ,/000: 	2~ 0.///LLdL666(DI)1DJdj.12:>>>dj.12:>>>dj.12:>>>

%%dj&6&928Ar??KKK

%%dj&6&92762;N;NOOO

%%dj&6&9&(hy"&=&=	? 	? 	? 	? 	?r   )(r	   r
   r   r&   r  r	  r  r  r  r   r#  r'  r*  r/  r6  r9  r<  r>  rC  rI  rL  rN  rQ  rS  rX  r[  r_  ra  rc  rj  rl  ro  rq  rs  ru  r  r  r  r  r   r   s   @r   r   r     sz       
= 
= 
= 
= 
=; ; ;0; ; ;6; ; ;0P P P68 8 86D D D6I I I2/ / /69 9 96: : :80 0 06M M M2/ / /8A A A6N N N2< < <69 9 9&6 6 6,A A A&: : :(D D D(? ? ?85 5 56M M M2A A A65 5 5>C C C&B B B2K K K&F F F(N N N*? ? ?>A A ABF F F@? ? ? ? ? ? ?r   r   c                       e Zd ZdZdZdZdS )NotCloseTypesTestCaseFNr	   r
   r   r   r}  r?   r   r   r   r  r  0  s        MGEEEr   r  c                       e Zd ZdZdZdZdS )NoCloseAlignedTypesTestCaseTFNr  r   r   r   r  r  6  s        MGEEEr   r  c                       e Zd ZdZdZdZdS )"CloseNotAlignedPaddedTypesTestCaseFTNr  r   r   r   r  r  <  s        MGEEEr   r  c                       e Zd ZdZdZdZdS )CloseTypesTestCaseTFNr  r   r   r   r  r  B  s        MGEEEr   r  c                       e Zd ZdZdZdZdS )CloseAlignedTypesTestCaseFTNr  r   r   r   r  r  H  s        MGEEEr   r  c                       e Zd ZdZdZdZdS )CloseAlignedPaddedTypesTestCaseTNr  r   r   r   r  r  N  s        MGEEEr   r  c                   <     e Zd Z ed          Z fdZd Z xZS )NoSysAttrsTestCaseF)pytables_sys_attrsc                 ^   t                                                       | j        j        | _        | j                            | j        dt
          d          | _        | j                            | j        ddgd          | _        | j        	                    | j        dd          | _
        d S r   r$   r/   s    r   r&   zNoSysAttrsTestCase.setUpW  r2   r   c                    d| j         j        _        d| j         j        _        d| j         j        _        t
          j        r,t          d| j         j                                                   d| j	        j
        _        d| j	        j
        _        d| j	        j
        _        t
          j        r,t          d| j	        j
                                                   d| j        j
        _        d| j        j
        _        d| j        j
        _        t
          j        r,t          d| j        j
                                                   | j        rBt
          j        rt          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).rq   rr   rs   rt   r9   r:   r  ru   rv   rz   r~   r   r   N)r.   rN   rw   rx   ry   r   r@   rA   r   r*   rO   r7   r   r   r,   r   r   r   r?   rB   r'   r(   r"   rC   r   r   r   s       r   test00_listAttributesz(NoSysAttrsTestCase.test00_listAttributese  s    "%
!$
!$
> 	D#TZ%8%@%@%B%BCCC !
 
 
> 	A#TZ%5%=%=%?%?@@@ !
 
 
> 	A#TZ%5%=%=%?%?@@@: 	)~ 0.///LLdL###(DI!0088:L:L:LMMM0077<<<00779K9K9KLLL!--//AAA--e44b999--e44oooFFF)#..00///BBB..u55r:::..u55GGGGGr   )r	   r
   r   r   r   r&   r  r   r   s   @r   r  r  T  s`        $%000K= = = = =+H +H +H +H +H +H +Hr   r  c                       e Zd ZdZdS )NoSysAttrsNotCloseFNr	   r
   r   r?   r   r   r   r  r    s        EEEr   r  c                       e Zd ZdZdS )NoSysAttrsCloseTNr  r   r   r   r  r    s        EEEr   r  c                       e Zd Z ej        d          Zej                             ee	j
                   ed          k     d          d             ZdS )CompatibilityTestCasezissue_368.h5z1.9.0zrequires numpy >= 1.9c                 d    |                      | j                            dd          d           d S )N/py2_pickled_unicodeabc)rC   r'   rD   rI   s    r   test_pickled_unicode_attrsz0CompatibilityTestCase.test_pickled_unicode_attrs  sC    " 	K%%c+@AA5	J 	J 	J 	J 	Jr   N)r	   r
   r   r   test_filenameh5fnameunittestskipIfr   r   __version__r  r   r   r   r  r    sy        "f">22G_GGBN33ggg6F6FF35 5J J5 5J J Jr   r  c                   4    e Zd Z ej        d          Zd ZdS )PicklePy2UnpicklePy3TestCasezissue_560.h5c                    |                      | j                            dd          t          j                   | j                            dd          }|                      |t                     |                     |d         d           d S )Nr  py2_pickled_datetimepy2_pickled_dictszjust a string)r  r'   rD   datetimer   rC   )r0   ds     r   test_pickled_datetime_objectz9PicklePy2UnpicklePy3TestCase.test_pickled_datetime_object  s     	K%%c+ABB	 	 	 K%%c+=>>a&&&311111r   N)r	   r
   r   r   r  r  r  r   r   r   r  r    s5        "f">22G2 2 2 2 2r   r  c                       e Zd Zd ZdS )SegFaultPythonTestCasec                    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 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(   rN   trouble1rC   trouble2rB   r   r@   rA   rI   s    r   test00_segfaultz&SegFaultPythonTestCase.test00_segfault  s     .1!*)2;SAAA-1!*)2;TBBB)2;SAAA)2;TBBB> 	IGHHHHH	I 	Ir   N)r	   r
   r   r  r   r   r   r  r    s(        I I I I Ir   r  c                       e Zd Zd Zd ZdS )EmbeddedNullsTestCasec                    d}|| j         j        j        _        |                     | j         j        j        j        |           |                                  |                     | j         j        j        j        |           d S )Nzstring with a null byte   in itr'   r(   rN   rP   rC   rB   r0   values     r   test_unicodez"EmbeddedNullsTestCase.test_unicode  sl    4).!&)27???)27?????r   c                    d}|| j         j        j        _        |                     | j         j        j        j        |           |                                  |                     | j         j        j        j        |           d S )Ns   string with a null byte   in itr  r  s     r   
test_bytesz EmbeddedNullsTestCase.test_bytes  sl    5).!&)27???)27?????r   N)r	   r
   r   r  r  r   r   r   r  r    s:        @ @ @@ @ @ @ @r   r  c                   :     e Zd Z fdZ fdZd Zd Zd Z xZS )VlenStrAttrTestCasec                     t                                                       t          j        d          | _        t          j        | j                  | _        d S )Nzvlstr_attr.h5)r%   r&   r   r  r  r   	open_filer'   r/   s    r   r&   zVlenStrAttrTestCase.setUp  s=    +O<<l4<00r   c                 z    | j                                          t                                                       d S rL   )r'   r?   r%   tearDownr/   s    r   r  zVlenStrAttrTestCase.tearDown  s3    r   c                     d}|                      | j                            d|          |                    d                     dS )z5Checking file with variable length string attributes.vlen_str_scalarr  asciiN)rC   r'   rD   encode)r0   attrs     r   test01_vlen_str_scalarz*VlenStrAttrTestCase.test01_vlen_str_scalar   sS     !K%%c400$++g2F2F	H 	H 	H 	H 	Hr   c                     d}| j                             d|          }|                     |j        d           t	          |          D ]5\  }}d||fz  }|                     ||                    d                     6dS )z:Checking file with variable length string attributes (1d).vlen_str_arrayr  r    z%s_%dr  Nr'   rD   rC   ndim	enumerater  )r0   r  vidxitemr  s         r   test02_vlen_str_arrayz)VlenStrAttrTestCase.test02_vlen_str_array  s      K%%c400###"1 	: 	:ICtSk)ET5<<#8#89999	: 	:r   c                 ,   d}| j                             d|          }|                     |j        d           t	          |          D ]K\  }}t	          |          D ]6\  }}d|||fz  }|                     ||                    d                     7LdS )z:Checking file with variable length string attributes (2d).vlen_str_matrixr  r   z%s_%d%dr  Nr  )r0   r  mrowrowdatacolr  r  s           r   test03_vlen_str_matrixz*VlenStrAttrTestCase.test03_vlen_str_matrix  s     !K%%c400###%aLL 	> 	>LC&w// > >	T!T3$44  u||G'<'<====>	> 	>r   )	r	   r
   r   r&   r  r  r  r  r   r   s   @r   r  r    s        1 1 1 1 1
    H H H: : :	> 	> 	> 	> 	> 	> 	>r   r  c                   4    e Zd Z ej        d          Zd ZdS )UnsupportedAttrTypeTestCasezattr-u16.h5c                 f    |                      t          j        j        t          | j                   dS )z$Checking file with unsupported type.N)assertWarnsr   
exceptionsDataTypeWarningrh  r'   rI   s    r   test00_unsupportedTypez2UnsupportedAttrTypeTestCase.test00_unsupportedType!  s)     	6dkJJJJJr   N)r	   r
   r   r   r  r  r  r   r   r   r  r    s:        "f"=11GK K K K Kr   r  c                       e Zd Zd Zd ZdS )SpecificAttrsTestCasec                     | j                             ddt          j                    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   	Int32Atomr   r@   rA   rO   EXTDIMrC   r0   r  s     r   test00_earrayz#SpecificAttrsTestCase.test00_earray*  sc     [&&sD",..)LL> 	0+rx///!,,,,,r   c                 :   | j                             ddt          j                    d          }|                     d           | j         j        j        }t          j        rt          d|j
        j                   |                     |j
        j        d           dS )z%Testing EArray specific attrs (open).r  r  )r   r    r   rr  r   N)r'   r  r   r  rB   r(   r  r   r@   rA   rO   r  rC   r  s     r   test01_earrayz#SpecificAttrsTestCase.test01_earray2  s     [&&sD",..)LLS[ > 	0+rx///!,,,,,r   N)r	   r
   r   r  r  r   r   r   r  r  (  s2        - - -- - - - -r   r  c                  t	   t           j                                        } d}t          |          D ]}|                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                                |                     t           j                            t"                               |                     t           j                            t$                               |                     t           j                            t&                               |                     t           j                            t(                               |                     t           j                            t*                               |                     t           j                            t,                               |                     t           j                            t.                               |                     t           j                            t0                               |                     t           j                            t2                               |                     t           j                            t4                               | S )Nr    )r   r  	TestSuiterangeaddTest	makeSuiter   r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )theSuiteniterr   s      r   suiter  =  sq   ((**HE5\\ K K22>BBCCC22;??@@@223HIIJJJ223EFFGGG223JKKLLL223GHHIII223HIIJJJ223EFFGGG22.0 0 	1 	1 	122') ) 	* 	* 	*223LMMNNN22+- - 	. 	. 	.223EFFGGG22?CCDDD223HIIJJJ22(* * 	+ 	+ 	+223IJJKKK223HIIJJJ223FGGHHH22') ) 	* 	* 	*223HIIJJJJOr   __main__r  )defaultTest)0__doc__r  rz   rd   packaging.versionr   numpyr   tablesr   tables.testsr   IsDescriptionr   TempFileMixinPyTablesTestCaser   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  TestFileMixinr  r  r  r  r  r  r  r  r	   
parse_argvargvprint_versionsr  mainr   r   r   <module>r     st   O O  



  % % % % % %                  R   i	6 i	6 i	6 i	6 i	6V)6+B i	6 i	6 i	6X: : : : :^ : : :: : : : :. : : :: : : : :N : : :: : : : : : : :: : : : :n : : :: : : : :> : : :G? G? G? G? G?F(&*A G? G? G?T    M       -                            m   <H <H <H <H <H-v/F <H <H <H~    +       (   J J J J JF0&2I J J J02 2 2 2 26#7#)#:2 2 24I I I I IV163J I I I"@ @ @ @ @F0&2I @ @ @0$> $> $> $> $>&1 $> $> $>NK K K K K&"6"("9K K K- - - - -F0&2I - - -*     F zFchF
OW----- r   