a
    v=ic1                     @   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                   @   s@   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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assertEqualZ	get_classr   ARRAYZassertArrayEqual)selfdtr   ZaidZhtypeout r   q/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/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   Z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    n1 s0    Y  d S )N)abr   )r   OZU1y)r   r   r   
assertTrueallr   r   r   arrayassertRaises	TypeError)r   r   resultZ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   r+   r
   )r
   )r   r   r   r   r3   r   r   )r   r1   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 sn0    Y  t d}| t& | jjjd|d	|d
 W d    n1 s0    Y  d S )Nr	   r
   r   r   r   r      z()i)   )r   r3   r   )r   r   r   r   r   r   r/   
ValueError)r   r   r.   r   r   r    
test_dtypeP   s    
2
zTestArray.test_dtypeN)
__name__
__module____qualname____doc__r!   r$   r'   r2   r4   r8   r   r   r   r    r      s   	r   )
r<   numpyr    r   r   commonr   r   r   r   r   r   r    <module>
   s   