o
    giR                     @   s0  d Z ddlZddlZddlZddlZddlmZmZm	Z	 G dd deZ
G dd deZG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdd ZG dd deZdd Zejdedejdd  d!D ed"gd#d$ ZG d%d& d&eZdS )'a  
    Tests the h5py.Dataset.__getitem__ method.

    This module does not specifically test type conversion.  The "type" axis
    therefore only tests objects which interact with the slicing system in
    unreliable ways; for example, compound and array types.

    See test_dataset_getitem_types for type-conversion tests.

    Tests are organized into TestCases by dataset shape and type.  Test
    methods vary by slicing arg type.

    1. Dataset shape:
        Empty
        Scalar
        1D
        3D

    2. Type:
        Float
        Compound
        Array

    3. Slicing arg types:
        Ellipsis
        Empty tuple
        Regular slice
        MultiBlockSlice
        Indexing
        Index list
        Boolean mask
        Field names
    N   )utTestCase	make_namec                   @   t   e 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d Zdd Zdd Zdd ZdS )	TestEmptyc                 C   sh   t |  tjtjj}tjj }|	d tj
| jjd||}t|| _ttd| _d S )N
      xS10)r   setUph5pyh5screateNULLh5tC_S1copyset_sizeh5dfidDatasetdsetEmptynpdtype	empty_obj)selfsidtiddsid r!   ]/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/h5py/tests/test_dataset_getitem.pyr   7   s   

