
    jm                     N    d Z ddlZddlmZmZ ddlmZmZ  G d de          Z	dS )	z6
    Tests the h5py.AttributeManager.create() method.
    N   )h5th5a   )TestCase	make_namec                   H    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )	TestArrayzG
        Check that top-level array types can be created and read.
    c                    t                      }t          j        d          }t          j        dd          }| j        j                            |||           t          j        | 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outs          c/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/h5py/tests/test_attribute_create.pytest_intzTestArray.test_int   s    {{Xgy#&&&Dt2666htvy$++g"6"677**CI666fl4 c4(((((    c                 b    | j         j                            t                      dd           d S )N*   i8r   )r   r   r   r   r    s    r&   test_string_dtypezTestArray.test_string_dtype*   s-     	IKKb=====r(   c                    t                      }| j        j                            |t	          d                     | j        j        |         }|                     |t	          d                     |                     |t                     d S )Ni  )r   r   r   r   chrr   assertIsInstancestr)r    r!   r%   s      r&   test_strzTestArray.test_str/   sq    {{D#f++...fl4 c&kk***c3'''''r(   c                 2   t                      }d}| j        j                            ||           | j        j        |         }|                     t          ||k                         |                     |j        t          j        d                     d S )Nabr   O)	r   r   r   r   
assertTrueallr   r   r   )r    r!   r   results       r&   test_tuple_of_unicodezTestArray.test_tuple_of_unicode7   s     {{Dt,,,d#FdN++,,,rx}}55555r(   c                     t          j        ddgd          }|                     t                    5  | j        j                            d|           d d d            d S # 1 swxY w Y   d S )Nr5   r6   U1r   xr7   )r   arrayassertRaises	TypeErrorr   r   r   )r    r   s     r&   test_unicode_np_arrayzTestArray.test_unicode_np_arrayA   s     xc
$///y)) 	0 	0FL$///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s   "A""A&)A&c                     t                      }| j        j                            |dd           | j        j        |         }|                     |j        d           d S )Nr*   r   r   shape)r   )r   r   r   r   r   rF   r    r!   r;   s      r&   test_shape_scalarzTestArray.test_shape_scalarI   sV    {{Dr333d#t,,,,,r(   c                     t                      }| j        j                            |t	          j        d          d           | j        j        |         }|                     |j        d           d S )Nr   rE   )r   )r   r   r   r   r   r   r   rF   rG   s      r&   test_shape_arrayzTestArray.test_shape_arrayO   s^    {{Dry||1===d#t,,,,,r(   c                 ^   t          j        d          }t          j        dd          }| j        j                            t                      ||           t          j        dd          }|                     t                    5  | j        j                            d||           d d d            n# 1 swxY w Y   t          j        d          }|                     t                    5  | j        j                            d|d	|
           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r      r?   z()i)   )r   rF   r   )	r   r   r   r   r   r   r   rA   
ValueError)r    r"   r@   s      r&   
test_dtypezTestArray.test_dtypeU   s   Xg	!3'''IKKe2>>>	!3'''z** 	; 	;FL%r:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; Xe__z** 	G 	GFL%t2FFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs$   	#B88B<?B<1$D""D&)D&c                     |                      t                    5  | j        j                            dd           d d d            d S # 1 swxY w Y   d S )Nr   r4   r7   )rA   rB   r   r   r   r,   s    r&   test_key_typezTestArray.test_key_typeb   s    y)) 	4 	4FL
333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   "A

AAN)__name__
__module____qualname____doc__r'   r-   r2   r<   rC   rH   rJ   rO   rQ    r(   r&   r
   r
      s         ) ) )"> > >
( ( (6 6 60 0 0- - -- - -G G G4 4 4 4 4r(   r
   )
rU   numpyr    r   r   commonr   r   r
   rV   r(   r&   <module>rZ      s                 ' ' ' ' ' ' ' 'Q4 Q4 Q4 Q4 Q4 Q4 Q4 Q4 Q4 Q4r(   