o
    “7?e‘  ã                   @   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ÚdatasetZsliced© r   úh/home/www/facesmatcher.com/pyenv/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   ÚnpZ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   r/   )Nr   r   r   éüÿÿÿr2   r	   r   r   r   r   Útest_negative_stop_indexd   r4   z*TestVirtualSource.test_negative_stop_indexc                 C   r/   )Nr   r   r0   r5   r2   r	   r   r   r   r   Ú"test_negative_start_and_stop_indexi   r4   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   éÿÿÿÿr9   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,   r9   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   rC   r@   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 s–w   Y  d S )NÚf1ÚcoreFÚw)ÚnameZdriverZbacking_storeÚmode)r   r   r   ÚaÚbr9   )r   )NrB   )Zdtype)r
   ÚFileÚassertRaisesÚ	TypeErrorr   Úint)r   ZftestrJ   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   rM   ÚRuntimeErrorr   r   r   r   Útest_repeated_slicež   s
   "ÿz%TestVirtualSource.test_repeated_sliceN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r)   r+   r.   r3   r6   r7   r8   r:   r=   r?   rA   rD   rP   rS   r   r   r   r   r      s(    &

r   Ú__main__)
Úcommonr   Zh5pyr
   Únumpyr!   ZTestCaser   rT   Úmainr   r   r   r   Ú<module>   s      ÿ