
\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 Z d  d l m	 Z	 d  d l
 m Z d d l m Z m Z d e j f d	     YZ d
 e f d     YZ d e f d     YZ d S(   i    (   t   absolute_importN(   t   PY2t	   text_type(   t   h5t(   t   H5pyDeprecationWarningi   (   t   TestCaset   utt   TestCompoundc           B@  s    e  Z d  Z d   Z d   Z RS(   sG   
        Feature: Compound types can be created from Python dtypes
    c         C@  s   t  j d t  j  } t j d | f d	 g  } t j | d t } | j d  | j d  } } |  j	 | t j
  |  j	 | t j  |  j	 | j d  d  |  j	 | j d  t j
 j    d S(
   sL    Reference types are correctly stored in compound types (issue 144)
        t   reft   at   bs   <f4t   logicali    i   N(   R
   s   <f4(   t   h5pyt   special_dtypet	   Referencet   npt   dtypeR   t	   py_createt   Truet   get_member_typet   assertEqualt   STD_REF_OBJt
   IEEE_F32LEt   get_member_offsett   get_size(   t   selfR   t   dtt   tidt   t1t   t2(    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyt   test_ref   s    c         C@  s   d } i d d d g d 6d d d g d	 6d
 d d g d 6} t  j |  } t j t j |  } xi t | d | d | d	  D]I \ } } } | j t | t  r | j	 d  n | | t j
 |   q W|  j | j |  |  j | j j |  d  S(   Ni   t   f1t   f2t   f3t   namess   <f4s   <i4s   <f8t   formatsi    i   i   t   offsetst   utf8(   R   R   R   t   createt   COMPOUNDt   zipt   insertt
   isinstanceR   t   encodeR   R   t   itemsize(   R   t   sizet	   type_dictt   expected_dtypeR   t   namet   offsetR   (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyt   test_out_of_order_offsets*   s    (!(   t   __name__t
   __module__t   __doc__R   R2   (    (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyR      s   	t   TestTypeFloatIDc           B@  s   e  Z d  Z d   Z RS(   s   Test TypeFloatID.c         C@  sq  |  j    } d } d } d } d } d } t s{ | j   } | j   } | j   } | j   } | j   } | j   } n  d } d } t j d d	 d
 d d d d g d d d d d d d g d d d d d d d g d d d d d d d  g g d! t j }	 t j d d" d# d$ d% d& d' g d d( d) d* d+ d, d- g d d. d/ d0 d1 d2 d3 g d d4 d d5 d6 d7 d8 g g d! t j }
 t j j |  } | | f } t j	 j
 |  } t j } t j j   } | j d9 d: d; d< d:  | j d=  | j d>  | j   t j j | | | |  } | j t j	 j t j	 j |	  ~ t j } t j j   } | j d? d: d@ d< d:  | j d=  | j d>  | j   t j j | | | |  } | j t j	 j t j	 j |
  ~ t j } t j j   } | j d? dA d; d< dA  | j d=  | j d?  | j   t j j | | | |  } | j t j	 j t j	 j |
  ~ t j } t j j   } | j d? dA d; d< dA  | j d=  | j dB  | j   t j j | | | |  } | j t j	 j t j	 j |
  ~ t j j | | t j |  } | j t j	 j t j	 j |
  ~ ~ ~ t j | dC  } | | } |  j t j | |	 k   |  j | j t j dD   | | } |  j t j | |
 k   |  j | j t j dD   | | } y  |  j | j t j dE   Wn- t k
 r&|  j | j t j dD   n X| | } |  j | j t j dF   | | } |  j | j t j  dG S(H   s@   Custom floats are correctly promoted to standard floats on read.t   DS1t   DS2t   DS3t   DS4t   DS5i   i   ga  g>g];>=gq=gg=g  `ӽgZF  >gϽ >g;c  =g>g4-  >gt  =g4  =g]  >g;'>g  (>g% (=gi  h=g  ݽgSdݽgjg@  H>g?>g6  0>g<  >R   g[_>gؽg  8=gT p  =g =g4'ӽg&1  =g3  
>g/=gI/>gX>g׽gb9  P>g43?	>g   >gcE/=g[>g(e   =g[~=g(e   =g׺ 0=g   >g~,=i   i	   i   i    i   i5   i   i   i
   i  t   rs   <f4s   <f2s   <f8N(   t   mktempR   R+   R   t   arrayt   float32R   t   h5fR&   t   h5st   create_simpleR   t
   IEEE_F16LEt   copyt
   set_fieldst   set_sizet	   set_ebiast   lockt   h5dt   writet   ALLt   NATIVE_LDOUBLEt   Filet
   assertTruet   allR   R   t   AttributeErrort
   longdouble(   R   t   test_filenamet   datasett   dataset2t   dataset3t   dataset4t   dataset5t   DIM0t   DIM1t   wdatat   wdata2t   fidt   dimst   spacet   mytypet   dsett   mytype2t   mytype3t   mytype4t   ft   values(    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyt   test_custom_float_promotionE   s    															
	
	
	

  

(   R3   R4   R5   Rf   (    (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyR6   B   s   t   TestDeprecationc           B@  s   e  Z d    Z RS(   c         C@  sL   d } |  j  t |  . } d d l m } | t j t j  j Wd  QXd  S(   Ns   Do not use available_ftypes, this is not part of the public API of h5py. See https://github.com/h5py/h5py/pull/926 for details.i    (   t   available_ftypes(   t   assertWarnsRegexR   t   h5py.h5tRh   R   R   t   floatR,   (   R   t   warning_messaget   warningRh   (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyt!   test_deprecation_available_ftypes   s    (   R3   R4   Rn   (    (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyRg      s   (   t
   __future__R    t   syst   numpyR   t   sixR   R   R   R   t   h5py.h5py_warningsR   t   commonR   R   R   R6   Rg   (    (    (    s6   lib/python2.7/site-packages/h5py/tests/old/test_h5t.pyt   <module>
   s   *