3
½ìœ]!  ã               @   sL   d Z ddlmZ ddlZddlZddlZddlmZm	Z	 G dd„ de	ƒZ
dS )z6
    Tests the h5py.AttributeManager.create() method.
é    )Úabsolute_importNé   )ÚutÚTestCasec               @   s0   e Zd Z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   sv   t jdƒ}t jddd�}| jjjd||d� tjj| jj	dƒ}|j
ƒ }| j|jƒ tjjƒ | jjd }| j||ƒ d S )Nz(3,)ié   Úi)ÚdtypeÚx)Údatar	   ó   x)Únpr	   ZarangeÚfÚattrsÚcreateÚh5pyZh5aÚopenÚidÚget_typeÚassertEqualZ	get_classZh5tÚARRAYZassertArrayEqual)ÚselfÚdtr   ZaidZhtypeÚout© r   ú@/tmp/pip-build-pcqn41bp/h5py/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   sF   | j jjdtjdƒƒ | j jd }| j|tjdƒƒ | j|tjƒ d S )Nr
   i©  )r   r   r   ÚsixÚunichrr   ZassertIsInstanceÚstring_types)r   r   r   r   r   Útest_str2   s    zTestArray.test_strc             C   s’   d}| j jjd|d� | j jd }| jt||kƒƒ | j|jtjdƒƒ tj|ƒ}| j|jtjdƒƒ | j	t
ƒ� | j jjd|d� W d Q R X d S )	NÚaÚbr
   )r   ÚOZU1Úy)r$   r%   )r   r   r   Z
assertTrueÚallr   r	   r   ÚarrayZassertRaisesÚ	TypeError)r   r   ÚresultZdata_as_U_arrayr   r   r   Útest_tuple_of_unicode9   s    
zTestArray.test_tuple_of_unicodeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r#   r,   r   r   r   r   r      s
   r   )r0   Ú
__future__r   r    Znumpyr   r   Úcommonr   r   r   r   r   r   r   Ú<module>   s   