o
    bi                     @   s@   d Z ddlZddlmZmZ ddlmZmZ G dd deZ	dS )	z6
    Tests the h5py.AttributeManager.create() method.
    N   )h5th5a   )utTestCasec                   @   sH   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dS )	TestArrayzG
        Check that top-level array types can be created and read.
    c                 C   sr   t d}t jddd}| jjjd||d t| 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out r#   T/home/ubuntu/.local/lib/python3.10/site-packages/h5py/tests/test_attribute_create.pytest_int   s   
zTestArray.test_intc                 C   s   | j jjdddd d S )Nr   *   i8r   )r   r   r   r   r#   r#   r$   test_string_dtype*   s   zTestArray.test_string_dtypec                 C   s@   | j jdtd | j jd }| |td | |t d S )Nr   i  )r   r   r   chrr   assertIsInstancestr)r   r"   r#   r#   r$   test_str/   s   zTestArray.test_strc                 C   s   d}| j jjd|d | j jd }| t||k | |jtd t|}| |jtd | 	t
 | j jjd|d W d    d S 1 sMw   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_arrayr#   r#   r$   test_tuple_of_unicode6   s   
"zTestArray.test_tuple_of_unicodec                 C   sf   | j jjdddd | j jd }| |jd | j jjdtddd | j jd }| |jd d S )	Nr   r&   r   )r   shape)r   r4   r
   )r
   )r   r   r   r   r=   r   r   )r   r:   r#   r#   r$   
test_shapeG   s   zTestArray.test_shapec                 C   s   t d}t jddd}| jjjd||d t jddd}| t | jjjd||d W d    n1 s7w   Y  t d}| t | jjjd|d	|d
 W d    d S 1 s]w   Y  d S )Nr	   r
   r   r   r   r      z()i)   )r   r=   r   )r   r   r   r   r   r   r8   
ValueError)r   r   r7   r#   r#   r$   
test_dtypeP   s   

"zTestArray.test_dtypec                 C   sB   |  t | jjjddd W d    d S 1 sw   Y  d S )Nr   r.   r1   )r8   r9   r   r   r   r(   r#   r#   r$   test_key_type]   s   "zTestArray.test_key_typeN)__name__
__module____qualname____doc__r%   r)   r-   r<   r>   rB   rC   r#   r#   r#   r$   r      s    	r   )
rG   numpyr    r   r   commonr   r   r   r#   r#   r#   r$   <module>   s
   	