U
    md                     @   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assertEqualZ	get_classr   ZARRAYZassertArrayEqual)selfdtr   ZaidZhtypeout r   Y/home/sam/Atlas/atlas_env/lib/python3.8/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 5 Q R X 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   r5   r   r   )r   r3   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 5 Q R X t d}| t | jjjd|d	|d
 W 5 Q R X d S )Nr	   r
   r   r   r   r      z()i)   )r   r5   r   )r   r   r   r   r   r   r1   
ValueError)r   r   r0   r   r   r   
test_dtypeP   s    

zTestArray.test_dtypec              	   C   s,   |  t | jjjddd W 5 Q R X d S )Nr   r(   r+   )r1   r2   r   r   r   r#   r   r   r   test_key_type]   s    zTestArray.test_key_typeN)__name__
__module____qualname____doc__r    r$   r'   r4   r6   r:   r;   r   r   r   r   r      s   	r   )
r?   numpyr    r   r   commonr   r   r   r   r   r   r   <module>
   s   