zTestEmpty.setUpc                 C      |  | jjd dS  Verify number of dimensions r   NassertEqualr   ndimr   r!   r!   r"   	test_ndim@      zTestEmpty.test_ndimc                 C      |  | jjd dS  Verify shape Nr'   r   shaper)   r!   r!   r"   
test_shapeD   r+   zTestEmpty.test_shapec                 C   r,   r-   r'   r   sizer)   r!   r!   r"   	test_sizeH   r+   zTestEmpty.test_sizec                 C   r#   ) Verify nbytes r   N)r'   r   nbytesr)   r!   r!   r"   test_nbytesL   r+   zTestEmpty.test_nbytesc                 C      |  | jd | j d S N.r'   r   r   r)   r!   r!   r"   test_ellipsisP      zTestEmpty.test_ellipsisc                 C   r8   Nr!   r:   r)   r!   r!   r"   
test_tupleS   r<   zTestEmpty.test_tuplec                 C   >   |  t | jdd  W d   dS 1 sw   Y  dS z slice -> ValueError r      NassertRaises
ValueErrorr   r)   r!   r!   r"   
test_sliceV      "zTestEmpty.test_slicec                 C   >   |  t | jt   W d   dS 1 sw   Y  dS z MultiBlockSlice -> ValueError NrC   rD   r   r   MultiBlockSlicer)   r!   r!   r"   test_multi_block_slice[   rF   z TestEmpty.test_multi_block_slicec                 C   :   |  t | jd  W d   dS 1 sw   Y  dS z index -> ValueError r   NrB   r)   r!   r!   r"   
test_index`      "zTestEmpty.test_indexc                 C   >   |  t | jg d  W d   dS 1 sw   Y  dS  index list -> ValueError r         NrB   r)   r!   r!   r"   test_indexliste   rF   zTestEmpty.test_indexlistc                 C   H   t jddd}| t | j|  W d   dS 1 sw   Y  dS z mask -> ValueError Tboolr   Nr   arrayrC   rD   r   r   maskr!   r!   r"   	test_maskj      "zTestEmpty.test_maskc                 C   rL   )z field name -> ValueError fieldNrB   r)   r!   r!   r"   test_fieldnamesp   rO   zTestEmpty.test_fieldnamesN__name__
__module____qualname__r   r*   r1   r4   r7   r;   r>   rE   rK   rN   rV   r_   rb   r!   r!   r!   r"   r   5   s    	r   c                   @   r   )TestScalarFloatc                 C   s4   t |  tjdtjd| _| jjd| jd| _d S )N     @E@rZ   xdata)	r   r   r   r\   doublerk   r   create_datasetr   r)   r!   r!   r"   r   x      
zTestScalarFloat.setUpc                 C   r#   r$   r&   r)   r!   r!   r"   r*   }   r+   zTestScalarFloat.test_ndimc                 C   r#    Verify size r   Nr2   r)   r!   r!   r"   r4      r+   zTestScalarFloat.test_sizec                 C      |  | jj| jjj dS r5   Nr'   r   r6   rk   r   itemsizer)   r!   r!   r"   r7         zTestScalarFloat.test_nbytesc                 C      |  | jjt  dS r-   r'   r   r0   tupler)   r!   r!   r"   r1         zTestScalarFloat.test_shapec                 C      | j d }| || j dS z Ellipsis -> scalar ndarray .Nr   assertArrayEqualrk   r   outr!   r!   r"   r;         
zTestScalarFloat.test_ellipsisc                 C   s    | j d }| || j  dS )z () -> bare item r!   N)r   r}   rk   itemr~   r!   r!   r"   r>      s   
zTestScalarFloat.test_tuplec                 C   r?   r@   rB   r)   r!   r!   r"   rE      rF   zTestScalarFloat.test_slicec                 C   rG   rH   rI   r)   r!   r!   r"   rK      rF   z&TestScalarFloat.test_multi_block_slicec                 C   rL   rM   rB   r)   r!   r!   r"   rN      rO   zTestScalarFloat.test_indexc                 C   rP   rQ   rB   r)   r!   r!   r"   rV      rF   zTestScalarFloat.test_indexlistc                 C   rW   rX   r[   r]   r!   r!   r"   r_      r`   zTestScalarFloat.test_maskc                 C   rL   z& field name -> ValueError (no fields) ra   NrB   r)   r!   r!   r"   rb      rO   zTestScalarFloat.test_fieldnamesNrd   re   rf   r   r*   r4   r7   r1   r;   r>   rE   rK   rN   rV   r_   rb   r!   r!   r!   r"   rg   v   s    rg   c                   @   r   )TestScalarCompoundc                 C   s6   t |  tjdg dd| _| jjd| jd| _d S )N)rh   iHello))ar   )bi)cz|S10rZ   ri   rj   )r   r   r   r\   rk   r   rm   r   r)   r!   r!   r"   r         
zTestScalarCompound.setUpc                 C   r#   r$   r&   r)   r!   r!   r"   r*      r+   zTestScalarCompound.test_ndimc                 C   rv   r-   rw   r)   r!   r!   r"   r1      ry   zTestScalarCompound.test_shapec                 C   r#   ro   r2   r)   r!   r!   r"   r4      r+   zTestScalarCompound.test_sizec                 C   rq   rr   rs   r)   r!   r!   r"   r7      ru   zTestScalarCompound.test_nbytesc                 C   s@   | j d }| |tj | |j| jj | |j| jj dS r{   )r   assertIsInstancer   ndarrayr'   r0   rk   r   r~   r!   r!   r"   r;      s   
z TestScalarCompound.test_ellipsisc                 C   s.   | j d }| |tj | |j| jj dS )z () -> np.void instance r!   N)r   r   r   voidr'   r   rk   r~   r!   r!   r"   r>         
zTestScalarCompound.test_tuplec                 C   r?   r@   rB   r)   r!   r!   r"   rE      rF   zTestScalarCompound.test_slicec                 C   rG   rH   rI   r)   r!   r!   r"   rK      rF   z)TestScalarCompound.test_multi_block_slicec                 C   rL   rM   rB   r)   r!   r!   r"   rN      rO   zTestScalarCompound.test_indexc                 C   rP   rQ   rB   r)   r!   r!   r"   rV      rF   z!TestScalarCompound.test_indexlistc                 C   rW   )z mask -> ValueError  TrY   rZ   Nr[   r]   r!   r!   r"   r_      r`   zTestScalarCompound.test_maskc                 C   s.   | j d }| |tj | || j d  dS )z field name -> bare value r   N)r   r   r   float32r'   r~   r!   r!   r"   rb      r   z"TestScalarCompound.test_fieldnamesNrc   r!   r!   r!   r"   r      s    r   c                   @   r   )TestScalarArrayc                 C   sP   t |  td| _tjg ddd| _| jjdd| jd| _	| j| j	d< d S )Nz(3,2)f))g	@i)*   g33333X@)gQ	@r   r   rZ   ri   r!   .)
r   r   r   r   dtr\   rk   r   rm   r   r)   r!   r!   r"   r     s
   
