
    1Vh                     x    d dl mZ ddlZddlZ G d dej                        Zedk(  r ej                          yy)   )ut    Nc                   ~    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 Zd Zd Zd Zd Zd Zd Zd Zd Zy)TestVirtualSourcec                     t        j                  ddd      }|d d d d d d f   }| j                  |j                  |j                         y )Ntest      r   h5VirtualSourceassertEqualshapeselfdatasetsliceds      W/home/dcms/DCMS/lib/python3.12/site-packages/h5py/tests/test_vds/test_virtual_source.pytest_full_slicez!TestVirtualSource.test_full_slice   s=    ""6&<1Qv||4    c                     t        j                  ddd      }|dd d d d f   }| j                  d|j                         y Nr   r	      )r   r   r   r   s      r   test_integer_indexedz&TestVirtualSource.test_integer_indexed   s9    ""6&<1Q.r   c                 t    t        j                  ddd      }|d   }| j                  d|j                         y r   r   r   s      r   test_integer_single_indexedz-TestVirtualSource.test_integer_single_indexed   s3    ""6&<.r   c                 ~    t        j                  ddd      }|dd d df   }| j                  d|j                         y )Nr   r	   r   
   r   r   r   s      r   test_two_integer_indexedz*TestVirtualSource.test_two_integer_indexed    s9    ""6&<1Rv||,r   c                     t        j                  ddd      }|ddd d d d f   }| j                  d|j                  dd  z   |j                         y )Nr   r	   r   r   )r      r   r   s      r   test_single_rangez#TestVirtualSource.test_single_range%   sN    ""6&<2a"gmmAB//=r   c                 4   t        j                  ddd      }g }t        d      D ]V  }|dd|z   d   j                  d   }t	        j
                  d      dd|z   d   j                  }|j                  ||k(         X | j                  dt        |             y )	Nr   r
   r   r         r   r
   )
r   r   ranger   nparangesizeappendr   sum)r   r   cmpidrefs         r   $test_shape_calculation_positive_stepz6TestVirtualSource.test_shape_calculation_positive_step*   s    ""6&7q 	A"Q$q!''*A))B-"Q$q)..CJJsAv	 	CH%r   c                     t        j                  ddd      }|ddd d ddf   }| j                  d|j                         y )Nr   r	   r   r   r
      )r   r   r   r   r   s      r   test_double_rangez#TestVirtualSource.test_double_rangeP   sB    ""6&<2a2&&,,/r   c                     t        j                  ddd      }|dddd d dddf   }| j                  d	|j                         y )
Nr   r	      r'   r   r
      r(   )r(   r   r   r   r   s      r   test_double_strided_rangez+TestVirtualSource.test_double_strided_rangeU   sG    ""6&<2a"R')*6<<0r   c                 t    t        j                  ddd      }|dd }| j                  d|j                         y )Nr   r	      r8   r   r   r   r   s      r   test_negative_start_indexz+TestVirtualSource.test_negative_start_index_   5    ""6&<R6<<0r   c                 t    t        j                  ddd      }|dd }| j                  d|j                         y )Nr   r	   r   r>   r   r   s      r   test_negative_stop_indexz*TestVirtualSource.test_negative_stop_indexd   s5    ""6&<B6<<0r   c                 t    t        j                  ddd      }|dd }| j                  d|j                         y )Nr   r	   r<   rB   r>   r   r   s      r   "test_negative_start_and_stop_indexz4TestVirtualSource.test_negative_start_and_stop_indexi   r@   r   c                     t        j                  ddd      }|d   }| j                  |j                  |j                         y )Nr   r	   .r   r   s      r   test_ellipsiszTestVirtualSource.test_ellipsiss   s7    ""6&<v||4r   c                     t        j                  ddd      }|dddf   }| j                  d|j                  dd  z   |j                         y )Nr   r	   r   r#   .r#   r   r   s      r   test_ellipsis_endz#TestVirtualSource.test_ellipsis_endx   sL    ""6&<1S!gmmAB//=r   c                     t        j                  ddd      }|dddf   }| j                  |j                  d d dz   |j                         y )Nr   r	   .r   r#   rI   r   r   s      r   test_ellipsis_startz%TestVirtualSource.test_ellipsis_start}   sL    ""6&<QqS!s+D0>r   c                     t        j                  ddd      }|dddddf   }| j                  d|j                  dd	 z   dz   |j                         y )
Nr   )r
   r   r   (   r   r#   .r   r8   rI   rL   r   r   s      r   test_ellipsis_sandwichz(TestVirtualSource.test_ellipsis_sandwich   sW    ""6&?1S1%gmmAb11$6v||Dr   c                 j    t        j                  ddd      }| j                  |j                  d       y )Nr   r
   r&   r   r   r   s     r   test_integer_shapez$TestVirtualSource.test_integer_shape   s*    ""6&"5.r   c                 n    t        j                  dddd      }| j                  |j                  d       y )Nr   r
   r   maxshaper    )r   r   r   rV   rR   s     r   test_integer_maxshapez'TestVirtualSource.test_integer_maxshape   s.    ""6&"rB))51r   c                    t        j                  dddd      5 }g d|d<   |d   }| j                  t              5  t        j                  |d       d d d        | j                  t              5  t        j                  |d	
       d d d        | j                  t              5  t        j                  |d       d d d        | j                  t              5  t        j                  |t
               d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   cxY w# 1 sw Y   6xY w# 1 sw Y   y xY w)Nf1coreFw)namedriverbacking_storemode)r#   r   r(   abrI   )r   )NrU   )dtype)r   FileassertRaises	TypeErrorr   int)r   ftestr`   s      r   test_extra_argsz!TestVirtualSource.test_extra_args   s   WW$v#(s4 	/7<"E#Jc
A""9- )  C()""9- 1  %01""9- 6  W56""9- /  #./	/ 	/
) )1 16 6/ /	/ 	/sj   "D7DD70DD7%D=D7D+6D7D	D7D	D7D(	$D7+D4	0D77E c                     t        j                  ddd      }|ddd d d d f   }| j                  t              5  |d d d df    d d d        y # 1 sw Y   y xY w)Nr   r	   r   r      )r   r   rd   RuntimeErrorr   s      r   test_repeated_slicez%TestVirtualSource.test_repeated_slice   s\    ""66<@2q!$|, 	1bqb5M	 	 	s   AAN)__name__
__module____qualname__r   r   r   r!   r$   r3   r6   r:   r?   rC   rE   rG   rJ   rM   rP   rS   rW   rh   rl    r   r   r   r      sc    5/
/
-
>
&L0
11
1
15
>
?
E
/2/r   r   __main__)
commonr   h5pyr   numpyr*   TestCaser   rm   mainrp   r   r   <module>rw      s;      \ \~ zBGGI r   