
\c           @@  sz  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 m
 Z
 d d l Z d d l m Z m Z d d l Z d d l m Z m Z m Z m Z m Z d d l m Z m Z d d	 l m Z d d
 l m Z y e d  Wn e k
 re Z n Xe 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% 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+ e j, d d k d'  d( e& f d)     Y Z- e j+ e j. d*  d+ e& f d,     Y Z/ d- e& f d.     YZ0 d/ e f d0     YZ1 d1 e f d2     YZ2 d3 e f d4     YZ3 d5 e f d6     YZ4 d7 e f d8     YZ5 d9 e f d:     YZ6 d; e f d<     YZ7 d= e f d>     YZ8 d S(?   s   
    Group test module.

    Tests all methods and properties of Group objects, with the following
    exceptions:

    1. Method create_dataset is tested in module test_dataset
i    (   t   absolute_importN(   t   mkdtempi   (   t   utt   TestCase(   t   Filet   Groupt   SoftLinkt   HardLinkt   ExternalLink(   t   Datasett   Datatype(   t   h5t(   t   filename_encodeu   αt	   BaseGroupc           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(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   setUp2   s    c         C@  s   |  j  r |  j  j   n  d  S(   N(   R   t   close(   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   tearDown5   s    	(   t   __name__t
   __module__R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   0   s   	t   TestReprc           B@  s   e  Z d  Z d   Z RS(   s=   
        Feature: repr() works sensibly on Group objects
    c         C@  sI   |  j  j d  } |  j | t j  |  j  j   |  j | t j  d S(   s    repr() works on Group objects t   fooN(   R   t   create_groupt   assertIsInstancet   sixt   string_typesR   (   R   t   g(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt	   test_repr?   s    (   R   R   t   __doc__R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   9   s   t
   TestCreatec           B@  sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sI   
        Feature: New groups can be created via .create_group method
    c         C@  s&   |  j  j d  } |  j | t  d S(   s    Simple .create_group call R   N(   R   R   R   R   (   R   t   grp(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_createL   s    c         C@  s)   |  j  j d  } |  j | j d  d S(   s2    Intermediate groups can be created automatically s   foo/bar/bazs   /foo/bar/bazN(   R   R   t   assertEqualt   name(   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_create_intermediateQ   s    c         C@  s:   |  j  j d  |  j t   |  j  j d  Wd QXd S(   s=    Name conflict causes group creation to fail with ValueError R   N(   R   R   t   assertRaisest
   ValueError(   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_create_exceptionV   s    c         C@  sj   d t  j d  } |  j j |  } |  j | j |  |  j | j j j | j	 d   j
 t j  d S(   s$    Unicode names are correctly stored u   /Namei E  t   utf8N(   R   t   unichrR   R   R#   R$   t   idt   linkst   get_infot   encodet   csetR   t	   CSET_UTF8(   R   R$   t   group(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_unicode\   s    c         C@  s]   d } |  j  j |  } |  j | j |  |  j | j j j | j d   j t	 j
  d S(   sL    Unicode names convertible to ASCII are stored as ASCII (issue 239)
        u   /Hello, this is a nameR)   N(   R   R   R#   R$   R+   R,   R-   R.   R/   R   t
   CSET_ASCII(   R   R$   R1   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_unicode_defaultc   s    c         C@  s?   |  j  j d d g  } |  j t   t | j  Wd QXd S(   sA    Binding a group to a non-group identifier fails with ValueError R   i   N(   R   t   create_datasetR&   R'   R   R+   (   R   t   dset(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_appropriate_low_level_idk   s    (	   R   R   R   R"   R%   R(   R2   R4   R7   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR    F   s   					t   TestDatasetAssignmentc           B@  s   e  Z d  Z d   Z RS(   sK   
        Feature: Datasets can be created by direct assignment of data
    c         C@  sX   t  j d d d } | |  j d <|  j |  j d t  |  j |  j d d |  d S(   s,    Dataset auto-creation by direct assignment i   t   dtypeR   t   a.N(   i   i   (   t   npt   onesR   R   R	   t   assertArrayEqual(   R   t   data(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_ndarrayw   s    (   R   R   R   R?   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR8   q   s   t   TestDtypeAssignmentc           B@  s   e  Z d  Z d   Z RS(   sP   
        Feature: Named types can be created by direct assignment of dtypes
    c         C@  sQ   t  j d  } | |  j d <|  j |  j d t  |  j |  j d j |  d S(   s    Named type creation s   |S10R:   N(   R;   R9   R   R   R
   R#   (   R   R9   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_dtype   s    (   R   R   R   RA   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR@   ~   s   t   TestRequirec           B@  s)   e  Z d  Z d   Z d   Z d   Z RS(   sO   
        Feature: Groups can be auto-created, or opened via .require_group
    c         C@  s8   |  j  j d  } |  j  j d  } |  j | |  d S(   s'    Existing group is opened and returned R   N(   R   R   t   require_groupR#   (   R   R!   t   grp2(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_open_existing   s    c         C@  s9   |  j  j d  } |  j | t  |  j | j d  d S(   s&    Group is created if it doesn't exist R   s   /fooN(   R   RC   R   R   R#   R$   (   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR"      s    c         C@  s@   |  j  j d d d  |  j t   |  j  j d  Wd QXd S(   s1    Opening conflicting object results in TypeError R   i   R   N(   i   (   R   R5   R&   t	   TypeErrorRC   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_require_exception   s    (   R   R   R   RE   R"   RG   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRB      s   		t
   TestDeletec           B@  s)   e  Z d  Z d   Z d   Z d   Z RS(   sA   
        Feature: Objects can be unlinked via "del" operator
    c         C@  sD   |  j  j d  |  j d |  j   |  j  d =|  j d |  j   d S(   s    Object deletion via "del" R   N(   R   R   t   assertInt   assertNotIn(   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_delete   s    
c         C@  s$   |  j  t   |  j d =Wd QXd S(   s.    Deleting non-existent object raises KeyError R   N(   R&   t   KeyErrorR   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_nonexisting   s    c         C@  s|   |  j    } t | d  } z | j d  Wd | j   Xt | d  } z! |  j t   | d =Wd QXWd | j   Xd S(   s2    Deleting object in readonly file raises KeyError R   R   Nt   r(   R   R   R   R   R&   RL   (   R   t   fnamet   hfile(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_readonly_delete_exception   s    (   R   R   R   RK   RM   RQ   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRH      s   		t   TestOpenc           B@  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sJ   
        Feature: Objects can be opened via indexing syntax obj[name]
    c         C@  sP   |  j  j d  } |  j  d } |  j  d } |  j | |  |  j | |  d S(   s    Simple obj[name] opening R   s   /fooN(   R   R   R#   (   R   R!   RD   t   grp3(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt	   test_open   s
    c         C@  s%   |  j  t   |  j d Wd QXd S(   s)    Opening missing objects raises KeyError R   N(   R&   RL   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_nonexistent   s    c         C@  s6   |  j  j d  } |  j  | j } |  j | |  d S(   s0    Objects can be opened by HDF5 object reference R   N(   R   R   t   refR#   (   R   R!   RD   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_reference   s    c         C@  s   |  j  j d  } t j d t j  } t j d d | f g  } |  j  j d d |  } d | j f | d	 <| d	 } |  j	 |  j  | d |  d
 S(   sm    Object can be opened by numpy.object_ containing object ref

        Test for issue 181, issue 202.
        t   testRV   R:   t   it   bt	   test_dseti   i*   i    N(   R:   RY   (   i   (
   R   R   t   h5pyt   special_dtypet	   ReferenceR;   R9   R5   RV   R#   (   R   R   t   rtypet   dtR6   R>   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_reference_numpyobj   s    
c         C@  s   t  j j   } |  j t   |  j | Wd QX|  j j d  |  j d j } |  j d =|  j t   |  j | Wd QXd S(   s3    Invalid region references should raise ValueError Nt   x(   R\   t   h5rR^   R&   R'   R   R   RV   (   R   RV   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_invalid_ref   s    
(   R   R   R   RT   RU   RW   Ra   Rd   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRR      s   				c           B@  s   e  Z d  Z d   Z RS(   sP   
        Feature: Opened and closed groups provide a useful __repr__ string
    c         C@  sU   |  j  j d  } |  j t |  t j  | j j   |  j t |  t j  d S(   s;    Opened and closed groups provide a useful __repr__ string R   N(   R   R   R   t   reprR   R   R+   t   _close(   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    (   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR      s   t   BaseMappingc           B@  s    e  Z d  Z d   Z d   Z RS(   s*   
        Base class for mapping tests
    c         C@  so   t  |  j   d  |  _ d |  _ x! |  j D] } |  j j |  q+ Wt j d  |  j d <|  j d	 |  _ d  S(
   NR   R:   RZ   t   ct   ds	   /mongooseRb   (   R:   RZ   Rh   Ri   (   Rb   (   R   R   R   t   groupsR   R\   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    	c         C@  s   |  j  r |  j  j   n  d  S(   N(   R   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    	(   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRg     s   	t   TestLenc           B@  s   e  Z d  Z d   Z RS(   sM   
        Feature: The Python len() function returns the number of groups
    c         C@  s\   |  j  t |  j  t |  j   |  j j d  |  j  t |  j  t |  j  d  d S(   s'    len() returns number of group members t   ei   N(   R#   t   lenR   Rj   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_len$  s    "(   R   R   R   Rn   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRk     s   t   TestContainsc           B@  sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   sC   
        Feature: The Python "in" builtin tests for membership
    c         C@  s   |  j  j d  |  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   d S(   s6    "in" builtin works for membership (byte and Unicode) R:   u   as   /au   /at   mongooseu   mongooseN(   R   R   RI   RJ   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_contains1  s    c         C@  sM   |  j  j d  |  j  j   |  j d |  j  k  |  j d |  j  k  d S(   s9    "in" on closed group returns False (see also issue 174) R:   u   aN(   R   R   R   t   assertFalse(   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_exc;  s    c         C@  s*   |  j  d |  j  |  j  d |  j  d S(   s2    Empty strings work properly and aren't contained u    t    N(   RJ   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_emptyB  s    c         C@  s*   |  j  d |  j  |  j  d |  j  d S(   s'    Current group "." is always contained t   .u   .N(   RI   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_dotG  s    c         C@  s*   |  j  d |  j  |  j  d |  j  d S(   s%    Root group (by itself) is contained t   /u   /N(   RI   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt	   test_rootL  s    c         C@  sm   |  j  j d  d |  j  d <|  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   d S(	   s.    Trailing slashes are unconditionally ignored R1   i*   t   datasets   /group/s   group/s	   /dataset/s   dataset/N(   R   R   RI   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_trailing_slashQ  s    c         C@  s   |  j  j d  t j d  |  j  d <t j d d  |  j  d <|  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   d S(	   s;    Broken softlinks are contained, but their members are not R!   s	   /mongooses	   /grp/softs   mongoose.hdf5s   /grp/externals   /grp/soft/somethings   /grp/external/somethingN(   R   R   R\   R   R   RI   RJ   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_softlinksZ  s    c         C@  s   |  j  j d  d |  j  d <|  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   |  j  d	 } |  j d
 |  j   |  j d
 |  |  j d |  j   |  j d |  j   |  j d |  j   |  j d |  j   d S(   s0    Technically legitimate (but odd-looking) paths s   x/y/zi*   R6   Rx   s   //s   ///s   .///s   ././/Rb   s   .//x/y/zs   x///s   ./x///s   dset///s   /dset//N(   R   R   RI   RJ   (   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_oddball_pathsd  s    (   R   R   R   Rq   Rs   Ru   Rw   Ry   R{   R|   R}   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRo   +  s   	
							
t   TestIterc           B@  s    e  Z d  Z d   Z d   Z RS(   sP   
        Feature: You can iterate over group members via "for x in y", etc.
    c         C@  s3   g  |  j  D] } | ^ q
 } |  j | |  j  d S(   s    "for x in y" iteration N(   R   t   assertSameElementsRj   (   R   Rb   t   lst(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt	   test_iter{  s    c         C@  sT   t  |  j   d  } z- g  | D] } | ^ q } |  j | g   Wd | j   Xd S(   s=    Iteration works properly for the case with no group members R   N(   R   R   R#   R   (   R   RP   Rb   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_iter_zero  s
    (   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR~   u  s   	t   TestTrackOrderc           B@  s#   e  Z d    Z d   Z d   Z RS(   c         C@  sT   xM t  d  D]? } | d d k r9 | j t |   q | g | t |  <q Wd  S(   Nid   i
   i    (   t   rangeR   t   str(   R   R   RY   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   populate  s    c         C@  s^   |  j  j d d t } |  j |  |  j t |  g  t d  D] } t |  ^ qA  d  S(   Nt   ordert   track_orderid   (   R   R   t   TrueR   R#   t   listR   R   (   R   R   RY   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_track_order  s    c         C@  sd   |  j  j d d t } |  j |  |  j t |  t g  t d  D] } t |  ^ qD   d  S(   NR   R   id   (	   R   R   t   FalseR   R#   R   t   sortedR   R   (   R   R   RY   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_no_track_order  s    (   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s   		t   Py2t   TestPy2Dictc           B@  sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sS   
        Feature: Standard Python 2 .keys, .values, etc. methods are available
    c         C@  s9   |  j  |  j j   t  |  j |  j j   |  j  d S(   s    .keys method N(   R   R   t   keysR   R   Rj   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt	   test_keys  s    c         C@  sX   |  j  |  j j   t  |  j |  j j   g  |  j D] } |  j j |  ^ q5  d S(   s    .values method N(   R   R   t   valuesR   R   Rj   t   get(   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_values  s    c         C@  s^   |  j  |  j j   t  |  j |  j j   g  |  j D] } | |  j j |  f ^ q5  d S(   s    .items method N(   R   R   t   itemsR   R   Rj   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_items  s    c         C@  s3   |  j  g  |  j j   D] } | ^ q |  j  d S(   s    .iterkeys method N(   R   R   t   iterkeysRj   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_iterkeys  s    c         C@  sR   |  j  g  |  j j   D] } | ^ q g  |  j D] } |  j j |  ^ q/  d S(   s    .itervalues method N(   R   R   t
   itervaluesRj   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_itervalues  s    %c         C@  sX   |  j  g  |  j j   D] } | ^ q g  |  j D] } | |  j j |  f ^ q/  d S(   s    .iteritems method N(   R   R   t	   iteritemsRj   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_iteritems  s    %(	   R   R   R   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s   					t   Py3t   TestPy3Dictc           B@  s#   e  Z d    Z d   Z d   Z RS(   c         C@  su   t  |  j d    } |  j t |  |  j  x! |  j D] } |  j | |  q8 W|  j t |  t |  j   d S(   s    .keys provides a key view R   N(   t   getattrR   R   R   Rj   RI   R#   Rm   (   R   t   kvRb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
    c         C@  s   t  |  j d    } |  j t |  g  |  j D] } |  j j |  ^ q.  |  j t |  t |  j   x- |  j D]" } |  j |  j j |  |  qv Wd S(   s    .values provides a value view R   N(	   R   R   R   R   Rj   R   R#   Rm   RI   (   R   t   vvRb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
    8c         C@  s   t  |  j d    } |  j t |  g  |  j D] } | |  j j |  f ^ q.  |  j t |  t |  j   x3 |  j D]( } |  j | |  j j |  f |  q| Wd S(   s    .items provides an item view R   N(	   R   R   R   R   Rj   R   R#   Rm   RI   (   R   t   ivRb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
    >(   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s   		t   TestAdditionalMappingFuncsc           B@  s   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 RS(   sc   
    Feature: Other dict methods (pop, pop_item, clear, update, setdefault) are
    available.
    c         C@  sM   t  |  j   d  |  _ x d D] } |  j j |  q W|  j d |  _ d  S(   NR   s   /test/as   /test/bs   /test/cs   /test/dRX   (   s   /test/as   /test/bs   /test/cs   /test/d(   R   R   R   R   R1   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    c         C@  s   |  j  r |  j  j   n  d  S(   N(   R   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    	c         C@  s,   |  j  j   \ } } |  j | |  j   d S(   s!   .pop_item exists and removes itemN(   R1   t   popitemRJ   (   R   t   keyt   val(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_pop_item  s    c         C@  s'   |  j  j d  |  j d |  j   d S(   s&   .pop exists and removes specified itemR:   N(   R1   t   popRJ   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_pop  s    c         C@  s)   |  j  j d d  } |  j | d  d S(   s   .pop falls back to defaultRl   N(   R1   R   t   NoneR#   (   R   t   value(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_pop_default  s    c         C@  s,   |  j  t   |  j j d  } Wd QXd S(   s&   .pop raises KeyError for non-existenceRl   N(   R&   RL   R1   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_pop_raises  s    c         C@  s*   |  j  j   |  j t |  j   d  d S(   s   .clear removes groupsi    N(   R1   t   clearR#   Rm   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_clear  s    c         C@  s@   i t  j d g  d 6} |  j j |  |  j d |  j  d S(   s   .update works with dicti*   Rl   N(   R;   t   arrayR1   t   updateRI   (   R   t	   new_items(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_update_dict  s    c         C@  sW   d t  j d g  f d t  j d g  f g } |  j j |  |  j d |  j  d S(   s   .update works with listRl   i*   R   N(   R;   R   R1   R   RI   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_update_iter  s    c         C@  s@   i t  j d g  d 6} |  j j |   |  j d |  j  d S(   s   .update works with kwargsi*   Rl   N(   R;   R   R1   R   RI   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_update_kwargs  s    c         C@  s2   |  j  j d  } |  j | |  j  j d   d S(   s#   .setdefault gets group if it existsR:   N(   R1   t
   setdefaultR#   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_setdefault  s    c         C@  s5   |  j  j d t j d g   } |  j | d  d S(   s/   .setdefault gets default if group doesn't existRl   i*   N(   R1   R   R;   R   R#   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_setdefault_with_default"  s    !c         C@  s*   |  j  t   |  j j d  Wd QXd S(   s   
        .setdefault gets None if group doesn't exist, but as None isn't defined
        as data for a dataset, this should raise a TypeError.
        Rl   N(   R&   RF   R1   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_setdefault_no_default)  s    (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s   													t   TestGetc           B@  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sL   
        Feature: The .get method allows access to objects and metadata
    c         C@  sf   t    } |  j j d |  } |  j | |  |  j j d  } |  j j d  } |  j | |  d S(   s4    Object is returned, or default if it doesn't exist Rp   R:   N(   t   objectR   R   t   assertIsR   R#   (   R   t   defaultt   outR!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_get_default9  s    	c         C@  s   |  j  j d  |  j  j d d t } |  j | t  |  j  j d d  |  j  j d d t } |  j | t  t j	 d  |  j  d <|  j  j d d t } |  j | t
  d S(	   s/    Object class is returned with getclass option R   t   getclasst   bari   s   |S10t   bazN(   i   (   R   R   R   R   R#   R   R5   R	   R;   R9   R
   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_get_classC  s    c         C@  s   t    } t d  } t d d  } |  j j d  | |  j d <| |  j d <|  j j d | d t d t } |  j j d | d t d t } |  j j d | d t d t } |  j | t  |  j | t  |  j | t  d	 S(
   s    Get link classes s	   /mongooses   somewhere.hdf5Rp   t   hardt   softt   externalt   getlinkR   N(	   R   R   R   R   R   R   R   R#   R   (   R   R   t   slt   elt   out_hlt   out_slt   out_el(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_get_link_classQ  s    	!!!c         C@  s  t  d  } t d d  } |  j j d  | |  j d <| |  j d <|  j j d d t } |  j j d d t } |  j j d d t } |  j | t  |  j | t   |  j | j	 | j	  |  j | t  |  j | j	 | j	  |  j | j
 | j
  d S(	   s    Get link values s	   /mongooses   somewhere.hdf5Rp   R   R   R   R   N(   R   R   R   R   R   R   R   R   R#   t   _patht	   _filename(   R   R   R   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_get_linkd  s    (   R   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   3  s
   	
		t	   TestVisitc           B@  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sv   
        Feature: The .visit and .visititems methods allow iterative access to
        group and subgroup members
    c         C@  s[   t  |  j   d  |  _ d d d d d d g |  _ x! |  j D] } |  j j |  q= Wd  S(   NR   t   grp1s   grp1/sg1s   grp1/sg2RD   s   grp2/sg1s   grp2/sg1/ssg1(   R   R   R   Rj   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    c         C@  s   |  j  j   d  S(   N(   R   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    c         C@  s0   g  } |  j  j | j  |  j | |  j  d S(   s    All subgroups are visited N(   R   t   visitt   appendR   Rj   (   R   t   l(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_visit  s    c         @  s\   g    g  |  j  D] } | |  j | f ^ q } |  j j   f d    |  j |    d S(   s(    All subgroups and contents are visited c         @  s     j  |  | f  S(   N(   R   (   Rb   t   y(   R   (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   <lambda>  s    N(   Rj   R   t
   visititemsR   (   R   Rb   t   comp(    (   R   s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_visititems  s    )c         C@  sp   |  j  j d    } |  j | |  j d  |  j  j d    } |  j | |  j d |  j  |  j d f  d S(   s9    Returning a non-None value immediately aborts iteration c         S@  s   |  S(   N(    (   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    i    c         S@  s
   |  | f S(   N(    (   Rb   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    N(   R   R   R#   Rj   R   (   R   Rb   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_bailout  s    (   R   R   R   R   R   R   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   y  s   				t   TestSoftLinksc           B@  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sQ   
        Feature: Create and manage soft links with the high-level interface
    c         C@  s#   t  d  } |  j | j d  d S(   s    SoftLink path attribute s   /fooN(   R   R#   t   path(   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_spath  s    c         C@  s)   t  d  } |  j t |  t j  d S(   s    SoftLink path repr s   /fooN(   R   R   Re   R   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_srepr  s    c         C@  sL   |  j  j d  } t d  } | |  j  d <|  j  d } |  j | |  d S(   s$    Create new soft link by assignment t   news   /newt   aliasN(   R   R   R   R#   (   R   R   R   t   g2(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR"     s
    c         C@  s8   t  d  |  j d <|  j t   |  j d Wd QXd S(   s0    Opening dangling soft link results in KeyError R   R   N(   R   R   R&   RL   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRs     s    (   R   R   R   R   R   R"   Rs   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
   			t   TestExternalLinksc           B@  s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 e j e d	  d
    Z e j e d	  d    Z d   Z RS(   s7   
        Feature: Create and manage external links
    c         C@  s]   t  |  j   d  |  _ |  j   |  _ t  |  j d  |  _ |  j j d  |  j j   d  S(   NR   R   (   R   R   R   t   enamet   efR   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
    c         C@  s6   |  j  r |  j  j   n  |  j r2 |  j j   n  d  S(   N(   R   R   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s    		c         C@  s9   t  d d  } |  j | j d  |  j | j d  d S(   s     External link paths attributes s   foo.hdf5s   /fooN(   R   R#   t   filenameR   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_epath  s    c         C@  s,   t  d d  } |  j t |  t j  d S(   s    External link repr s   foo.hdf5s   /fooN(   R   R   Re   R   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt
   test_erepr  s    c         C@  s_   t  |  j d  |  j d <|  j d } | j |  _ |  j |  j |  j  |  j | j d  d S(   s    Creating external links s	   /externalt   extN(   R   R   R   t   fileR   t   assertNotEqualR#   R$   (   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR"     s
    c         C@  s>   t  |  j d  |  j d <|  j t   |  j d Wd QXd S(   s5    KeyError raised when attempting to open broken link s   /missingR   N(   R   R   R   R&   RL   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyRs     s    c         C@  s;   t  d d  |  j d <|  j t   |  j d Wd QXd S(   s6    KeyError raised when attempting to open missing file s   mongoose.hdf5s   /fooR   N(   R   R   R&   RL   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_exc_missingfile  s    c         C@  sJ   t  |  j d  |  j d <|  j d } | j } | j   |  j |  d S(   sT    Files opened by accessing external links can be closed

        Issue 189.
        Rx   R   N(   R   R   R   R   R   Rr   (   R   R!   t   f2(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_close_file  s
    	
s   No unicode filename supportc         C@  sW   t  j j t   d  } t | d   } | j d  Wd QXt | d  |  j d <d S(   sh   
        Check that external links encode unicode filenames properly
        Testing issue #732
        u   α.hdf5R   R   Ns	   /externalR   (   t   osR   t   joinR   R   R   R   R   (   R   t   ext_filenamet   ext_file(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_unicode_encode  s    c         C@  s   t  j j t   d  } t | d  % } | j d  d | d j d <Wd QXt | d  |  j d <|  j	 |  j d j d d  d S(	   sh   
        Check that external links decode unicode filenames properly
        Testing issue #732
        u   α.hdf5R   R   RX   t   ext_attrNs	   /externalR   (
   R   R   R   R   R   R   t   attrsR   R   R#   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_unicode_decode  s    c         C@  s   t  j j t   d  } t | d  % } | j d  d | d j d <Wd QXt | d  |  j d <|  j	 |  j d j d d  d S(	   si   
        Check that external links handle unicode hdf5 paths properly
        Testing issue #333
        s   external.hdf5R   u   αRX   R   Nu   /αR   (
   R   R   R   R   R   R   R   R   R   R#   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_unicode_hdf5_path  s    (   R   R   R   R   R   R   R   R"   Rs   R   R   R   t   skipIft   NO_FS_UNICODER   R   R   (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s   								t   TestExtLinkBugsc           B@  s   e  Z d  Z d   Z RS(   s;   
        Bugs: Specific regressions for external links
    c         C@  s   d   } |  j    } |  j    } t | d  } |  j | |   | j d  | j   t | d  } |  j | |   t | d  | d <| j   t | d  } |  j | |   |  j | d d t  d S(   so    Issue 212

        Fails with:

        AttributeError: 'SharedConfig' object has no attribute 'lapl'
        c         @  s     f d   } | S(   Nc           @  s/   y   r   j    n  Wn t k
 r* n Xd  S(   N(   R   t   IOError(    (   Rb   (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   .  s
    (    (   Rb   R   (    (   Rb   s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   closer-  s    R   R:   Rx   t   linkRN   N(   R   R   t
   addCleanupR   R   R   R   R   (   R   R   t	   orig_namet   new_nameR   R   t   h(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_issue_212&  s    	

(   R   R   R   R  (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR      s   t   TestCopyc           B@  s  e  Z d    Z d   Z e j e j j d k  d  d    Z	 e j e j j d k  d  d    Z
 e j e j j d k  d  d    Z e j e j j d k  d  d	    Z e j e j j d k  d  d
    Z e j e j j d k  d  d    Z e j e j j d k  d  d    Z e j e j j d k  d  d    Z e j e j j d k  d  d    Z e j e j j d k  d  d    Z RS(   c         C@  s4   t  |  j   d  |  _ t  |  j   d  |  _ d  S(   NR   (   R   R   t   f1R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   H  s    c         C@  s6   |  j  r |  j  j   n  |  j r2 |  j j   n  d  S(   N(   R  R   R   (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR   L  s    		i   i   i	   s/   Bug in HDF5<1.8.8 prevents copying open datasetc         C@  s   |  j  j d  } d d d g | d <|  j  j d d  |  j  d } |  j | t  |  j | d t j d d d g   d  S(   NR   i   i   i   R   R   (   R  R   t   copyR   R   R=   R;   R   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_path_to_pathR  s    c         C@  s   |  j  j d  } d d d g | d <|  j  j d  } |  j  j d |  |  j  d } |  j | t  |  j | d t j d d d g   |  j  j d |  j d  |  j |  j d	 t  |  j |  j d t j d d d g   d  S(
   NR   i   i   i   R   R   s   foo/barRx   s   /foo(	   R  R   R  R   R   R=   R;   R   R   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_path_to_group]  s    &c         C@  s   |  j  j d  } d d d g | d <|  j  j | d  |  j  d } |  j | t  |  j | d t j d d d g   |  j j | d  |  j |  j d t  |  j |  j d t j d d d g   d  S(	   NR   i   i   i   R   R   s   /foos   foo/bar(	   R  R   R  R   R   R=   R;   R   R   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_group_to_pathm  s    &c         C@  s   |  j  j d  } d d d g | d <|  j  j d  } |  j  j | |  |  j  d } |  j | t  |  j | d t j d d d g   |  j  j | |  j d  |  j |  j d	 t  |  j |  j d t j d d d g   d  S(
   NR   i   i   i   R   R   s   foo/barRx   s   /foo(	   R  R   R  R   R   R=   R;   R   R   (   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_group_to_group}  s    &c         C@  s'  d d d g |  j  d <|  j  d } |  j  j | d  |  j |  j  d t j d d d g   |  j  j d d  |  j |  j  d t j d d d g   |  j  j d |  j  |  j |  j d t j d d d g   |  j j |  j  d |  j d  |  j |  j d t j d d d g   d  S(   Ni   i   i   R   R   R   (   R  R  R=   R;   R   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_dataset  s    ))) c         C@  sb  |  j  j d  } | j d  } d d d g | d <d d d	 g | d
 <|  j  j | d d t |  j  d } |  j | t  |  j | d t  |  j t | d  d  |  j | d t	 j
 d d d g   |  j j | d d t |  j |  j d t  |  j |  j d t  |  j t |  j d  d  |  j |  j d t	 j
 d d d g   d  S(   NR   R   i   i   i   t   quxi   i   i   t   quuxR   t   shallowi    s   /foos   foo/bars   foo/qux(   R  R   R  R   R   R   R#   Rm   R=   R;   R   R   (   R   R   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_shallow  s    &c         C@  s   d d d g |  j  d <|  j  d } d d d g | j d <|  j  j | d	 d
 t |  j |  j  d	 t j d d d g   |  j d |  j  d	 j k  |  j j | d	 d
 t |  j |  j d	 t j d d d g   |  j d |  j d	 j k  d  S(   Ni   i   i   R   i   i   i   R   R   t   without_attrs(	   R  R   R  R   R=   R;   R   t   assert_R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_without_attributes  s    ))c         C@  s   d d d g |  j  d <|  j  j d  } t d  | d <|  j  j | d d	 t |  j j | d d	 t |  j  d =|  j |  j  d t  |  j |  j  d
 t	 j
 d d d g   |  j |  j d t  |  j |  j d t	 j
 d d d g   d  S(   Ni   i   i   R   R   s   /barR   R  t   expand_softs   qux/bazs   /foos   foo/baz(   R  R   R   R  R   R   R   R   R=   R;   R   (   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_soft_links  s    
)c         C@  s   |  j  j } d d d g |  j  d <t | d  |  j d <|  j  j   d  |  _  |  j |  j d t j d d d g   |  j j	 d d d t
 t j |  |  j |  j d t j d d d g   d  S(   Ni   i   i   R   R   R   t   expand_external(   R  R   R   R   R   R   R=   R;   R   R  R   R   t   unlink(   R   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_external_links  s    	)c         C@  sG  d d d g |  j  d <d d d g |  j  d <|  j  d } |  j  d } | j | j d <|  j  j | d	 d
 t |  j |  j  d	 t j d d d g   |  j  d	 j d } |  j |  j  | t j d d d g   |  j |  j  | j	 | j	  |  j  j d |  j
 d	 d
 t |  j |  j
 d	 t j d d d g   |  j
 d	 j d } |  j |  j
 | t j d d d g   |  j  j d |  j
 d d
 t |  j |  j
 d t j d d d g   |  j |  j
 d t j d d d g   |  j
 d j d } |  j |  j
 | t j d d d g   |  j |  j
 | |  j
 d  d  S(   Ni   i   i   R   i   i   i   R   R   t   expand_refsRx   t   roots   root/foos   root/bar(   R  RV   R   R  R   R=   R;   R   R   R$   R   R#   (   R   R   R   t   baz_bart   foo_bar(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_copy_refs  s(    )))))))(   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   i   i   i	   (   R   R   R   R   R   R   R\   t   versiont   hdf5_version_tupleR  R	  R
  R  R  R  R  R  R  R  (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR  F  s,   		
t   TestMovec           B@  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s7   
        Feature: Group.move moves links in a file
    c         C@  sj   |  j  j d  } |  j  j d d  |  j |  j  d |  |  j  j d d  |  j |  j  d |  d S(   s    Moving an object t   Xt   Ys   new/nested/pathN(   R   R   t   moveR#   (   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_move_hardlink  s
    c         C@  sX   t  j d  |  j d <|  j j d d  |  j j d d t } |  j | j d  d S(   s    Moving a soft link s   relative/pathR   t   new_softR   N(   R\   R   R   R#  R   R   R#   R   (   R   t   lnk(    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_move_softlink  s    c         C@  sM   |  j  j d  |  j  j d  |  j t   |  j  j d d  Wd QXd S(   s!    Move conflict raises ValueError R!  R"  N(   R   R   R&   R'   R#  (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_move_conflict  s    c         C@  s'   |  j  j d  |  j  j d d  d S(   s    Test that a null-move works R!  N(   R   R   R#  (   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_short_circuit#  s    (   R   R   R   R$  R'  R(  R)  (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR     s
   			t   TestMutableMappingc           B@  s    e  Z d  Z d   Z d   Z RS(   sS   Tests if the registration of Group as a MutableMapping
    behaves as expected
    c         C@  sF   t  t t j  s t  |  j j d  } t | t j  sB t  d  S(   Nt   K(   t
   issubclassR   t   collectionst   MutableMappingt   AssertionErrorR   R   t
   isinstance(   R   R!   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_resolution-  s    c         C@  s'   t  j t  j t  j t  j t  j d S(   sC   
        Test that the required functions are implemented.
        N(   R   t   __getitem__t   __setitem__t   __delitem__t   __iter__t   __len__(   R   (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   test_validity2  s
    (   R   R   R   R1  R7  (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyR*  )  s   	(9   R   t
   __future__R    R-  t   numpyR;   R   t   os.patht   syst   tempfileR   R   t   commonR   R   R\   R   R   R   R   R   R	   R
   R   t   h5py._hl.compatR   t   UnicodeEncodeErrorR   R   R   R   R   R    R8   R@   RB   RH   RR   Rg   Rk   Ro   R~   R   R   t   version_infoR   t   PY2R   R   R   R   R   R   R   R  R   R*  (    (    (    s8   lib/python2.7/site-packages/h5py/tests/old/test_group.pyt   <module>   s\   (
	+$9J$UF&c&"