
    1Vh                     F    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	y)	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
y	)
	TestArrayzG
        Check that top-level array types can be created and read.
    c                    t        j                  d      }t        j                  dd      }| j                  j                  j                  d||       t        j                  | j                  j                  d      }|j                         }| j                  |j                         t        j                         | j                  j                  d   }| j                  ||       y )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         P/home/dcms/DCMS/lib/python3.12/site-packages/h5py/tests/test_attribute_create.pytest_intzTestArray.test_int   s     XXgyy#&Cd"5hhtvvyy$'*CII6ffll3c4(    c                 T    | j                   j                  j                  ddd       y )Nr   *   i8r   )r   r   r   r!   s    r&   test_string_dtypezTestArray.test_string_dtype*   s!     	Cb5r(   c                     | j                   j                  j                  dt        d             | j                   j                  d   }| j	                  |t        d             | j                  |t               y )Nr   i  )r   r   r   chrr   assertIsInstancestr)r!   r%   s     r&   test_strzTestArray.test_str/   sT    CV-ffll3c&k*c3'r(   c                 J   d}| j                   j                  j                  d|       | j                   j                  d   }| j                  t	        ||k(               | j                  |j                  t        j                  d             t        j                  |      }| j                  |j                  t        j                  d             | j                  t              5  | j                   j                  j                  d|       d d d        y # 1 sw Y   y xY w)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   s     Cd+c"FdN+,rxx}5
 ((4...?y) 	;FFLL/:	; 	; 	;s   ((DD"c                    | j                   j                  j                  ddd       | j                   j                  d   }| j                  |j                  d       | j                   j                  j                  dt        j                  d      d       | j                   j                  d   }| j                  |j                  d       y )	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c"t,Cbiil!<c"t,r(   c                 N   t        j                  d      }t        j                  dd      }| j                  j                  j                  d||       t        j                  dd      }| j                  t              5  | j                  j                  j                  d||       d d d        t        j                  d      }| j                  t              5  | j                  j                  j                  d|d	|
       d d d        y # 1 sw Y   fxY w# 1 sw Y   y xY w)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    XXg		!3'Ce26		!3'z* 	;FFLL%r:	; XXe_z* 	GFFLL%t2F	G 	G		; 	;	G 	Gs   )D*DDD$c                     | j                  t              5  | j                  j                  j	                  dd       d d d        y # 1 sw Y   y xY w)Nr   r4   r7   )r>   r?   r   r   r   r,   s    r&   test_key_typezTestArray.test_key_type]   s@    y) 	4FFLL
3	4 	4 	4s   (AAN)__name__
__module____qualname____doc__r'   r-   r2   rB   rE   rJ   rL    r(   r&   r
   r
      s+    )"6
(;"-G4r(   r
   )
rP   numpyr    r   r   commonr   r   r
   rQ   r(   r&   <module>rU      s#       L4 L4r(   