ó
\c           @@  sJ  d  Z  d d l m Z d d l 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 m Z d d l
 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 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e j d e
 j j k d ƒ d e f d „  ƒ  Yƒ Z e j d e
 j j k d ƒ d e f d „  ƒ  Yƒ Z e j d e
 j j k d  ƒ d! e f d" „  ƒ  Yƒ Z e j d# e
 j j k d$ ƒ d% e f d& „  ƒ  Yƒ Z  e j d' e
 j j k d( ƒ d) e f d* „  ƒ  Yƒ Z! e j d+ e
 j j k d, ƒ d- e f d. „  ƒ  Yƒ Z" e j d/ e
 j j k d0 ƒ d1 e f d2 „  ƒ  Yƒ Z# d3 e f d4 „  ƒ  YZ$ d5 e f d6 „  ƒ  YZ% d7 e f d8 „  ƒ  YZ& d9 e f d: „  ƒ  YZ' d; e f d< „  ƒ  YZ( d= e f d> „  ƒ  YZ) d? e f d@ „  ƒ  YZ* dA e f dB „  ƒ  YZ+ dC e f dD „  ƒ  YZ, dE e f dF „  ƒ  YZ- dG e f dH „  ƒ  YZ. dI e f dJ „  ƒ  YZ/ dK e f dL „  ƒ  YZ0 dM e f dN „  ƒ  YZ1 dO e f dP „  ƒ  YZ2 dQ e f dR „  ƒ  YZ3 dS e f dT „  ƒ  YZ4 dU e f dV „  ƒ  YZ5 d S(W   sü   
    Dataset testing operations.

    Tests all dataset operations, including creation, with the exception of:

    1. Slicing operations for read and write, handled by module test_slicing
    2. Type conversion for read and write (currently untested)
