σ
\c           @@  sΒ   d  d l  m Z d  d l Z d  d l Z d d l m Z m Z d  d l m	 Z	 m
 Z
 m Z d  d l Z d e f d     YZ d e f d	     YZ d
 e f d     YZ d e f d     YZ d S(   i    (   t   absolute_importNi   (   t   utt   TestCase(   t   Filet   Groupt   Datasett   BaseDatasetc           B@  s    e  Z d  Z d   Z d   Z RS(   sP  
    data is a 3-dimensional dataset with dimensions [z, y, x]

    The z dimension is labeled. It does not have any attached scales.
    The y dimension is not labeled. It has one attached scale.
    The x dimension is labeled. It has two attached scales.

    data2 is a 3-dimensional dataset with no associated dimension scales.
    c         C@  sΔ  t  |  j   d  |  _ t j d d  |  j d <t j d d  |  j d <t j d d  |  j d <t j j |  j d j  t j j	 |  j d j |  j d j d  t j d d  |  j d	 <t j j |  j d	 j d
  t j j	 |  j d j |  j d	 j d  t j d d  |  j d <t j j |  j d j d  t j j	 |  j d j |  j d j d  t j d d  |  j d <t j j
 |  j d j d d  t j j
 |  j d j d d  d  S(   Nt   wi   i   i   t   ft   datat   data2t   x1t   x2s   x2 namet   y1s   y1 namei   t   z1i    t   zt   x(   i   i   i   (   i   i   i   (   R   t   mktempR   t   npt   onest   h5pyt   h5dst	   set_scalet   idt   attach_scalet	   set_label(   t   self(    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   setUp!   s    *** c         C@  s   |  j  r |  j  j   n  d  S(   N(   R   t   close(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   tearDown3   s    	(   t   __name__t
   __module__t   __doc__R   R   (    (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyR      s   
	t   TestH5DSBindingsc           B@  sY   e  Z d  Z d   Z d   Z d   Z e j e j	 j
 d	 k d  d    Z d   Z RS(
   sA   
        Feature: Datasets can be created from existing data
    c         C@  s   |  j  t j j |  j d j   |  j t j j |  j d j  d  |  j |  j d j d d  |  j t j j |  j d j  d  d S(   s0    Create a dimension scale from existing dataset R   t    t   CLASSt   DIMENSION_SCALER   s   x2 nameN(	   t
   assertTrueR   R   t   is_scaleR   R   t   assertEqualt   get_scale_namet   attrs(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_create_dimensionscale>   s    #&c         C@  sε   |  j  t j j |  j d j |  j d j d   |  j t j j |  j d j |  j d j d   |  j t j j |  j d j d  d  |  j t j j |  j d j d  d  |  j t j j |  j d j d  d  d  S(   NR	   R   i   i   i    (	   R%   R   R   t   is_attachedR   R   t   assertFalseR'   t   get_num_scales(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_attach_dimensionscaleE   s    --))c         C@  s½   |  j  t j j |  j d j |  j d j d   t j j |  j d j |  j d j d  |  j t j j |  j d j |  j d j d   |  j t j j	 |  j d j d  d  d  S(   NR	   R   i   i   (
   R%   R   R   R+   R   R   t   detach_scaleR,   R'   R-   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_detach_dimensionscaleO   s    -*-i   i    s$   Reading non-existent label segfaultsc         C@  s   |  j  t j j |  j d j d  d  |  j  t j j |  j d j d  d  |  j  t j j |  j d j d  d  d  S(   NR	   i    R   i   R"   i   R   (   R'   R   R   t	   get_labelR   R   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_label_dimensionscaleZ   s    ))c         C@  sN   d   } t  j j |  j d j d | d  } |  j t  j j |  d  d  S(   Nc         S@  s&   t  j j |   } | d k r" |  Sd  S(   Ns   x2 name(   R   R   R(   (   t   dsidt   res(    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   funcd   s    R	   i   i    s   x2 name(   R   R   t   iterateR   R   R'   R(   (   R   R5   R4   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_iter_dimensionscalesc   s    	%(   i   i    i    (   R   R   R    R*   R.   R0   R   t
   skipUnlessR   t   versiont   hdf5_version_tupleR2   R7   (    (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyR!   8   s   		
	t   TestDimensionManagerc           B@  s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C@  sΊ   |  j  d j j |  j  d d  |  j |  j  d j d d |  j  d  |  j  d j j |  j  d d  |  j  d j d j |  j  d  |  j |  j  d j d d |  j  d  d  S(   NR	   R   t   foobari   R
   t   foobaz(   R   t   dimst   create_scaleR'   R   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_create_scaleo   s
    !)!"c         C@  s,   |  j  t   |  j d j d Wd  QXd  S(   NR	   i   (   t   assertRaisest
   IndexErrorR   R>   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_dimensionx   s    c         C@  sD   |  j  t |  j d j  d  |  j  t |  j d j  d  d  S(   NR	   i   R
   (   R'   t   lenR   R>   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_len|   s     c         C@  sL   |  j  d j } |  j g  | D] } | ^ q | d | d | d g  d  S(   NR	   i    i   i   (   R   R>   R'   (   R   R>   t   d(    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt	   test_iter   s    (   R   R   R@   RC   RE   RG   (    (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyR;   m   s   				t   TestDimensionsHighLevelc           B@  st   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 RS(   c         C@  sά   |  j  t |  j d j d  d  |  j  t |  j d j d  d  |  j  t |  j d j d  d  |  j  t |  j d j d  d  |  j  t |  j d j d  d  |  j  t |  j d j d  d  d  S(   NR	   i    i   i   R
   (   R'   RD   R   R>   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyRE      s    $$$$$c         C@  sΚ   |  j  |  j d j d j d  |  j  |  j d j d j d  |  j  |  j d j d j d  |  j  |  j d j d j d  |  j  |  j d j d j d  |  j  |  j d j d j d  d  S(	   NR	   i   R   i   R"   i    R   R
   (   R'   R   R>   t   label(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_label   s    !!!!!c         C@  s~   d |  j  d j d _ |  j |  j  d j d j d  |  j |  j  d j d j d  |  j |  j  d j d j d  d  S(   Nt   fooR	   i    i   R   i   R"   (   R   R>   RI   R'   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_set_label   s    !!c         C@  sΉ   |  j  d j d j |  j  d  |  j t |  j  d j d  d  |  j |  j  d j d d |  j  d  |  j  d j d j |  j  d  |  j t |  j  d j d  d  d  S(   NR	   i   R   i   i    R   (   R   R>   R/   R'   RD   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_detach_scale    s
    "$)"c         C@  s   |  j  d d |  j  d <|  j  d j d j |  j  d  |  j t |  j  d j d  d  |  j |  j  d j d d |  j  d  d  S(   NR   .t   x3R	   i   i   (   R   R>   R   R'   RD   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_attach_scale§   s    "$c         C@  sΈ   |  j  |  j d j d d |  j d  |  j t  ( |  j d j d d |  j d f Wd  QX|  j  |  j d j d d |  j d  |  j  |  j d j d d |  j d  d  S(	   NR	   i   i    R   R
   R   R"   s   x2 name(   R'   R   R>   RA   t   RuntimeError(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_dimension_scale­   s
    )))c         C@  sH   |  j  |  j d j d j   d |  j d f d |  j d f g  d  S(   NR	   i   R"   R   s   x2 nameR   (   R'   R   R>   t   items(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_items΄   s    c         C@  s.   |  j  |  j d j d j   d d g  d  S(   NR	   i   R"   s   x2 name(   R'   R   R>   t   keys(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_keysΊ   s    c         C@  s<   |  j  |  j d j d j   |  j d |  j d g  d  S(   NR	   i   R   R   (   R'   R   R>   t   values(   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_get_values½   s    c         C@  s;   |  j  g  |  j d j d D] } | ^ q d d g  d  S(   NR	   i   R"   s   x2 name(   R'   R   R>   (   R   t   i(    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyRG   Γ   s    c         C@  s/   |  j  t |  j d j d  d d !d  d  S(   NR	   i   i   i   s   "x" dimension 2(   R'   t   reprR   R>   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt	   test_reprΖ   s    c         C@  s   |  j  d j d |  j  d j d <|  j t |  j  d j d  d  |  j t |  j  d j d  d  |  j t |  j  d j d  d  d  S(   NR	   t   DIMENSION_LISTR
   i    i   i   (   R   R)   R'   RD   R>   (   R   (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   test_attributesΙ   s
    $$(   R   R   RE   RJ   RL   RM   RO   RQ   RS   RU   RW   RG   RZ   R\   (    (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyRH      s   											(   t
   __future__R    t   syst   numpyR   t   commonR   R   R   R   R   R   R   R!   R;   RH   (    (    (    sC   lib/python2.7/site-packages/h5py/tests/old/test_dimension_scales.pyt   <module>
   s   #5