o
    bi                     @   sF   d dl mZ ddlZddlZG dd dejZedkr!e	  dS dS )   )ut    Nc                   @   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'S )(TestVirtualSourcec                 C   s<   t ddd}|d d d d d d f }| |j|j d S )Ntest      r   h5VirtualSourceassertEqualshapeselfdatasetsliced r   [/home/ubuntu/.local/lib/python3.10/site-packages/h5py/tests/test_vds/test_virtual_source.pytest_full_slice   s   z!TestVirtualSource.test_full_slicec                 C   s6   t ddd}|dd d d d f }| d|j d S Nr   r      )r   r   r	   r   r   r   r   test_integer_indexed   s   z&TestVirtualSource.test_integer_indexedc                 C   s(   t ddd}|d }| d|j d S r   r	   r   r   r   r   test_integer_single_indexed   s   z-TestVirtualSource.test_integer_single_indexedc                 C   s2   t ddd}|dd d df }| d|j d S )Nr   r   r   
   r   r	   r   r   r   r   test_two_integer_indexed    s   z*TestVirtualSource.test_two_integer_indexedc                 C   sH   t ddd}|ddd d d d f }| d|jdd   |j d S )Nr   r   r   r   )r      r	   r   r   r   r   test_single_range%   s    z#TestVirtualSource.test_single_rangec                 C   st   t ddd}g }tdD ]"}|dd| d jd }tddd| d j}|||k q| dt	| d S )	Nr   r   r   r         r   r   )
r
   r   ranger   nparangesizeappendr   sum)r   r   cmpidrefr   r   r   $test_shape_calculation_positive_step*   s   z6TestVirtualSource.test_shape_calculation_positive_stepc                 C   s:   t ddd}|ddd d ddf }| d|j d S )Nr   r   r   r   r      )r   r   r   r	   r   r   r   r   test_double_rangeP   s   z#TestVirtualSource.test_double_rangec                 C   s>   t ddd}|dddd d dddf }| d	|j d S )
Nr   r      r   r   r      r    )r    r   r   r	   r   r   r   r   test_double_strided_rangeU   s   z+TestVirtualSource.test_double_strided_rangec                 C   ,   t ddd}|dd }| d|j d S )Nr   r      r.   r   r   r	   r   r   r   r   test_negative_start_index_      z+TestVirtualSource.test_negative_start_indexc                 C   r1   )Nr   r   r   r4   r	   r   r   r   r   test_negative_stop_indexd   r6   z*TestVirtualSource.test_negative_stop_indexc                 C   r1   )Nr   r   r2   r7   r4   r	   r   r   r   r   "test_negative_start_and_stop_indexi   r6   z4TestVirtualSource.test_negative_start_and_stop_indexc                 C   s*   t ddd}|d }| |j|j d S )Nr   r   .r	   r   r   r   r   test_ellipsiss   s   zTestVirtualSource.test_ellipsisc                 C   s>   t ddd}|dddf }| d|jdd   |j d S )Nr   r   r   r   .r   r	   r   r   r   r   test_ellipsis_endx       z#TestVirtualSource.test_ellipsis_endc                 C   s>   t ddd}|dddf }| |jd d d |j d S )Nr   r   .r   r   r;   r	   r   r   r   r   test_ellipsis_start}   r=   z%TestVirtualSource.test_ellipsis_startc                 C   sH   t ddd}|dddddf }| d|jdd	  d |j d S )
Nr   )r   r   r   (   r   r   .r   r.   r;   r>   r	   r   r   r   r   test_ellipsis_sandwich   s   $z(TestVirtualSource.test_ellipsis_sandwichc                 C   s    t ddd}| |jd d S )Nr   r   r   r	   r   r   r   r   r   test_integer_shape   s   z$TestVirtualSource.test_integer_shapec                 C   s$   t jddddd}| |jd d S )Nr   r   r   maxshaper   )r
   r   r   rE   rB   r   r   r   test_integer_maxshape   s   z'TestVirtualSource.test_integer_maxshapec              	   C   s:  t jddddd}g d|d< |d }| t t |d W d    n1 s*w   Y  | t t j|d	d
 W d    n1 sFw   Y  | t t j|dd W d    n1 sbw   Y  | t t j|td W d    n1 s~w   Y  W d    d S W d    d S 1 sw   Y  d S )Nf1coreFw)namedriverbacking_storemode)r   r   r    abr;   )r   )NrD   )dtype)r
   FileassertRaises	TypeErrorr   int)r   ftestrN   r   r   r   test_extra_args   s*   "z!TestVirtualSource.test_extra_argsc                 C   sl   t ddd}|ddd d d d f }| t |d d d df  W d    d S 1 s/w   Y  d S )Nr   r   r   r      )r
   r   rR   RuntimeErrorr   r   r   r   test_repeated_slice   s
   "z%TestVirtualSource.test_repeated_sliceN)__name__
__module____qualname__r   r   r   r   r   r+   r-   r0   r5   r8   r9   r:   r<   r?   rA   rC   rF   rV   rY   r   r   r   r   r      s(    &

r   __main__)
commonr   h5pyr
   numpyr"   TestCaser   rZ   mainr   r   r   r   <module>   s      