B
    d1                 @   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 )Nz(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   R/var/www/html/venv/lib/python3.7/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   *   i8)r   r   )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 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   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 Q R X t d}| t | jjjd|d	|d
 W d Q R X d S )Nz(3,)ir	   r
   )r   r   )r   r      z()i)   )r   r/   r   )r   r   r   r   r   r   r+   
ValueError)r   r   r*   r   r   r   
test_dtypeP   s    

zTestArray.test_dtypeN)
__name__
__module____qualname____doc__r   r    r#   r.   r0   r4   r   r   r   r   r      s   	r   )
r8   numpyr    r   r   commonr   r   r   r   r   r   r   <module>   s   