zTestScalarArray.setUpc                 C   s$   |  | jjd |  | jjd dS )r%   rT   r   N)r'   rk   r(   r   r)   r!   r!   r"   r*     s   zTestScalarArray.test_ndimc                 C   r#   ro   r2   r)   r!   r!   r"   r4     r+   zTestScalarArray.test_sizec                 C   s   |  | jj| jjj dS rr   )r'   r   r6   r   rt   r)   r!   r!   r"   r7     ru   zTestScalarArray.test_nbytesc                 C   s&   |  | jjd |  | jjt  dS )r.   )   rT   N)r'   rk   r0   r   rx   r)   r!   r!   r"   r1     s   zTestScalarArray.test_shapec                 C   rz   )z2 Ellipsis -> ndarray promoted to underlying shape .Nr|   r~   r!   r!   r"   r;     r   zTestScalarArray.test_ellipsisc                 C   rz   ) () -> same as ellipsis .Nr|   r~   r!   r!   r"   r>   "  r   zTestScalarArray.test_tuplec                 C   r?   r@   rB   r)   r!   r!   r"   rE   '  rF   zTestScalarArray.test_slicec                 C   rG   rH   rI   r)   r!   r!   r"   rK   ,  rF   z&TestScalarArray.test_multi_block_slicec                 C   rL   rM   rB   r)   r!   r!   r"   rN   1  rO   zTestScalarArray.test_indexc                 C   s:   |  t | jg   W d   dS 1 sw   Y  dS )rR   NrB   r)   r!   r!   r"   rV   6  rO   zTestScalarArray.test_indexlistc                 C   rW   rX   r[   r]   r!   r!   r"   r_   ;  r`   zTestScalarArray.test_maskc                 C   rL   r   rB   r)   r!   r!   r"   rb   A  rO   zTestScalarArray.test_fieldnamesNr   r!   r!   r!   r"   r     s    r   c                   @   sd   e 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d Zdd ZdS )Test1DZeroFloatc                 C   2   t |  tjddd| _| jjd| jd| _d S )Nr   r   rZ   ri   rj   r   r   r   onesrk   r   rm   r   r)   r!   r!   r"   r   I     
zTest1DZeroFloat.setUpc                 C   r#   r%   r   Nr&   r)   r!   r!   r"   r*   N  r+   zTest1DZeroFloat.test_ndimc                 C   r#   )r.   r   Nr/   r)   r!   r!   r"   r1   R  r+   zTest1DZeroFloat.test_shapec                 C      |  | j| jtjd  dS )z' Ellipsis -> ndarray of matching shape .NassertNumpyBehaviorr   rk   r   s_r)   r!   r!   r"   r;   V     zTest1DZeroFloat.test_ellipsisc                 C   r   )r   r!   Nr   r)   r!   r!   r"   r>   Z  r   zTest1DZeroFloat.test_tuplec                 C   s    |  | j| jtjdd  dS )z  slice -> ndarray of shape (0,) r   rA   Nr   r)   r!   r!   r"   rE   ^  s    zTest1DZeroFloat.test_slicec                 C       |  | j| jtjdd  d S N   rU   r   r)   r!   r!   r"   test_slice_stop_less_than_startb      z/Test1DZeroFloat.test_slice_stop_less_than_startc                 C   rL   )z index -> out of range r   NrC   
IndexErrorr   r)   r!   r!   r"   rN   e  rO   zTest1DZeroFloat.test_indexc                 C   s   |  | j| jtjg   dS )z index list Nr   r)   r!   r!   r"   rV   j  r   zTest1DZeroFloat.test_indexlistc                 C   s.   t jddd}| j| j| jt j| dd dS )z# mask -> ndarray of matching shape r   rY   rZ   Tskip_fast_readerN)r   r   r   r   rk   r   r]   r!   r!   r"   r_   n  s   
zTest1DZeroFloat.test_maskc                 C   rL   r   rB   r)   r!   r!   r"   rb   y  rO   zTest1DZeroFloat.test_fieldnamesN)rd   re   rf   r   r*   r1   r;   r>   rE   r   rN   rV   r_   rb   r!   r!   r!   r"   r   G  s    r   c                   @   s$  e 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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'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;d< Z d=d> Z!d?d@ Z"dAdB Z#dCdD Z$dEdF Z%dGS )HTest1DFloatc                 C   s4   t |  tdd| _| jjd| jd| _d S )N2   r   ri   rj   )	r   r   r   arangeastyperk   r   rm   r   r)   r!   r!   r"   r     rn   zTest1DFloat.setUpc                 C   r#   r   r&   r)   r!   r!   r"   r*     r+   zTest1DFloat.test_ndimc                 C   r#   )r.   )r   Nr/   r)   r!   r!   r"   r1     r+   zTest1DFloat.test_shapec                 C      |  | j| jtjd  d S r9   r   r)   r!   r!   r"   r;        zTest1DFloat.test_ellipsisc                 C   r   r=   r   r)   r!   r!   r"   r>     r   zTest1DFloat.test_tuplec                 C   r   )Nr   rA   r   r)   r!   r!   r"   test_slice_simple  r   zTest1DFloat.test_slice_simplec                 C   s    |  | j| jtjdd  d S )NrA   r   r)   r!   r!   r"   test_slice_zerosize  r   zTest1DFloat.test_slice_zerosizec                 C   "   |  | j| jtjddd  d S )Nr   r   r   r   r)   r!   r!   r"   test_slice_strides     "zTest1DFloat.test_slice_stridesc                 C   r   )Nir   r   r)   r!   r!   r"   test_slice_negindexes  r   z!Test1DFloat.test_slice_negindexesc                 C   r   r   r   r)   r!   r!   r"   r     r   z+Test1DFloat.test_slice_stop_less_than_startc                 C   r   )Nd   i  r   r   r)   r!   r!   r"   test_slice_outofrange  r   z!Test1DFloat.test_slice_outofrangec                 C   s@   |  t | jddd  W d   dS 1 sw   Y  dS )z we disallow negative steps NrB   r)   r!   r!   r"   test_slice_backwards  s   "z Test1DFloat.test_slice_backwardsc                 C   s"   |  | j| jtjd d d  d S )Nr   r   r)   r!   r!   r"   test_slice_zerostride  r   z!Test1DFloat.test_slice_zerostridec                 C   r   )Nr   r   r)   r!   r!   r"   test_index_simple  r   zTest1DFloat.test_index_simplec                 C   r   )Nr   r)   r!   r!   r"   test_index_neg  r   zTest1DFloat.test_index_negc                 C   s:   |  t | jd   W d    d S 1 sw   Y  d S NrC   	TypeErrorr   r)   r!   r!   r"   test_index_none     "zTest1DFloat.test_index_nonec                 C   s:   |  t | ji   W d   dS 1 sw   Y  dS )z Illegal slicing argument Nr   r)   r!   r!   r"   test_index_illegal  rO   zTest1DFloat.test_index_illegalc                 C   s:   |  t | jd  W d    d S 1 sw   Y  d S Nr   r   r)   r!   r!   r"   test_index_outofrange  r   z!Test1DFloat.test_index_outofrangec                 C   s    |  | j| jtjg d  d S NrS   r   r)   r!   r!   r"   test_indexlist_simple  r   z!Test1DFloat.test_indexlist_simplec              	   C   s&   |  | j| jtjtg d  d S r   r   r   rk   r   r   r\   r)   r!   r!   r"   test_indexlist_numpyarray  s   &z%Test1DFloat.test_indexlist_numpyarrayc              	   C   s$   |  | j| jtjtddd  d S )Nr   r   rT   r   r   rk   r   r   ranger)   r!   r!   r"   test_indexlist_long  s   $zTest1DFloat.test_indexlist_longc                 C   s"   |  | j| jtjdgdf  d S Nr   .r   r)   r!   r!   r"   $test_indexlist_single_index_ellipsis  r   z0Test1DFloat.test_indexlist_single_index_ellipsisc                 C   s(   |  | j| jtjtdgdf  d S r   r   r)   r!   r!   r"   /test_indexlist_numpyarray_single_index_ellipsis  s   (z;Test1DFloat.test_indexlist_numpyarray_single_index_ellipsisc              	   C   s(   |  | j| jtjtddddf  d S )Nr   r   rT   .r   r)   r!   r!   r"   test_indexlist_long_ellipsis     (z(Test1DFloat.test_indexlist_long_ellipsisc              	   C   s*   |  | j| jtjtg ddf  d S )NrS   .r   r)   r!   r!   r"   "test_indexlist_numpyarray_ellipsis  s   *z.Test1DFloat.test_indexlist_numpyarray_ellipsisc                 C   s   |  | j| jtjg   d S r   r   r)   r!   r!   r"   test_indexlist_empty  r   z Test1DFloat.test_indexlist_emptyc                 C   s<   |  t | jdg  W d    d S 1 sw   Y  d S r   r   r)   r!   r!   r"   test_indexlist_outofrange  s   "z%Test1DFloat.test_indexlist_outofrangec                 C   rP   )z8 we require index list values to be strictly increasing )r   r   rT   Nr   r)   r!   r!   r"   test_indexlist_nonmonotonic  rF   z'Test1DFloat.test_indexlist_nonmonotonicc                 C   sZ   |  | j| jtjg d  | t | jddg  W d    d S 1 s&w   Y  d S )N)r   rT   r   r   )r   r   rk   r   r   rC   r   r)   r!   r!   r"   !test_indexlist_monotonic_negative  s   "z-Test1DFloat.test_indexlist_monotonic_negativec                 C   rP   )z! we forbid repeated index values )r   r   rT   Nr   r)   r!   r!   r"   test_indexlist_repeated  rF   z#Test1DFloat.test_indexlist_repeatedc                 C   &   | j | j| jtj| jdk dd d S )NiTr   r   r)   r!   r!   r"   test_mask_true     
zTest1DFloat.test_mask_truec                 C   r   )Nr   Tr   r   r)   r!   r!   r"   test_mask_false  r   zTest1DFloat.test_mask_falsec                 C   r   )NrU   Tr   r   r)   r!   r!   r"   test_mask_partial  r   zTest1DFloat.test_mask_partialc                 C   sD   |  t | jtjddd  W d   dS 1 sw   Y  dS )z4 we require the boolean mask shape to match exactly )rT   rY   rZ   N)rC   r   r   r   r   r)   r!   r!   r"   test_mask_wrongsize  s   "zTest1DFloat.test_mask_wrongsizec                 C   rL   r   rB   r)   r!   r!   r"   rb     rO   zTest1DFloat.test_fieldnamesN)&rd   re   rf   r   r*   r1   r;   r>   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   r!   r!   r!   r"   r     sH    			r   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
Test2DZeroFloatc                 C   r   )Nr   r   r   rZ   ri   rj   r   r)   r!   r!   r"   r     r   zTest2DZeroFloat.setUpc                 C   r#   r%   rT   Nr&   r)   r!   r!   r"   r*     r+   zTest2DZeroFloat.test_ndimc                 C   r#   )r.   r   Nr/   r)   r!   r!   r"   r1   "  r+   zTest2DZeroFloat.test_shapec                 C   (   |  | j| jtjddg df  dS z see issue #473 N)r   r   rT   r   r)   r!   r!   r"   rV   &  r   zTest2DZeroFloat.test_indexlistN)rd   re   rf   r   r*   r1   rV   r!   r!   r!   r"   r     s
    r   c                   @   sD   e 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 )Test2DFloatc                 C   r   )NrU   r   r   rZ   ri   rj   r   r)   r!   r!   r"   r   -  r   zTest2DFloat.setUpc                 C   r#   r   r&   r)   r!   r!   r"   r*   2  r+   zTest2DFloat.test_ndimc                 C   r#   )rp      Nr2   r)   r!   r!   r"   r4   6  r+   zTest2DFloat.test_sizec                 C   s   |  | jjd| jjj  dS )r5   r   Nrs   r)   r!   r!   r"   r7   :  s   zTest2DFloat.test_nbytesc                 C   r#   )r.   r   Nr/   r)   r!   r!   r"   r1   >  r+   zTest2DFloat.test_shapec                 C   r   r   r   r)   r!   r!   r"   rV   B  r   zTest2DFloat.test_indexlistc                 C   s<   |  | j| jtjd d g f  |  | j| jtjg   d S r   r   r)   r!   r!   r"   test_index_emptylistF  s    z Test2DFloat.test_index_emptylistN)