i    (   t   absolute_importNi   (   t   utt   TestCase(   t   Filet   Groupt   Dataset(   t   is_empty_dataspace(   t   h5ft   h5tt   BaseDatasetc           B@  s   e  Z d  „  Z d „  Z RS(   c         C@  s   t  |  j ƒ  d ƒ |  _ d  S(   Nt   w(   R   t   mktempt   f(   t   self(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   setUp#   s    c         C@  s   |  j  r |  j  j ƒ  n  d  S(   N(   R   t   close(   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   tearDown&   s    	(   t   __name__t
   __module__R   R   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR	   "   s   	t   TestReprc           B@  s   e  Z d  Z d „  Z RS(   s5   
        Feature: repr(Dataset) behaves sensibly
    c         C@  sX   |  j  j d d ƒ } |  j t | ƒ t j ƒ |  j  j ƒ  |  j t | ƒ t j ƒ d S(   s(    repr() works on live and dead datasets t   fooi   N(   i   (   R   t   create_datasett   assertIsInstancet   reprt   sixt   string_typesR   (   R   t   ds(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_repr_open0   s    (   R   R   t   __doc__R   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR   +   s   t   TestCreateShapec           B@  si   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e	 j
 e e d ƒ d ƒ d	 „  ƒ Z RS(
   s@   
        Feature: Datasets can be created from a shape only
    c         C@  s,   |  j  j d d ƒ } |  j | j d ƒ d S(   s    Create a scalar dataset R   N(    (    (   R   R   t   assertEqualt   shape(   R   t   dset(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_scalar>   s    c         C@  s,   |  j  j d d ƒ } |  j | j d ƒ d S(   s    Create a size-1 dataset R   i   N(   i   (   i   (   R   R   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_simpleC   s    c         C@  sz   |  j  j d d ƒ } |  j | j d	 ƒ |  j | j d ƒ |  j  j d d
 ƒ } |  j | j d ƒ |  j | j d ƒ d S(   s    Create an extended dataset R   i?   t   bari   i
   i<   N(   i?   (   i?   (   i   i
   (   i   i
   (   R   R   R   R   t   size(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_extendedH   s    c         C@  s5   |  j  j d d ƒ } |  j | j t j d ƒ ƒ d S(   s)    Confirm that the default dtype is float R   i?   s   =f4N(   i?   (   R   R   R   t   dtypet   np(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_default_dtypeQ   s    c         C@  s*   |  j  t ƒ  |  j j d ƒ Wd QXd S(   s     Missing shape raises TypeError R   N(   t   assertRaisest	   TypeErrorR   R   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_missing_shapeV   s    c         C@  s8   |  j  j d d d t j ƒ} |  j | j t j ƒ d S(   s)    Confirm that the default dtype is float R   i?   R&   N(   i?   (   R   R   R'   t
   longdoubleR   R&   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_long_double[   s    t
   complex256s   No support for complex256c         C@  sD   |  j  j d d d t j d ƒ ƒ} |  j | j t j d ƒ ƒ d S(   s)    Confirm that the default dtype is float R   i?   R&   R.   N(   i?   (   R   R   R'   R&   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_complex256`   s    (   R   R   R   R!   R"   R%   R(   R+   R-   R   t   skipIft   hasattrR'   R/   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR   8   s   							t   TestCreateDatac           B@  s_   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z e j	 d „  ƒ Z
 d „  Z d „  Z RS(	   sA   
        Feature: Datasets can be created from existing data
    c         C@  sD   t  j d d ƒ } |  j j d d | ƒ} |  j | j | j ƒ d S(   s-    Create a scalar dataset from existing array R   R   t   dataN(    (   R'   t   onesR   R   R   R   (   R   R3   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR!   n   s    c         C@  sD   t  j d d ƒ } |  j j d d | ƒ} |  j | j | j ƒ d S(   s/    Create an extended dataset from existing data i?   R   R   R3   N(   i?   (   R'   R4   R   R   R   R   (   R   R3   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR%   t   s    c         C@  sK   |  j  j d d d d d ƒ} |  j | t j ƒ |  j d |  j  k ƒ d S(   s1    Create dataset with missing intermediate groups s   /foo/bar/bazR   i
   R&   s   <i4N(   i
   i
   (   R   R   R   t   h5pyR   t
   assertTrue(   R   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_dataset_intermediate_groupz   s    c         C@  sg   t  j d d d ƒ} |  j j d d d d | ƒ} |  j | j d ƒ |  j | d	 | j d ƒ ƒ d
 S(   s8    Create from existing data, and make it fit a new shape i   R&   R   R   R   i
   i   R3   .N(   i
   i   (   i
   i   (   i
   i   (   R'   t   arangeR   R   R   R   t   assertArrayEqualt   reshape(   R   R3   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_reshape€   s    c         C@  s.   |  j  t ƒ  t |  j d j ƒ Wd QXd S(   sE    Binding Dataset to a non-DatasetID identifier fails with ValueError t   /N(   R)   t
   ValueErrorR   R   t   id(   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_appropriate_low_level_id‡   s    c         C@  s   |  j  t t ƒ d S(   s=    Creating dataset with byte string yields vlen ASCII dataset N(   R   t   Truet   False(   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_bytestringŒ   s    c         C@  s7   |  j  j d d d ƒ|  j t |  j  d j ƒ ƒ d  S(   NR   R&   R   (   R   R   R6   R   R>   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt    test_empty_create_via_None_shape’   s    c         C@  sC   |  j  j d d t j d d ƒ ƒ|  j t |  j  d j ƒ ƒ d  S(   NR   R3   R&   R   (   R   R   R5   t   EmptyR6   R   R>   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt!   test_empty_create_via_Empty_class–   s    "(   R   R   R   R!   R%   R7   R;   R?   R   t   expectedFailureRB   RC   RE   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR2   h   s   						t   TestCreateRequirec           B@  sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sS   
        Feature: Datasets can be created only if they don't exist in the file
    c         C@  s?   |  j  j d d d ƒ } |  j | t ƒ |  j | j d ƒ d S(   s&    Create new dataset with no conflicts R   i
   i   R   N(   i
   i   (   i
   i   (   R   t   require_datasetR   R   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create¡   s    c         C@  sD   |  j  j d d d ƒ } |  j  j d d d ƒ } |  j | | ƒ d S(   s)    require_dataset yields existing dataset R   i
   i   R   N(   i
   i   (   i
   i   (   R   RH   R   (   R   R    t   dset2(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_existing§   s    c         C@  sF   |  j  j d d d ƒ |  j t ƒ  |  j  j d d d ƒ Wd QXd S(	   s6    require_dataset with shape conflict yields TypeError R   i
   i   R   i   N(   i
   i   (   i
   i   (   R   R   R)   R*   RH   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_shape_conflict­   s    c         C@  s@   |  j  j d ƒ |  j t ƒ  |  j  j d d d ƒ Wd QXd S(   s<    require_dataset with object type conflict yields TypeError R   i
   i   R   N(   i
   i   (   R   t   create_groupR)   R*   RH   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_type_conflict³   s    c         C@  sH   |  j  j d d d ƒ } |  j t ƒ  |  j  j d d d ƒ Wd QXd S(	   sL    require_dataset with dtype conflict (strict mode) yields TypeError
        R   i
   i   R   t   S10N(   i
   i   (   i
   i   (   R   R   R)   R*   RH   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_dtype_conflict¹   s    c         C@  sf   |  j  j d d d ƒ } |  j  j d d	 d d t ƒ} |  j | | ƒ |  j | j t j d ƒ ƒ d S(
   sJ    require_dataset with convertible type succeeds (non-strict mode)
        R   i
   i   t   i4t   i2t   exactN(   i
   i   (   i
   i   (   R   R   RH   RA   R   R&   R'   (   R   R    RJ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_dtype_closeÀ   s    (	   R   R   R   RI   RK   RL   RN   RP   RT   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRG   ›   s   					t   TestCreateChunkedc           B@  s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sL   
        Feature: Datasets can be created by manually specifying chunks
    c         C@  s5   |  j  j d d d d d ƒ} |  j | j d	 ƒ d S(
   s    Create via chunks tuple R   R   id   t   chunksi
   N(   id   (   i
   (   i
   (   R   R   R   RV   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_chunksÏ   s    c      
   C@  s6   |  j  t ƒ ! |  j j d d d d d ƒWd QXd S(	   s&    Illegal chunk size raises ValueError R   R   id   RV   iÈ   N(   id   (   iÈ   (   R)   R=   R   R   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_chunks_mismatchÔ   s    c      
   C@  s6   |  j  t ƒ ! |  j j d d d d d ƒWd QXd S(   s>    Attempting to create chunked scalar dataset raises TypeError R   R   RV   i2   N(    (   i2   (   R)   R*   R   R   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_chunks_scalarÙ   s    c         C@  sN   |  j  j d d d d t ƒ} |  j | j t ƒ |  j t | j ƒ d ƒ d S(	   s    Auto-chunking of datasets R   R   i   id   RV   i   N(   i   id   (   R   R   R@   R   RV   t   tupleR   t   len(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_auto_chunksÞ   s    c         C@  s;   |  j  j d d d	 d d d t ƒ} |  j | j d
 ƒ d S(   s7    Auto-chunking with pathologically large element sizes R   R   i   R&   t
   S100000000RV   i   N(   i   (   i   (   R   R   R@   R   RV   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_auto_chunks_abuseä   s    $(   R   R   R   RW   RX   RY   R\   R^   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRU   É   s   				t   TestCreateFillvaluec           B@  s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s>   
        Feature: Datasets can be created with fill value
    c         C@  sG   |  j  j d d d d ƒ} |  j | d d ƒ |  j | d d ƒ d S(	   s-    Fill value is reflected in dataset contents R   i
   t	   fillvalueg      @i    i   N(   i
   (   R   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_fillvalð   s    c         C@  sH   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j t j ƒ d S(   s(    Fill value is recoverable via property R   i
   R`   g      @N(   i
   (   R   R   R   R`   t   assertNotIsInstanceR'   t   ndarray(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_propertyö   s    c         C@  s,   |  j  j d d ƒ } |  j | j d ƒ d S(   s0    .fillvalue property works correctly if not set R   i
   i    N(   i
   (   R   R   R   R`   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_property_noneü   s    c         C@  sz   t  j d d g ƒ } t  j d d | ƒd } |  j j d d d | d
 | ƒ} |  j | j | ƒ |  j | d | ƒ d S(   s&    Fill value works with compound types t   at   f4t   bt   i8i   R&   i    R   i
   R`   i   N(   Rf   Rg   (   Rh   Ri   (   i   (   i
   (   R'   R&   R4   R   R   R   R`   t   assertAlmostEqual(   R   t   dtt   vR    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_compound  s
    !c         C@  sA   |  j  t ƒ , |  j j d d d d d g d d	 ƒ} Wd
 QXd
 S(   s#    Bogus fill value raises TypeError R   i
   R&   Rf   t   iRh   R   R`   i*   N(   i
   (   Rf   Rn   (   Rh   R   (   R)   R=   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_exc	  s    (   R   R   R   Ra   Rd   Re   Rm   Ro   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR_   ê   s   				t   TestCreateNamedTypec           B@  s   e  Z d  Z d „  Z RS(   sC   
        Feature: Datasets created from an existing named type
    c         C@  s—   t  j d ƒ |  j d <|  j j d d d |  j d ƒ} |  j | j t  j d ƒ ƒ |  j | j j ƒ  |  j d j ƒ |  j | j j ƒ  j ƒ  ƒ d S(   s7    Named type object works and links the dataset to type t   f8t   typet   xid   R&   N(   id   (	   R'   R&   R   R   R   R>   t   get_typeR6   t	   committed(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt
   test_named  s
    "#(   R   R   R   Rv   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRp     s   t   gzips   DEFLATE is not installedt   TestCreateGzipc           B@  s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s=   
        Feature: Datasets created with gzip compression
    c         C@  sK   |  j  j d d	 d d d d ƒ} |  j | j d ƒ |  j | j d ƒ d S(
   s#    Create with explicit gzip options R   i   i   t   compressionRw   t   compression_optsi	   N(   i   i   (   R   R   R   Ry   Rz   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   test_gzip&  s    	c         C@  sE   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j d ƒ d S(	   s+    Create with implicit gzip level (level 4) R   i   i   Ry   Rw   i   N(   i   i   (   R   R   R   Ry   Rz   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_gzip_implicit-  s    c      	   C@  s®   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j d ƒ t j j j } zG t	 ƒ  t j j _ |  j
 t ƒ   |  j  j d d	 d d ƒ} Wd QXWd | t j j _ Xd S(
   s.    Create with gzip level by specifying integer R   i   i   Ry   i   Rw   N(   i   i   (   i   i   (   R   R   R   Ry   Rz   R5   t   _hlt   datasett   _LEGACY_GZIP_COMPRESSION_VALSRZ   R)   R=   (   R   R    t   original_compression_vals(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_gzip_number3  s    %c         C@  s   |  j  t t f ƒ  |  j j d d
 d d ƒWd QX|  j  t ƒ  |  j j d d d d ƒWd QX|  j  t ƒ $ |  j j d d d d d	 d ƒWd QXd S(   s=    Illegal gzip level (explicit or implicit) raises ValueError R   i   i   Ry   i   NiüÿÿÿRw   Rz   (   i   i   (   i   i   (   i   i   (   R)   R=   t   RuntimeErrorR   R   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_gzip_excA  s    (   R   R   R   R{   R|   R   Rƒ   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRx     s
   			t   TestCreateCompressionNumberc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s?   
        Feature: Datasets created with a compression code
    c         C@  s‰   t  j j j } z= t ƒ  t  j j _ |  j j d d	 d t  j j d d
 ƒ} Wd | t  j j _ X|  j	 | j
 d ƒ |  j	 | j d ƒ d S(   s^    Create with compression number of gzip (h5py.h5z.FILTER_DEFLATE) and a compression level of 7R   i   i   Ry   Rz   i   NRw   (   i   i   (   i   (   R5   R}   R~   R   RZ   R   R   t   h5zt   FILTER_DEFLATER   Ry   Rz   (   R   R€   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_compression_numberS  s    +c         C@  s  |  j  t ƒ   } |  j j d d
 d d ƒWd QX|  j d t | j ƒ ƒ |  j  t ƒ   } |  j j d d d d ƒWd QX|  j d	 t | j ƒ ƒ t j j	 j
 } zK t ƒ  t j j	 _
 |  j  t ƒ $ |  j j d d d t j j ƒWd QXWd | t j j	 _
 Xd S(   s*    Create with invalid compression numbers  R   i   i   Ry   iüÿÿNs   Invalid filterid   s   Unknown compression(   i   i   (   i   i   (   i   i   (   R)   R=   R   R   t   assertInt   strt	   exceptionR5   R}   R~   R   RZ   t
   IndexErrorR…   R†   (   R   t   eR€   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_compression_number_invalid_  s    )(   R   R   R   R‡   R   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR„   L  s   	t   lzfs   LZF is not installedt   TestCreateLZFc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s<   
        Feature: Datasets created with LZF compression
    c         C@  sE   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j d ƒ d S(   s    Create with explicit lzf R   i   i   Ry   RŽ   N(   i   i   (   R   R   R   Ry   Rz   t   None(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_lzf{  s    c         C@  s9   |  j  t ƒ $ |  j j d d	 d d d d ƒWd QXd S(
   s&    Giving lzf options raises ValueError R   i   i   Ry   RŽ   Rz   i   N(   i   i   (   R)   R=   R   R   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_lzf_exc  s    (   R   R   R   R‘   R’   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR   t  s   	t   szips   SZIP is not installedt   TestCreateSZIPc           B@  s   e  Z d  Z d „  Z RS(   s<   
        Feature: Datasets created with LZF compression
    c         C@  s%   |  j  j d d
 d d d d ƒ} d	 S(   s    Create with explicit szip R   i   i   Ry   R“   Rz   t   eci   N(   i   i   (   R•   i   (   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   test_szip  s    (   R   R   R   R–   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR”   ˆ  s   t   shuffles   SHUFFLE is not installedt   TestCreateShufflec           B@  s   e  Z d  Z d „  Z RS(   s8   
        Feature: Datasets can use shuffling filter
    c         C@  s/   |  j  j d d d t ƒ} |  j | j ƒ d S(   s    Enable shuffle filter R   i   i   R—   N(   i   i   (   R   R   R@   R6   R—   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_shuffleœ  s    (   R   R   R   R™   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR˜   •  s   t
   fletcher32s   FLETCHER32 is not installedt   TestCreateFletcher32c           B@  s   e  Z d  Z d „  Z RS(   s=   
        Feature: Datasets can use the fletcher32 filter
    c         C@  s/   |  j  j d d d t ƒ} |  j | j ƒ d S(   s    Enable fletcher32 filter R   i   i   Rš   N(   i   i   (   R   R   R@   R6   Rš   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_fletcher32¨  s    (   R   R   R   Rœ   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR›   ¢  s   t   scaleoffsets   SCALEOFFSET is not installedt   TestCreateScaleOffsetc           B@  s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s?   
        Feature: Datasets can use the scale/offset filter
    c         C@  s;   |  j  t ƒ & |  j j d d d t d t ƒ} Wd QXd S(   s[    Ensure that a scale factor is required for scaleoffset compression of floating point data R   i   i   R&   R   N(   i   i   (   R)   R=   R   R   t   floatR@   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt    test_float_fails_without_options´  s    c         C@  së   d } d } d d | } t  j j | Œ  d | } |  j j d | d t d	 | ƒ} | j d k	 sj t ‚ | | d
 <|  j j	 } |  j j
 ƒ  t j | d ƒ |  _ |  j d d
 } |  j | | d d | ƒ| | k j ƒ  sç t ‚ d S(   s2    Scaleoffset filter works for floating point data i   id   i,  i   i
   g      à?R   R&   R   .t   rt	   precisionN(   id   i,  (   R'   t   randomt   randR   R   RŸ   R   R   t   AssertionErrort   filenameR   R5   R   R9   t   all(   R   t   scalefacR   t   ranget   testdataR    R¦   t   readdata(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt
   test_floatº  s    !
c         C@  sÂ   d } d } t  j j d d | d d | ƒ} |  j j d | d	 t d
 t ƒ} | j d k	 se t	 ‚ | | d <|  j j
 } |  j j ƒ  t j | d ƒ |  _ |  j d d } |  j | | ƒ d S(   sB    Scaleoffset filter works for integer data with default precision i   id   i,  i    i   i   R$   R   R&   R   .R¡   N(   id   i,  (   R'   R£   t   randintR   R   t   intR@   R   R   R¥   R¦   R   R5   R   R9   (   R   t   nbitsR   Rª   R    R¦   R«   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_intÔ  s    #!
c         C@  s¿   d } d } t  j j d d | d | ƒ} |  j j d | d t d	 | ƒ} |  j | j d k ƒ | | d
 <|  j j } |  j j	 ƒ  t
 j | d ƒ |  _ |  j d d
 } |  j | | ƒ d S(   sD    Scaleoffset filter works for integer data with specified precision i   id   i,  i    i   R$   R   R&   R   .R¡   N(   id   i,  (   R'   R£   R­   R   R   R®   R6   R   R¦   R   R5   R   R9   (   R   R¯   R   Rª   R    R¦   R«   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_int_with_minbitsé  s    !
c         C@  sÐ   d } d } t  j j d d | d d d | ƒ} |  j j d | d	 t d
 | ƒ} |  j | j d k ƒ | | d <|  j j } |  j j	 ƒ  t
 j | d ƒ |  _ |  j d d } | | k j ƒ  sÌ t ‚ d S(   sD    Scaleoffset filter works for integer data with specified precision i   id   i,  i    i   i   R$   R   R&   R   .R¡   N(   id   i,  (   R'   R£   R­   R   R   R®   R6   R   R¦   R   R5   R   R§   R¥   (   R   R¯   R   Rª   R    R¦   R«   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_int_with_minbits_lossyý  s    '!
(   R   R   R   R    R¬   R°   R±   R²   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRž   ®  s   				t   TestExternalc           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sB   
        Feature: Datasets with the external storage property
    c   
      C@  sï   d
 } t  j j | ƒ } |  j ƒ  } | d t j f g } |  j j d | d | j d | ƒ} | | d <| j d k	 s| t
 ‚ d d l } | j | ƒ } | j | j k s¯ t
 ‚ t | d	 ƒ  } | j ƒ  }	 Wd QX|	 | j ƒ  k së t
 ‚ d S(   s'    Create and access an external dataset i   id   i    R   R&   t   external.Nt   rb(   i   id   (   R'   R£   R   R   t	   UNLIMITEDR   R   R&   R´   R   R¥   t   ost   statt   st_sizet   nbytest   opent   readt   tostring(
   R   R   Rª   t   ext_fileR´   R    R·   t   statinfot   fidt   contents(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_external  s    $
c         C@  s  d } |  j  ƒ  } |  j j d | d | ƒ|  j j d | d | g ƒ|  j j d | d | d g ƒ|  j j d | d | d t j g ƒd } g  t d | ƒ D]! } | | d	 | d
 d	 f ^ q¡ } |  j j d | d | ƒ} t | j ƒ | k sþ t ‚ d S(   s$    Test other forms of external lists i   id   R   R´   R#   t   mooi    t   cariè  i   t   pooN(   i   id   (	   R   R   R   R   R¶   R©   R[   R´   R¥   (   R   R   R¾   t   NRs   R´   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_external_other0  s    %7c         C@  s’   d } |  j  ƒ  } |  j t ƒ * |  j j d | d | d d f g ƒWd QX|  j t ƒ 0 |  j j d | d | d t j d f g ƒWd QXd S(	   s"    Test with invalid external lists i   id   R   R´   i    s   h5f.UNLIMITEDN(   i   id   (   R   R)   R*   R   R   R   R¶   (   R   R   R¾   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_external_invalid@  s    +(   R   R   R   RÂ   RÇ   RÈ   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR³     s   		t   TestAutoCreatec           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sP   
        Feature: Datasets auto-created from data produce the correct types
    c         C@  sx   d |  j  d <|  j  d } | j j ƒ  } |  j t | ƒ t j j ƒ |  j | j	 ƒ  ƒ |  j | j
 ƒ  t j j ƒ d S(   s;    Assignment of a byte string produces a vlen ascii dataset s   Hello thereRs   N(   R   R>   Rt   R   Rr   R5   R   t   TypeStringIDR6   t   is_variable_strt   get_csett
   CSET_ASCII(   R   R   t   tid(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_vlen_bytesR  s    c         C@  s…   d t  j d ƒ |  j d <|  j d } | j j ƒ  } |  j t | ƒ t j j	 ƒ |  j
 | j ƒ  ƒ |  j | j ƒ  t j j ƒ d S(   s@    Assignment of a unicode string produces a vlen unicode dataset u   Hello therei4   Rs   N(   R   t   unichrR   R>   Rt   R   Rr   R5   R   RÊ   R6   RË   RÌ   t	   CSET_UTF8(   R   R   RÎ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_vlen_unicode[  s    c         C@  s„   t  j d ƒ |  j d <|  j d } | j j ƒ  } |  j t | ƒ t j j	 ƒ |  j | j
 ƒ  d ƒ |  j | j ƒ  t j j ƒ d S(   sV    Assignment of fixed-length byte string produces a fixed-length
        ascii dataset s   Hello thereRs   i   N(   R'   t   string_R   R>   Rt   R   Rr   R5   R   RÊ   t   get_sizeRÌ   RÍ   (   R   R   RÎ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_string_fixedd  s    (   R   R   R   RÏ   RÒ   RÕ   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRÉ   L  s   				t   TestCreateLikec           B@  s   e  Z d  „  Z d „  Z RS(   c         C@  ss   t  j d ƒ j d d ƒ |  j d <|  j j d |  j d ƒ |  j d } |  j | j d ƒ |  j | j d  ƒ d  S(   Ni   i   t   lolt   like_lol(   i   i   (
   R'   R8   R:   R   t   create_dataset_likeR   R   t   assertIsRV   R   (   R   t   dslike(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_no_chunksp  s
    "c         C@  s  |  j  j d d t j d ƒ d t ƒ} |  j d t j j | j	 ƒ j
 ƒ |  j  j d | ƒ } |  j d t j j | j	 ƒ j
 ƒ |  j  j d d t j d ƒ d t ƒ} |  j d t j j | j	 ƒ j
 ƒ |  j  j d | ƒ } |  j d t j j | j	 ƒ j
 ƒ d  S(	   Nt   hondaR3   i   t   track_timesi    t   hyundait   ibmt   lenovo(   R   R   R'   R8   R@   t   assertNotEqualR5   t   h5gt   get_objinfot   _idt   mtimeRÙ   RA   R   (   R   t   origt   similar(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_track_timesw  s    	""	"(   R   R   RÜ   Ré   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRÖ   o  s   	t
   TestResizec           B@  sM   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   sF   
        Feature: Datasets created with "maxshape" may be resized
    c         C@  sE   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j d	 ƒ d S(
   s     Create dataset with "maxshape" R   i   i   t   maxshapei<   N(   i   i   (   i   i<   (   i   i<   (   R   R   t   assertIsNotRV   R   R   Rë   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRI   ‹  s    c         C@  sr   |  j  j d d d d	 ƒ} |  j | j d
 ƒ | j d ƒ |  j | j d ƒ | j d ƒ |  j | j d ƒ d S(   s(    Datasets may be resized up to maxshape R   i   i   Rë   i<   i2   N(   i   i   (   i   i<   (   i   i   (   i   i2   (   i   i2   (   i   i<   (   i   i<   (   R   R   R   R   t   resize(   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_resize‘  s    c         C@  sB   |  j  j d d d d	 ƒ} |  j t ƒ  | j d
 ƒ Wd QXd S(   s,    Resizing past maxshape triggers ValueError R   i   i   Rë   i<   iF   N(   i   i   (   i   i<   (   i   iF   (   R   R   R)   R=   Rí   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_resize_overš  s    c         C@  s<   |  j  j d d ƒ } |  j t ƒ  | j d ƒ Wd QXd S(   s/    Resizing non-chunked dataset raises TypeError R   i   i   i<   N(   i   i   (   i   i<   (   R   R   R)   R*   Rí   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_resize_nonchunked   s    c         C@  sE   |  j  j d d
 d d ƒ} | j d d d ƒ|  j | j d ƒ d	 S(   s    Resize specified axis R   i   i   Rë   i<   i2   t   axisi   N(   i   i   (   i   i<   (   i   i2   (   R   R   Rí   R   R   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_resize_axis¦  s    c         C@  sH   |  j  j d d
 d d ƒ} |  j t ƒ  | j d d d ƒWd	 QXd	 S(   s     Illegal axis raises ValueError R   i   i   Rë   i<   i2   Rñ   i   N(   i   i   (   i   i<   (   R   R   R)   R=   Rí   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_axis_exc¬  s    c         C@  sE   |  j  j d d d d ƒ} |  j | j d ƒ |  j | j d	 ƒ d S(
   s?    Allow zero-length initial dims for unlimited axes (issue 111) R   i   i    Rë   N(   i   i    (   i   N(   i   i    (   i   N(   R   R   R   R   R   Rë   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_zero_dim²  s    (
   R   R   R   RI   Rî   Rï   Rð   Rò   Ró   Rô   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRê   …  s   							t	   TestDtypec           B@  s   e  Z d  Z d „  Z RS(   sD   
        Feature: Dataset dtype is available as .dtype property
    c         C@  s8   |  j  j d d d ƒ } |  j | j t j d ƒ ƒ d S(   s    Retrieve dtype from dataset R   i   s   |S10N(   i   (   R   R   R   R&   R'   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt
   test_dtype¿  s    (   R   R   R   Rö   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRõ   ¹  s   t   TestLenc           B@  s    e  Z d  Z d „  Z d „  Z RS(   sG   
        Feature: Size of first axis is available via Python's len
    c         C@  s/   |  j  j d d ƒ } |  j t | ƒ d ƒ d S(   s    Python len() (under 32 bits) R   i8  i   N(   i8  i   (   R   R   R   R[   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_lenË  s    c         C@  sŠ   |  j  j d d	 ƒ } |  j | j d ƒ t j d k rZ |  j t ƒ  t | ƒ Wd QXn |  j t | ƒ d ƒ |  j | j ƒ  d ƒ d S(   s    Python len() vs Dataset.len() R   i   i!   i   i   i   NI       (   I       i   I       (   I       i   I   €    iÿÿÿI       I       (	   R   R   R   R   t   syst   maxsizeR)   t   OverflowErrorR[   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_len_bigÐ  s    (   R   R   R   Rø   Rü   (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR÷   Å  s   	t   TestIterc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s;   
        Feature: Iterating over a dataset yields rows
    c         C@  s€   t  j d d d ƒj d	 ƒ } |  j j d d | ƒ} xC t | | ƒ D]2 \ } } |  j t | ƒ d ƒ |  j | | ƒ qF Wd S(
   s&    Iterating over a dataset yields rows i   R&   R   i
   i   R   R3   N(   i
   i   (	   R'   R8   R:   R   R   t   zipR   R[   R9   (   R   R3   R    Rs   t   y(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   test_iterâ  s
    c         C@  sI   |  j  j d d d ƒ} |  j t ƒ  g  | D] } | ^ q/ Wd QXd S(   s0    Iterating over scalar dataset raises TypeError R   R   N(    (   R   R   R)   R*   (   R   R    Rs   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_iter_scalarê  s    (   R   R   R   R   R  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRý   Ü  s   	t   TestStringsc           B@  sh   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 e
 j d „  ƒ Z d	 „  Z RS(
   sr   
        Feature: Datasets created with vlen and fixed datatypes correctly
        translate to and from HDF5
    c         C@  sx   t  j d t ƒ } |  j j d d d | ƒ} | j j ƒ  } |  j t | ƒ t  j	 j
 ƒ |  j | j ƒ  t  j	 j ƒ d S(   s3    Vlen bytes dataset maps to vlen ascii in the file t   vlenRs   id   R&   N(   id   (   R5   t   special_dtypet   bytesR   R   R>   Rt   R   Rr   R   RÊ   RÌ   RÍ   (   R   Rk   R   RÎ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRÏ   ø  s
    c         C@  s{   t  j d t j ƒ } |  j j d d d | ƒ} | j j ƒ  } |  j t	 | ƒ t  j
 j ƒ |  j | j ƒ  t  j
 j ƒ d S(   s5    Vlen unicode dataset maps to vlen utf-8 in the file R  Rs   id   R&   N(   id   (   R5   R  R   t	   text_typeR   R   R>   Rt   R   Rr   R   RÊ   RÌ   RÑ   (   R   Rk   R   RÎ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRÒ      s
    c         C@  sž   t  j d ƒ } |  j j d d d | ƒ} | j j ƒ  } |  j t | ƒ t j	 j
 ƒ |  j | j ƒ  ƒ |  j | j ƒ  d ƒ |  j | j ƒ  t j	 j ƒ d S(   sK    Fixed-length bytes dataset maps to fixed-length ascii in the file
        s   |S10Rs   id   R&   i
   N(   id   (   R'   R&   R   R   R>   Rt   R   Rr   R5   R   RÊ   t   assertFalseRË   RÔ   RÌ   RÍ   (   R   Rk   R   RÎ   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_fixed_bytes  s    c      	   C@  sD   t  j d ƒ } |  j t ƒ   |  j j d d d | ƒ} Wd QXd S(   sA    Fixed-length unicode datasets are unsupported (raise TypeError) s   |U10Rs   id   R&   N(   id   (   R'   R&   R)   R*   R   R   (   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_fixed_unicode  s    c         C@  sq   t  j d t ƒ } |  j j d d d | ƒ} d } | | d <| d } |  j t | ƒ t ƒ |  j | | ƒ d S(	   sN    writing and reading to vlen bytes dataset preserves type and content
        R  Rs   id   R&   s   Helloïi    N(   id   (   R5   R  R  R   R   R   Rr   (   R   Rk   R   R3   t   out(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_roundtrip_vlen_bytes  s    

c         C@  s„   t  j d t j ƒ } |  j j d d	 d | ƒ} d t j d ƒ } | | d <| d } |  j t | ƒ t j ƒ |  j | | ƒ d S(
   sK    Writing and reading to unicode dataset preserves type and content
        R  Rs   id   R&   u   Helloi4   i    N(   id   (	   R5   R  R   R  R   R   RÐ   R   Rr   (   R   Rk   R   R3   R
  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_roundtrip_vlen_unicode$  s    

c         C@  sq   t  j d ƒ } |  j j d d d | ƒ} d } | | d <| d } |  j t | ƒ t  j ƒ |  j | | ƒ d S(	   s[    Writing to and reading from fixed-length bytes dataset preserves
        type and content s   |S10Rs   id   R&   s   Helloïi    N(   id   (   R'   R&   R   R   R   Rr   RÓ   (   R   Rk   R   R3   R
  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_roundtrip_fixed_bytes/  s    

c         C@  sZ   t  j d t j ƒ } |  j j d d d | ƒ} d } |  j t ƒ  | | d <Wd QXd S(	   sT    Writing a non-utf8 byte string to a unicode vlen dataset raises
        ValueError R  Rs   id   R&   s   Helloïi    N(   id   (   R5   R  R   R  R   R   R)   R=   (   R   Rk   R   R3   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_unicode_write_error:  s
    c         C@  s   t  j d t j ƒ } |  j j d d
 d | ƒ} d t j d ƒ } | j d ƒ | d <| d } |  j t	 | ƒ t j ƒ |  j | | ƒ d	 S(   sJ    Writing valid utf-8 byte strings to a unicode vlen dataset is OK
        R  Rs   id   R&   u   Hello therei4   t   utf8i    N(   id   (
   R5   R  R   R  R   R   RÐ   t   encodeR   Rr   (   R   Rk   R   R3   R
  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_unicode_write_bytesD  s    
(   R   R   R   RÏ   RÒ   R  R	  R  R  R  R   RF   R  R  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR  ñ  s   							
t   TestCompoundc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s:   
        Feature: Compound types correctly round-trip
    c      	   C@  sú   t  j d t  j f d t  j f d t  j f d t  j f d t  j f d t  j f d t  j f g ƒ } t  j d d	 | ƒ} x+ | j D]  } t  j j d ƒ d
 | | <q‚ W| |  j d <|  j d d } |  j	 t  j
 | | k ƒ ƒ |  j | j | j ƒ d S(   s:    Compound types are read back in correct order (issue 236)t   weightt   cputimet   walltimet   parents_offsett	   n_parentst   statust   endpoint_typei   R&   id   t   test.N(   i   (   i   (   R'   R&   t   float64t   uint32t   uint8Rc   t   fieldsR£   R   R6   R§   R   (   R   Rk   Rª   t   keyt   outdata(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_rtV  s    c         C@  sþ   t  j d t  j d f f d t  j f g ƒ } t  j d
 d | ƒ} x5 | j D]* } t  j j d | | j ƒ d | | <qL W|  j j	 d d d | ƒ} x | j D] } | | | | <qŸ W|  j d d	 } |  j
 t  j | | k ƒ ƒ |  j | j | j ƒ d  S(   NR  i   R  i   R&   R$   id   R  .(   i   (   i   (   R'   R&   R  R  Rc   R  R£   R   R   R   R6   R§   R   (   R   Rk   Rª   R  R   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_assignj  s    ((   R   R   R   R!  R"  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR  P  s   	t   TestEnumc           B@  s;   e  Z d  Z i d d 6d d 6d d 6Z d „  Z d „  Z RS(	   sM   
        Feature: Enum datatype info is preserved, read/write as integer
    i    t   REDi   t   GREENi*   t   BLUEc         C@  sh   t  j d d |  j f ƒ } |  j j d d d | ƒ} | j } t  j d | ƒ } |  j | |  j ƒ d S(   s=    Enum datasets can be created and type correctly round-trips t   enumRn   Rs   id   R&   N(   id   id   (   R5   R  t   EDICTR   R   R&   t   check_dtypeR   (   R   Rk   R   t   dt2t   dict2(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRI   ƒ  s
    	c         C@  s¡   t  j d d |  j f ƒ } |  j j d d d | ƒ} d | d <d	 | d	 d
 d
 … f <|  j | d d ƒ |  j | d	 d
 d
 … f t j d d d d ƒƒ d
 S(   s/    Enum datasets can be read/written as integers R'  RQ   Rs   id   R&   i*   i#   i%   i   N(   id   id   (   i#   i%   (   i#   i%   (   i   (	   R5   R  R(  R   R   R   R9   R'   t   array(   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_readwrite‹  s    
(   R   R   R   R(  RI   R-  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR#  {  s   	t
   TestFloatsc           B@  sD   e  Z d  Z d „  Z e j e e d ƒ d ƒ d „  ƒ Z d „  Z	 RS(   sA   
        Test support for mini and extended-precision floats
    c         C@  se   |  j  j d d d | ƒ} |  j | j | ƒ t j d d | ƒ} | | d <|  j | d | ƒ d  S(   NRs   id   R&   .(   id   (   id   (   R   R   R   R&   R'   R4   R9   (   R   Rk   R    R3   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   _exectest›  s
    
t   float16s   NumPy float16 support requiredc         C@  s   |  j  t j d ƒ ƒ d S(   s    Mini-floats round trip R0  N(   R/  R'   R&   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   test_mini¢  s    c         C@  sT   t  t d ƒ r1 |  j t j j t j d ƒ ƒ n |  j t j j t j d ƒ ƒ d S(   s    Test mapping for float16 R0  s   <f2s   <f4N(   R1   R'   R   R   t
   IEEE_F16LER&   (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_mini_mapping¨  s    "(
   R   R   R   R/  R   t
   skipUnlessR1   R'   R1  R3  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR.  •  s   	$t   TestTrackTimesc           B@  s   e  Z d  Z d „  Z RS(   s"   
        Feature: track_times
    c         C@  sG   |  j  j d d d t ƒ} t j j | j ƒ j } |  j d | ƒ d S(   sC    check that when track_times=False, the time stamp=0 (Jan 1, 1970) R   i   RÞ   i    N(   i   (	   R   R   RA   R5   Rã   Rä   Rå   Ræ   R   (   R   R   t   ds_mtime(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_disable_track_times¶  s    (   R   R   R   R7  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR5  °  s   t   TestZeroShapec           B@  s    e  Z d  Z d „  Z d „  Z RS(   s7   
        Features of datasets with (0,)-shape axes
    c         C@  sx   |  j  j d d d d ƒ} |  j | j t j | ƒ j ƒ |  j  j d d d d	 ƒ} |  j | j t j | ƒ j ƒ d S(
   s1    Empty datasets can be converted to NumPy arrays Rs   i    Rë   Rÿ   N(   i    (   N(   i    i    (   NN(   R   R   R   R   R   R'   R,  (   R   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_array_conversionÃ  s    c         C@  s®   d d g } |  j  j d d d | d d ƒ} t j d d | ƒ} |  j | d	 j | j ƒ |  j | d	 j | j ƒ |  j | d j | j ƒ |  j | d j | j ƒ d
 S(   s-    Slicing into empty datasets works correctly Rf   R   Rh   Rn   Rs   i    R&   Rë   .N(   Rf   R   (   Rh   Rn   (   i    (   N(   i    (    (    (   R   R   R   R'   t   emptyR   R   R&   (   R   Rk   R   t   arr(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_readingË  s    !(   R   R   R   R9  R<  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR8  ½  s   	t   TestRegionRefsc           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s3   
        Various features of region references
    c         C@  sZ   t  j |  ƒ t j d ƒ j d ƒ |  _ |  j j d d |  j ƒ|  _ |  j |  j d <d  S(   Nid   Rs   R3   .i'  (   id   id   (	   R	   R   R'   R8   R:   R3   R   R   R    (   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR   Ý  s    c         C@  sT   t  j d d … d d d … f } |  j j | } |  j |  j | |  j | ƒ d S(   s4    Region references can be used as slicing arguments i   i#   i
   id   i   N(   R'   t   s_R    t	   regionrefR9   R3   (   R   t   slict   ref(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_create_refã  s    "c         C@  sz   t  j d d … d d d … f } |  j j | } |  j |  j j j | ƒ |  j j ƒ |  j |  j j j | ƒ d ƒ d S(	   s,    Region reference shape and selection shape i   i#   i
   id   i   i   N(   i
   i   (   R'   R>  R    R?  R   R   t	   selection(   R   R@  RA  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_ref_shapeé  s    "%(   R   R   R   R   RB  RD  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR=  ×  s   		t
   TestAstypec           B@  s   e  Z d  Z d „  Z RS(   s%   
        .astype context manager
    c      	   C@  s‘   |  j  j d d d d ƒ} t j d ƒ | d <| j d ƒ N |  j | d j t j d ƒ ƒ |  j t j | d t j d ƒ k ƒ ƒ Wd  QXd  S(   NRs   id   R&   RR   .Rq   (   id   (	   R   R   R'   R8   t   astypeR   R&   R6   R§   (   R   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_astype÷  s
     (   R   R   R   RG  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRE  ñ  s   t   TestScalarCompoundc           B@  s   e  Z d  Z d „  Z RS(   sl   
        Retrieval of a single field from a scalar compound dataset should
        strip the field info
    c         C@  sQ   t  j d g ƒ } |  j j d d d | ƒ} |  j | d j t  j d ƒ ƒ d  S(   NRf   Rn   Rs   R&   (   Rf   Rn   (    (   R'   R&   R   R   R   (   R   Rk   R    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_scalar_compound  s    (   R   R   R   RI  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRH     s   t   TestVlenc           B@  se   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z RS(   c         C@  sÊ  t  j d t ƒ } |  j j d d	 d | ƒ} t j d ƒ | d <t j d ƒ | d <d d d g | d <t j d ƒ | d <|  j | d t j d ƒ ƒ |  j | d t j d ƒ ƒ |  j | d t j d d d g ƒ ƒ |  j | d t j d ƒ ƒ t j t j d ƒ t j d ƒ g ƒ | d d +|  j | d t j d ƒ ƒ |  j | d t j d ƒ ƒ t j t j d ƒ t j d ƒ g ƒ | d d +|  j | d t j d ƒ ƒ |  j | d t j d ƒ ƒ d  S(
   NR  i   R&   i   i    i   i   i   (   i   (	   R5   R  R®   R   R   R'   R8   R9   R,  (   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyR°     s     &..c         C@  sN   t  j d t ƒ } |  j j d d d | ƒ} |  j j d d | d j ƒ d  S(   NR  i   R&   t   vlen2(   i   (   i   (    (   R5   R  R®   R   R   R&   (   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_reuse_from_other!  s    c         C@  s–   d t  f d t j d t  ƒ f g } |  j j d d d | ƒ} |  j j } |  j j ƒ  t j | ƒ |  _ |  j j d d |  j d d d	 j ƒ d  S(
   NRf   Rh   R  i   R&   RK  (   i   (   i   (    (	   R®   R5   R  R   R   R¦   R   R   R&   (   R   Rk   R   t   fname(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_reuse_struct_from_other&  s    $c         C@  sÄ  t  j d t ƒ } |  j j d d d | ƒ} t j d d g ƒ | d <t j d g ƒ | d <d d d g | d <|  j | d t j d d g ƒ ƒ |  j | d t j d g ƒ ƒ |  j | d t j d d d g ƒ ƒ t j d	 d
 d d d g t j d ƒ g ƒ | d d +|  j | d t j d ƒ ƒ |  j | d t j d ƒ ƒ t j t j d	 d d g ƒ t j d d d g ƒ g ƒ | d d +|  j | d t j d ƒ ƒ |  j | d t j d ƒ ƒ d  S(   NR  i   R&   gffffffö?g333333ó?i    i   i   gš™™™™™¹?gš™™™™™ñ?gÍÌÌÌÌÌ @gÍÌÌÌÌÌ@i   i   gš™™™™™@gš™™™™™É?(   i   (	   R5   R  R®   R   R   R'   R,  R9   R8   (   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_convert.  s    # &4%c         C@  sú   t  j d t ƒ } |  j j d d d | ƒ} t j d ƒ | d <t j t j d ƒ t j d ƒ g t j d ƒ t j d ƒ g g ƒ | d  d  … d  d  … f <t j t j d ƒ t j d ƒ g t j d ƒ t j d ƒ g g ƒ | d  d  … d  d  … f <d  S(	   NR  i   R&   i   i    i   (   i   i   (   i    i    (   R5   R  R®   R   R   R'   R8   R,  (   R   Rk   R   (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_multidim?  s    !:!R  c         C@  sê  t  j d | ƒ } |  j j | d d | ƒ} t j d d d g d | ƒ} t j d d d	 d
 d g d | ƒ} t j d d d g d t j d ƒ ƒ} | j | ƒ } d d d d d g }	 t j |	 d | ƒ}
 d d d d d d g } t j | d | ƒ} | | d <| | d <| | d <|	 | d <| | d <|  j | | d ƒ |  j | | d ƒ |  j | | d ƒ |  j |
 | d ƒ |  j | | d ƒ t j d d g d | ƒ}
 |
 | d <|  j |
 | d ƒ |  j j	 ƒ  |  j j
 ƒ  d S(   s¿   
        Helper for testing various vlen numpy data types.
        :param np_dt: Numpy datatype to test
        :param dataset_name: String name of the dataset to create for testing.
        R  i   R&   g      ð?g       @g      >@g33333Y@gÍÌÌÌÌi@gfffff†X@g      %Àg     ÀrÀi   i   i   t   int32g      Œ@g        g      à¿iÿÿÿÿiœÿÿÿi    i'  iF   i   i   g333333Ó?gš™™™™™@N(   i   (   R5   R  R   R   R'   R,  R&   RF  R9   t   flushR   (   R   t   np_dtt   dataset_nameRk   R   t   array_0t   array_1t   array_2t   casted_array_2t   list_3t   list_array_3t   list_4t   list_array_4(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   _help_float_testingH  s2    $'




c         C@  s    t  j d ƒ } |  j | ƒ d  S(   NR0  (   R'   R&   R]  (   R   RS  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_numpy_float16x  s    c         C@  s    t  j d ƒ } |  j | ƒ d  S(   Nt   float32(   R'   R&   R]  (   R   RS  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_numpy_float32|  s    c         C@  s    t  j d ƒ } |  j | ƒ d  S(   NR  (   R'   R&   R]  (   R   RS  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_numpy_float64_from_dtype€  s    c         C@  s   t  j } |  j | ƒ d  S(   N(   R'   R  R]  (   R   RS  (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_numpy_float64_2„  s    	(   R   R   R°   RL  RN  RO  RP  R]  R^  R`  Ra  Rb  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRJ    s   						0			t   TestLowOpenc           B@  s   e  Z d  „  Z d „  Z RS(   c         C@  s(   |  j  j d d ƒ } | j j ƒ  } d S(   s    Test H5Dget_access_plist R   i   N(   i   (   R   R   R>   t   get_access_plist(   R   R   t   p_list(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   test_get_access_list‹  s    c         C@  sh   t  j j t  j j ƒ } |  j j d d ƒ } ~ t  j j |  j j d | ƒ } |  j	 | t  j j
 ƒ d S(   s#    Test the dapl keyword to h5d.open Rs   id   N(   id   (   R5   t   h5pt   createt   DATASET_ACCESSR   R   t   h5dR»   R>   R   t	   DatasetID(   R   t   daplR    t   dsid(    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt	   test_dapl  s
    (   R   R   Rf  Rn  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyRc  ‰  s   	(6   R   t
   __future__R    Rù   R   t   numpyR'   t   commonR   R   R5   R   R   R   t   h5py._hl.baseR   R   R   R	   R   R   R2   RG   RU   R_   Rp   R0   t   filtersR  Rx   R„   R   R”   R˜   R›   Rž   R³   RÉ   RÖ   Rê   Rõ   R÷   Rý   R  R  R#  R.  R5  R8  R=  RE  RH  RJ  Rc  (    (    (    s:   lib/python2.7/site-packages/h5py/tests/old/test_dataset.pyt   <module>   sb   	03.!&,'e8#4_+{