
    &Vf                     N    d Z ddlZddlmZmZ ddlmZmZ  G d de          Z	dS )	z6
    Tests the h5py.AttributeManager.create() method.
    N   )h5th5a   )utTestCasec                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
	TestArrayzG
        Check that top-level array types can be created and read.
    c                    t          j        d          }t          j        dd          }| j        j                            d||           t          j        | j        j        d          }|	                                }| 
                    |                                t          j                   | j        j        d         }|                     ||           d S )N(3,)i   idtypexdatar      x)npr   arangefattrscreater   openidget_typeassertEqual	get_classr   ARRAYassertArrayEqual)selfdtr   aidhtypeouts         ]/var/www/html/software/conda/lib/python3.11/site-packages/h5py/tests/test_attribute_create.pytest_intzTestArray.test_int   s     Xgy#&&&Cd"555htvy$''**CI666fl3c4(((((    c                 J    | j         j                            ddd           d S )Nr   *   i8r   )r   r   r   r!   s    r&   test_string_dtypezTestArray.test_string_dtype*   s)     	Cb55555r(   c                     | j         j                            dt          d                     | j         j        d         }|                     |t          d                     |                     |t                     d S )Nr   i  )r   r   r   chrr   assertIsInstancestr)r!   r%   s     r&   test_strzTestArray.test_str/   sh    CV---fl3c&kk***c3'''''r(   c                 @   d}| j         j                            d|           | j         j        d         }|                     t	          ||k                         |                     |j        t          j        d                     t          j        |          }|                     |j        t          j        d                     | 	                    t                    5  | j         j                            d|           d d d            d S # 1 swxY w Y   d S )Nabr   r   OU1y)r   r   r   
assertTrueallr   r   r   arrayassertRaises	TypeError)r!   r   resultdata_as_U_arrays       r&   test_tuple_of_unicodezTestArray.test_tuple_of_unicode6   s7    Cd+++c"FdN++,,,rx}}555
 (4...???y)) 	; 	;FL/:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s   $"DDDc                 f   | j         j                            ddd           | j         j        d         }|                     |j        d           | j         j                            dt          j        d          d           | j         j        d         }|                     |j        d           d S )	Nr   r*   r   )r   shape)r   r:   r   )r   )r   r   r   r   rD   r   r   )r!   r@   s     r&   
test_shapezTestArray.test_shapeG   s    Cb222c"t,,,Cbill!<<<c"t,,,,,r(   c                 F   t          j        d          }t          j        dd          }| j        j                            d||           t          j        dd          }|                     t                    5  | j        j                            d||           d d d            n# 1 swxY w Y   t          j        d          }|                     t                    5  | j        j                            d|d	|
           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r   r      z()i)   )r   rD   r   )r   r   r   r   r   r   r>   
ValueError)r!   r"   r=   s      r&   
test_dtypezTestArray.test_dtypeP   s   Xg	!3'''Ce2666	!3'''z** 	; 	;FL%r:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; Xe__z** 	G 	GFL%t2FFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs$   =#B,,B03B0%$DDDc                     |                      t                    5  | j        j                            dd           d d d            d S # 1 swxY w Y   d S )Nr   r4   r7   )r>   r?   r   r   r   r,   s    r&   test_key_typezTestArray.test_key_type]   s    y)) 	4 	4FL
333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   "A

AAN)__name__
__module____qualname____doc__r'   r-   r2   rB   rE   rJ   rL    r(   r&   r
   r
      s         ) ) )"6 6 6
( ( (; ; ;"- - -G G G4 4 4 4 4r(   r
   )
rP   numpyr    r   r   commonr   r   r
   rQ   r(   r&   <module>rU      s                                L4 L4 L4 L4 L4 L4 L4 L4 L4 L4r(   