rd   re   rf   r   r*   r4   r7   r1   rV   r   r!   r!   r!   r"   r   +  s    r   c                   @   s.   e Zd Zdd Zeejdk ddd ZdS )TestVeryLargeArrayc                 C   s"   t |  | jjdddd| _d S )Nri   )i   i   f4)r0   r   )r   r   r   rm   r   r)   r!   r!   r"   r   M  s   
zTestVeryLargeArray.setUp        z&Maximum integer size >= 2**31 requiredc                 C   s   |  | jjd d S )Nr   r2   r)   r!   r!   r"   r4   Q  r+   zTestVeryLargeArray.test_sizeN)	rd   re   rf   r   r   skipIfsysmaxsizer4   r!   r!   r!   r"   r   K  s    r   c              
   C   s|   t jt jj}|d |t jj t t j| j	t
 dt jjt jd|}tj|d d tdtj d S )Nr   zutf-8)rU   r   )r   h5pr   DATASET_CREATE	set_chunkset_fill_timer   FILL_TIME_NEVERr   r   r   encoder   
IEEE_F64LEr   create_simpler   testingassert_array_equalzerosfloat64)writable_filedcpldsr!   r!   r"   test_read_no_fill_valueV  s   



$r   c                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )TestBoolIndexz0
    Tests for indexing with Boolean arrays
    c                    s6   t    tddd| _| jjd| jd| _d S )N	   r   r   ri   rj   )	superr   r   r   reshapearrr   rm   r   r)   	__class__r!   r"   r   k  r   zTestBoolIndex.setUpc                 C   s,   t jg dd d f }| | j| j| d S )N)FTF)r   r   r   r   r  r   selr!   r!   r"   test_select_first_axisp  s   z$TestBoolIndex.test_select_first_axisc                 C   sP   t jg dd d f }| t | j|  W d    d S 1 s!w   Y  d S )N)FTFF)r   r   rC   r   r   r  r!   r!   r"   test_wrong_sizet  s   "zTestBoolIndex.test_wrong_size)rd   re   rf   __doc__r   r	  r
  __classcell__r!   r!   r  r"   r   g  s
    r   c                 C   s\   | j t tdd}tjtdd |tjd d f  W d    d S 1 s'w   Y  d S )NrU   rj   newaxis)match)rm   r   r   r   pytestraisesr   r  )r   r   r!   r!   r"   test_error_newaxisz  s   "r  r  r  c                 C   s   g | ]}|  qS r!   )r   ).0sr!   r!   r"   
