o
    gim                     @   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   )TestCase	make_namec                   @   sX   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d Zdd ZdS )	TestArrayzG
        Check that top-level array types can be created and read.
    c                 C   s~   t  }td}tjddd}| jjj|||d t| jj	|
d}| }| | tj | jj| }| || d S )N(3,)i   idtypedatar   zutf-8)r   npr   arangefattrscreater   openidencodeget_typeassertEqual	get_classr   ARRAYassertArrayEqual)selfnamedtr   aidhtypeout r#   ^/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/h5py/tests/test_attribute_create.pytest_int   s   
zTestArray.test_intc                 C   s   | j jjt ddd d S )N*   i8r   )r   r   r   r   r   r#   r#   r$   test_string_dtype*   s   zTestArray.test_string_dtypec                 C   sF   t  }| jj|td | jj| }| |td | |t d S )Ni  )r   r   r   r   chrr   assertIsInstancestr)r   r   r"   r#   r#   r$   test_str/   s
   zTestArray.test_strc                 C   sR   t  }d}| jjj||d | jj| }| t||k | |jtd d S )Nabr   O)	r   r   r   r   
assertTrueallr   r   r   )r   r   r   resultr#   r#   r$   test_tuple_of_unicode7   s   zTestArray.test_tuple_of_unicodec                 C   sT   t jddgdd}| t | jjjd|d W d    d S 1 s#w   Y  d S )Nr/   r0   U1r   xr1   )r   arrayassertRaises	TypeErrorr   r   r   )r   r   r#   r#   r$   test_unicode_np_arrayA   s   "zTestArray.test_unicode_np_arrayc                 C   s8   t  }| jjj|ddd | jj| }| |jd d S )Nr&   r   r   shape)r   )r   r   r   r   r   r>   r   r   r5   r#   r#   r$   test_shape_scalarI   s   zTestArray.test_shape_scalarc                 C   s>   t  }| jjj|tddd | jj| }| |jd d S )Nr
   r=   )r
   )r   r   r   r   r   r   r   r>   r?   r#   r#   r$   test_shape_arrayO   s   zTestArray.test_shape_arrayc                 C   s   t d}t jddd}| jjjt ||d t jddd}| t | jjjd||d W d    n1 s8w   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      r8   z()i)   )r   r>   r   )	r   r   r   r   r   r   r   r:   
ValueError)r   r   r9   r#   r#   r$   
test_dtypeU   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   )r:   r;   r   r   r   r(   r#   r#   r$   test_key_typeb   s   "zTestArray.test_key_typeN)__name__
__module____qualname____doc__r%   r)   r-   r6   r<   r@   rA   rE   rF   r#   r#   r#   r$   r      s    
r   )
rJ   numpyr    r   r   commonr   r   r   r#   r#   r#   r$   <module>   s
   	