<listcomp>  s    r  	abcdefghirZ   c                 C   sp   | dd}t }|| |< | | }tg d}tj|| ||  tj||ddf ||ddf  dS )z(https://github.com/h5py/h5py/issues/2674r   )TFTN)r  r   r   r\   r   r   )r   r  namer   r  r!   r!   r"   test_bool_selection_1d  s   *r  c                       s@   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Z  Z	S )%TestZeroSizeSelectionResizableDatasetzh
    Tests for indexing of zero Resizable Datasets
    see https://github.com/h5py/h5py/issues/2549
    c                    s:   t    | jjddddd| _| jjddddd| _d S )Nri   r   r   r   )maxshapeyr   )r  r   r   rm   dset0dset1r)   r  r!   r"   r     s   
z+TestZeroSizeSelectionResizableDataset.setUpc                 C   s@   t jd d  }d| j|< t jg t jd| _| | j| j| d S )Nr   rZ   )r   r   r  r\   r   r  r   r  r!   r!   r"   test_set_with_scalar     
z:TestZeroSizeSelectionResizableDataset.test_set_with_scalarc                 C   sR   t jd d  }| jtdd t d| j|< W d    d S 1 s"w   Y  d S )NCan't broadcast (4,) -> (0,)msgrA   )r   r   rC   r   r   r  r  r!   r!   r"   test_set_with_array     "z9TestZeroSizeSelectionResizableDataset.test_set_with_arrayc                 C   s@   t jdd }d| j|< t jg t jd| _| | j| j| d S )Nr   r   rZ   )r   r   r  r\   r   r  r   r  r!   r!   r"   test_set_zerosel_with_scalar  r  zBTestZeroSizeSelectionResizableDataset.test_set_zerosel_with_scalarc                 C   sR   t jdd }| jtdd t d| j|< W d    d S 1 s"w   Y  d S )Nr   r  r   rA   )r   r   rC   r   r   r  r  r!   r!   r"   test_set_zerosel_with_array  r#  zATestZeroSizeSelectionResizableDataset.test_set_zerosel_with_array)
rd   re   rf   r  r   r  r"  r$  r%  r  r!   r!   r  r"   r    s    r  )r  r   numpyr   r  r   commonr   r   r   r   rg   r   r   r   r   r   r   r   r   r   r  markparametrizer   r\   objectr  r  r!   r!   r!   r"   <module>   s6   	"ACIE8  
