
    do                     Z   d 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m	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 	  ed           dZn# e$ r dZY nw xY w G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z  G d de          Z! G d de          Z" G d  d!e"          Z# G d" d#e          Z$ G d$ d%e"          Z% G d& d'e          Z& G d( d)e"          Z' G d* d+e"          Z( G d, d-e          Z) G d. d/e          Z* G d0 d1e          Z+ G d2 d3e          Z, G d4 d5e          Z- G d6 d7e          Z. G d8 d9e          Z/ G d: d;e          Z0dS )<z
    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
    N)mkdtemp)MutableMapping   )utTestCase)FileGroupSoftLinkHardLinkExternalLink)DatasetDatatype)h5t)filename_encode   αFTc                       e Zd Zd Zd ZdS )	BaseGroupc                 T    t          |                                 d          | _        d S Nw)r   mktempfselfs    5lib/python3.11/site-packages/h5py/tests/test_group.pysetUpzBaseGroup.setUp/   s    dkkmmS))    c                 J    | j         r| j                                          d S d S Nr   closer   s    r   tearDownzBaseGroup.tearDown2   )    6 	FLLNNNNN	 	r   N)__name__
__module____qualname__r   r"    r   r   r   r   -   s2        * * *    r   r   c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )

TestCreatezI
        Feature: New groups can be created via .create_group method
    c                     | j                             d          }|                     |t                     | j                             d          }|                     |t                     dS )z Simple .create_group call foos   barN)r   create_groupassertIsInstancer	   r   grpgrp2s      r   test_createzTestCreate.test_create<   s^    f!!%((c5)))v""6**c5)))))r   c                     | j                             d          }|                     |j        d           | j                             d          }|                     |j        d           dS )z2 Intermediate groups can be created automatically foo/bar/bazz/foo/bar/bazs   boo/bar/bazz/boo/bar/bazN)r   r,   assertEqualnamer.   s      r   test_create_intermediatez#TestCreate.test_create_intermediateD   sb    f!!-00>222v"">22N33333r   c                     | j                             d           |                     t                    5  | j                             d           ddd           dS # 1 swxY w Y   dS )z= Name conflict causes group creation to fail with ValueError r+   N)r   r,   assertRaises
ValueErrorr   s    r   test_create_exceptionz TestCreate.test_create_exceptionL   s    E"""z** 	' 	'F&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	's   AA!$A!c                 >   dt          d          z   }| j                            |          }|                     |j        |           |                     |j        j                            |                    d                    j	        t          j                   dS )z$ Unicode names are correctly stored z/Namei E  utf8N)chrr   r,   r4   r5   idlinksget_infoencodecsetr   	CSET_UTF8r   r5   groups      r   test_unicodezTestCreate.test_unicodeR   s~    #f++%##D))T***00V1D1DEEJCMZZZZZr   c                    d}| j                             |          }|                     |j        |           |                     |j        j                            |                    d                    j        t          j
                   dS )zL Unicode names convertible to ASCII are stored as ASCII (issue 239)
        z/Hello, this is a namer<   N)r   r,   r4   r5   r>   r?   r@   rA   rB   r   
CSET_ASCIIrD   s      r   test_unicode_defaultzTestCreate.test_unicode_defaultY   su     )##D))T***00V1D1DEEJCN[[[[[r   c                     |                      t                    5  | j                            d           ddd           dS # 1 swxY w Y   dS )z" Names should be strings or bytes g      ?N)r8   	TypeErrorr   r,   r   s    r   	test_typezTestCreate.test_typea   s    y)) 	$ 	$F###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$   AA
Ac                     | j                             ddg          }|                     t                    5  t	          |j                   ddd           dS # 1 swxY w Y   dS )zA Binding a group to a non-group identifier fails with ValueError r+   r   N)r   create_datasetr8   r9   r	   r>   )r   dsets     r   test_appropriate_low_level_idz(TestCreate.test_appropriate_low_level_idf   s    v$$UQC00z** 	 	$'NNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AA AN)r$   r%   r&   __doc__r1   r6   r:   rF   rI   rL   rQ   r'   r   r   r)   r)   6   s         * * *4 4 4' ' '[ [ [\ \ \$ $ $
    r   r)   c                       e Zd ZdZd Zd ZdS )TestDatasetAssignmentzK
        Feature: Datasets can be created by direct assignment of data
    c                     t          j        dd          }|| j        d<   |                     | j        d         t                     |                     | j        d         d         |           dS )z, Dataset auto-creation by direct assignment    rW   r   dtypea.N)nponesr   r-   r   assertArrayEqualr   datas     r   test_ndarrayz"TestDatasetAssignment.test_ndarrayr   sd    wu3'''sdfSk7333dfSk#.55555r   c                     t          j        dd          }|| j        d<   |                     | j        d         t                     d S )NrV   r   rX      b)r[   r\   r   r-   r   r^   s     r   test_name_bytesz%TestDatasetAssignment.test_name_bytesy   sC    wvS)))tdfTlG44444r   N)r$   r%   r&   rR   r`   rc   r'   r   r   rT   rT   l   s<         6 6 65 5 5 5 5r   rT   c                       e Zd ZdZd Zd ZdS )TestDtypeAssignmentzP
        Feature: Named types can be created by direct assignment of dtypes
    c                     t          j        d          }|| j        d<   |                     | j        d         t                     |                     | j        d         j        |           dS ) Named type creation |S10rZ   N)r[   rY   r   r-   r   r4   r   rY   s     r   
test_dtypezTestDtypeAssignment.test_dtype   s]      sdfSk8444*E22222r   c                     t          j        d          }|| j        d<   |                     | j        d         t                     dS )rg   rh   rb   N)r[   rY   r   r-   r   ri   s     r   rc   z#TestDtypeAssignment.test_name_bytes   s>      tdfTlH55555r   N)r$   r%   r&   rR   rj   rc   r'   r   r   re   re   ~   s<         3 3 36 6 6 6 6r   re   c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	TestRequirezO
        Feature: Groups can be auto-created, or opened via .require_group
    c                     | j                             d          }| j                             d          }|                     ||           | j                             d          }|                     ||           dS )z' Existing group is opened and returned r+   s   fooN)r   r,   require_groupr4   r   r/   r0   grp3s       r   test_open_existingzTestRequire.test_open_existing   ss    f!!%((v##E**s###v##F++s#####r   c                     | j                             d          }|                     |t                     |                     |j        d           dS )z& Group is created if it doesn't exist r+   /fooN)r   ro   r-   r	   r4   r5   r   r/   s     r   r1   zTestRequire.test_create   sK    f""5))c5)))6*****r   c                     | j                             ddd           |                     t                    5  | j                             d           ddd           dS # 1 swxY w Y   dS )z1 Opening conflicting object results in TypeError r+   r   r   N)r   rO   r8   rK   ro   r   s    r   test_require_exceptionz"TestRequire.test_require_exception   s    eT3///y)) 	( 	(F  '''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   AA#&A#c                 *   t          j                    }| j                            dd|           | j                            d          }t          |t                    sJ | j                            d          }t          |t                    sJ dS )z- Intermediate is created if it doesn't exist r3   rw   rX   r+   foo/barN)h5pystring_dtyper   require_datasetget
isinstancer	   r   dtrE   s      r    test_intermediate_create_datasetz,TestRequire.test_intermediate_create_dataset   s      }d"===

5!!%'''''

9%%%'''''''r   c                    t          j                    }| j                            d           | j                            d          }t          |t                    sJ | j                            d          }t          |t                    sJ | j                            d          }t          |t                    sJ d S )Nr3   r+   rz   )r{   r|   r   ro   r~   r   r	   r   s      r   test_intermediate_create_groupz*TestRequire.test_intermediate_create_group   s      ]+++

5!!%'''''

9%%%'''''

=))%'''''''r   c                    | j                             dddt                    }|                    dd           | j                             dddt                     | j                             ddt          	           |                     t
                    5  | j                             dd
dt                     d d d            n# 1 swxY w Y   |                     t
                    5  | j                             dd
dt                     d d d            n# 1 swxY w Y   |                     t
                    5  | j                             dd
dt                     d d d            n# 1 swxY w Y   |                     t
                    5  | j                             ddt          	           d d d            d S # 1 swxY w Y   d S )Nzfoo/resizable)r      )Nr   )shapemaxshaperY      r   )axis)r   r   )r   rY   )r   r   )r   N)N   )Nr      )
   r   )r   r}   intresizer8   rK   )r   dss     r   test_require_shapezTestRequire.test_require_shape   s   V##O6I]`#aa
		"1	fyX[\\\gSIIIy)) 	a 	aF""?&9\_"```	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	ay)) 	a 	aF""?&9\_"```	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	ay)) 	d 	dF""?&<_b"ccc	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	dy)) 	N 	NF""?'"MMM	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	NsH   $C

CC/$DD#&D#$E44E8;E8#G		GGN)
r$   r%   r&   rR   rr   r1   rx   r   r   r   r'   r   r   rm   rm      s}         $ $ $+ + +( ( (( ( (( ( (N N N N Nr   rm   c                   $    e Zd ZdZd Zd Zd ZdS )
TestDeletezA
        Feature: Objects can be unlinked via "del" operator
    c                     | j                             d           |                     d| j                    | j         d= |                     d| j                    dS )z Object deletion via "del" r+   Nr   r,   assertInassertNotInr   s    r   test_deletezTestDelete.test_delete   sU    E"""eTV$$$F5M'''''r   c                 |    |                      t                    5  | j        d= ddd           dS # 1 swxY w Y   dS )z. Deleting non-existent object raises KeyError r+   Nr8   KeyErrorr   r   s    r   test_nonexistingzTestDelete.test_nonexisting   s    x(( 	 	u	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   	155c                    |                                  }t          |d          }	 |                    d           |                                 n# |                                 w xY wt          |d          }	 |                     t
                    5  |d= ddd           n# 1 swxY w Y   |                                 dS # |                                 w xY w)z2 Deleting object in readonly file raises KeyError r   r+   rN)r   r   r,   r!   r8   r   )r   fnamehfiles      r   test_readonly_delete_exceptionz)TestDelete.test_readonly_delete_exception   s    UC  	u%%%KKMMMMEKKMMMMUC  	""8,, ! !%L! ! ! ! ! ! ! ! ! ! ! ! ! ! ! KKMMMMMEKKMMMMs;   A A&:C B$C $B((C +B(,C CN)r$   r%   r&   rR   r   r   r   r'   r   r   r   r      sK         ( ( (  
    r   r   c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	TestOpenzJ
        Feature: Objects can be opened via indexing syntax obj[name]
    c                     | j                             d          }| j         d         }| j         d         }|                     ||           |                     ||           dS )z Simple obj[name] opening r+   rt   N)r   r,   r4   rp   s       r   	test_openzTestOpen.test_open   s_    f!!%((ve}vf~d###d#####r   c                     |                      t                    5  | j        d          ddd           dS # 1 swxY w Y   dS )z) Opening missing objects raises KeyError r+   Nr   r   s    r   test_nonexistentzTestOpen.test_nonexistent  s    x(( 	 	F5MM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   6::c                     | j                             d          }| j         |j                 }|                     ||           dS )z0 Objects can be opened by HDF5 object reference r+   N)r   r,   refr4   r.   s      r   test_referencezTestOpen.test_reference  s@    f!!%((vcgs#####r   c                 ,   | j                             d          }t          j        ddt          j        fg          }| j                             dd|          }d|j        f|d<   |d         }|                     | j         |d                  |           d	S )
zm Object can be opened by numpy.object_ containing object ref

        Test for issue 181, issue 202.
        test)rZ   ib	test_dsetrw   *   r   r   N)	r   r,   r[   rY   r{   	ref_dtyperO   r   r4   )r   gr   rP   r_   s        r   test_reference_numpyobjz TestOpen.test_reference_numpyobj  s    
 F''Xz3"7899v$$[$;;QUQAwQ!,,,,,r   c                    t           j                                        }|                     t                    5  | j        |          ddd           n# 1 swxY w Y   | j                            d           | j        d         j        }| j        d= |                     t                    5  | j        |          ddd           dS # 1 swxY w Y   dS )z5 Invalid region references should raise an exception Nx)	r{   h5r	Referencer8   r9   r   r,   r   	Exception)r   r   s     r   test_invalid_refzTestOpen.test_invalid_ref  s<    h  ""z** 	 	F3KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	C   fSkoF3Ky)) 	 	F3KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA,CCCc                 8   | j                             d           |                     t                    5  | j         d          ddd           n# 1 swxY w Y   |                     t                    5  | j         d          ddd           dS # 1 swxY w Y   dS )z> Access with non bytes or str types should raise an exception rE   r   N.)r   r,   r8   rK   r   s    r   test_path_type_validationz"TestOpen.test_path_type_validation)  s   G$$$y)) 	 	F1II	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 y)) 	 	F3KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA4BBBN)
r$   r%   r&   rR   r   r   r   r   r   r   r'   r   r   r   r      sx         $ $ $  
$ $ $- - -      r   r   c                       e Zd ZdZd ZdS )TestReprz9Opened and closed groups provide a useful __repr__ stringc                    | j                             d          }|                     t          |          t                     |j                                         |                     t          |          t                     | j         d         }| j                                          |                     t          |          t                     dS )z; Opened and closed groups provide a useful __repr__ string r+   N)r   r,   r-   reprstrr>   _closer!   )r   r   s     r   	test_reprzTestRepr.test_repr8  s    F&&d1ggs+++	d1ggs+++F5Md1ggs+++++r   N)r$   r%   r&   rR   r   r'   r   r   r   r   5  s)        CC	, 	, 	, 	, 	,r   r   c                       e Zd ZdZd Zd ZdS )BaseMappingz*
        Base class for mapping tests
    c                     t          |                                 d          | _        d| _        | j        D ]}| j                            |           t          j        d          | j        d<   | j        dz   | _        d S )Nr   )rZ   r   cd	/mongooser   r   )r   r   r   groupsr,   r{   r
   r   r   s     r   r   zBaseMapping.setUpH  ss    dkkmmS))* 	# 	#AF""""mK00skF*r   c                 J    | j         r| j                                          d S d S r   r    r   s    r   r"   zBaseMapping.tearDownP  r#   r   N)r$   r%   r&   rR   r   r"   r'   r   r   r   r   C  s<         + + +    r   r   c                       e Zd ZdZd ZdS )TestLenzM
        Feature: The Python len() function returns the number of groups
    c                 (   |                      t          | j                  t          | j                             | j                            d           |                      t          | j                  t          | j                  dz              dS )z' len() returns number of group members er   N)r4   lenr   r   r,   r   s    r   test_lenzTestLen.test_lenZ  ss    TVc$+&6&6777C   TVc$+&6&6q&899999r   N)r$   r%   r&   rR   r   r'   r   r   r   r   T  s-         : : : : :r   r   c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )TestContainszC
        Feature: The Python "in" builtin tests for membership
    c                 ~   | j                             d           |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    dS )z6 "in" builtin works for membership (byte and Unicode) rZ      as   /az/as   mongoosemongooseNr   r   s    r   test_containszTestContains.test_containsg  s    C   dDF###c46"""eTV$$$dDF###df---TV,,,,,r   c                     | j                             d           | j                                          |                     d| j         v            |                     d| j         v            dS )z9 "in" on closed group returns False (see also issue 174) rZ   r   N)r   r,   r!   assertFalser   s    r   test_exczTestContains.test_excq  sa    C   ((('''''r   c                 r    |                      d| j                   |                      d| j                   dS )z2 Empty strings work properly and aren't contained  r   N)r   r   r   s    r   
test_emptyzTestContains.test_emptyx  s8    TV$$$df%%%%%r   c                 r    |                      d| j                   |                      d| j                   dS )z' Current group "." is always contained    ..Nr   r   r   s    r   test_dotzTestContains.test_dot}  4    dDF###c46"""""r   c                 r    |                      d| j                   |                      d| j                   dS )z% Root group (by itself) is contained    //Nr   r   s    r   	test_rootzTestContains.test_root  r   r   c                 &   | j                             d           d| j         d<   |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    dS )	z. Trailing slashes are unconditionally ignored rE   r   datasetz/group/zgroup/z	/dataset/zdataset/N)r   r,   r   r   s    r   test_trailing_slashz TestContains.test_trailing_slash  s    G$$$yi(((h'''k46***j$&)))))r   c                    | j                             d           t          j        d          | j         d<   t          j        dd          | j         d<   |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    dS )	z; Broken softlinks are contained, but their members are not r/   r   z	/grp/softmongoose.hdf5z/grp/externalz/grp/soft/somethingz/grp/external/somethingN)r   r,   r{   r
   r   r   r   r   s    r   test_softlinkszTestContains.test_softlinks  s    E""""mK88{"&"3O["Q"Qk46***.777otv...2DF;;;;;r   c                    | j                             d           d| j         d<   |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    | j         d	         }|                     d
| j                    |                     d
|           |                     d| j                    |                     d| j                    |                     d| j                    |                     d| j                    dS )z0 Technically legitimate (but odd-looking) paths zx/y/zr   rP   r   z//z///z.///z././/r   z.//x/y/zzx///z./x///zdset///z/dset//Nr   ru   s     r   test_oddball_pathszTestContains.test_oddball_paths  s&   G$$$vc46"""dDF###eTV$$$fdf%%%gtv&&&fSkj$&)))S)))fdf%%%h'''i(((i(((((r   N)r$   r%   r&   rR   r   r   r   r   r   r   r   r   r'   r   r   r   r   a  s         - - -( ( (& & &
# # #
# # #
* * *< < <) ) ) ) )r   r   c                       e Zd ZdZd Zd ZdS )TestIterzP
        Feature: You can iterate over group members via "for x in y", etc.
    c                 ^    d | j         D             }|                     || j                   dS )z "for x in y" iteration c                     g | ]}|S r'   r'   .0r   s     r   
<listcomp>z&TestIter.test_iter.<locals>.<listcomp>  s    !!!Qq!!!r   N)r   assertSameElementsr   )r   lsts     r   	test_iterzTestIter.test_iter  s5    !!$&!!!T[11111r   c                     t          |                                 d          }	 d |D             }|                     |g            |                                 dS # |                                 w xY w)z= Iteration works properly for the case with no group members r   c                     g | ]}|S r'   r'   r   s     r   r   z+TestIter.test_iter_zero.<locals>.<listcomp>  s    $$$1$$$r   N)r   r   r4   r!   )r   r   r   s      r   test_iter_zerozTestIter.test_iter_zero  sj    T[[]]C((	$$e$$$CS"%%%KKMMMMMEKKMMMMs   "A A2N)r$   r%   r&   rR   r   r   r'   r   r   r   r     s<         2 2 2
    r   r   c                        e Zd Zd Zd Zd ZdS )TestTrackOrderc                     t          d          D ]A}|dz  dk    r#|                    t          |                     .|g|t          |          <   Bd S )Nd   r   r   )ranger,   r   )r   r   r   s      r   populatezTestTrackOrder.populate  s\    s 	  	 A2v{{s1vv&&&&C#a&&			  	 r   c                 t   | j                             dd          }|                     |           d t          d          D             }|                     t          |          |           |                     t          t          |                    t          t          |                               d S )NorderTtrack_orderc                 ,    g | ]}t          |          S r'   r   r   r   s     r   r   z3TestTrackOrder.test_track_order.<locals>.<listcomp>  s    ***!s1vv***r   r  )r   r,   r  r  r4   listreversedr   r   r   s      r   test_track_orderzTestTrackOrder.test_track_order  s    FT::a**uSzz***a#&&&hqkk**D#,?,?@@@@@r   c                    | j                             dd          }|                     |           t          d t	          d          D                       }|                     t          |          |           |                     t          t          |                    t          t          |                               d S )Nr  Fr  c                 ,    g | ]}t          |          S r'   r	  r
  s     r   r   z6TestTrackOrder.test_no_track_order.<locals>.<listcomp>  s    111c!ff111r   r  )r   r,   r  sortedr  r4   r  r  r  s      r   test_no_track_orderz"TestTrackOrder.test_no_track_order  s    FU;;a11eCjj11122a#&&&hqkk**D#,?,?@@@@@r   N)r$   r%   r&   r  r  r  r'   r   r   r   r     sI             A A AA A A A Ar   r   c                        e Zd Zd Zd Zd ZdS )TestPy3Dictc                     t          | j        d                      }| j        }|                     t	          |          |           |                     t	          t          |                    t	          t          |                               | j        D ]}|                     ||           |                     t          |          t          | j                             dS )z .keys provides a key view keysN)	getattrr   r   r   r  r  r   r4   r   )r   kvr   r   s       r   	test_keyszTestPy3Dict.test_keys  s    $WTVV$$&&kR#...Xb\\ 2 2D#4G4GHHH 	! 	!AMM!R    R#dk"2"233333r   c                      t           j        d                      } fd j        D             }                     t	          |          |                                t	          t          |                    t	          t          |                                                    t          |          t           j                              j        D ]0}                      j        	                    |          |           1dS )z .values provides a value view valuesc                 D    g | ]}j                             |          S r'   r   r~   r   r   r   s     r   r   z+TestPy3Dict.test_values.<locals>.<listcomp>  s%    222tvzz!}}222r   N
r  r   r   r   r  r  r4   r   r   r~   )r   vvr   r   s   `   r   test_valueszTestPy3Dict.test_values  s    &WTVX&&((2222dk222R#...Xb\\ 2 2D#4G4GHHHR#dk"2"2333 	- 	-AMM$&**Q--,,,,	- 	-r   c                       t           j        d                      } fd j        D             }                     t	          |          |                                t	          t          |                    t	          t          |                                                    t          |          t           j                              j        D ]2}                     | j        	                    |          f|           3dS )z .items provides an item view itemsc                 H    g | ]}|j                             |          fS r'   r  r  s     r   r   z*TestPy3Dict.test_items.<locals>.<listcomp>  s*    666Q$&**Q-- 666r   Nr  )r   ivr   r   s   `   r   
test_itemszTestPy3Dict.test_items  s    %WTVW%%''6666$+666R#...Xb\\ 2 2D#4G4GHHHR#dk"2"2333 	2 	2AMM1dfjjmm,b1111	2 	2r   N)r$   r%   r&   r  r!  r&  r'   r   r   r  r    sA        	4 	4 	4	- 	- 	-	2 	2 	2 	2 	2r   r  c                   `    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )TestAdditionalMappingFuncszc
    Feature: Other dict methods (pop, pop_item, clear, update, setdefault) are
    available.
    c                     t          |                                 d          | _        dD ]}| j                            |           | j        d         | _        d S )Nr   )z/test/az/test/bz/test/cz/test/dr   )r   r   r   r,   rE   r   s     r   r   z TestAdditionalMappingFuncs.setUp   sT    dkkmmS))= 	# 	#AF""""VF^


r   c                 J    | j         r| j                                          d S d S r   r    r   s    r   r"   z#TestAdditionalMappingFuncs.tearDown  r#   r   c                 t    | j                                         \  }}|                     || j                    dS )z!.pop_item exists and removes itemN)rE   popitemr   )r   keyvals      r   test_pop_itemz(TestAdditionalMappingFuncs.test_pop_item
  s7    :%%''Sdj)))))r   c                 p    | j                             d           |                     d| j                    dS )z&.pop exists and removes specified itemrZ   N)rE   popr   r   s    r   test_popz#TestAdditionalMappingFuncs.test_pop  s4    
sdj)))))r   c                 h    | j                             dd          }|                     |d           dS )z.pop falls back to defaultr   N)rE   r1  r4   r   values     r   test_pop_defaultz+TestAdditionalMappingFuncs.test_pop_default  s5     
sD))%%%%%r   c                     |                      t                    5  | j                            d          }ddd           dS # 1 swxY w Y   dS )z&.pop raises KeyError for non-existencer   N)r8   r   rE   r1  )r   r-  s     r   test_pop_raisesz*TestAdditionalMappingFuncs.test_pop_raises  s     x(( 	& 	&*..%%C	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&rM   c                     | j                                          |                     t          | j                   d           dS )z.clear removes groupsr   N)rE   clearr4   r   r   s    r   
test_clearz%TestAdditionalMappingFuncs.test_clear   s:    
TZ!,,,,,r   c                     dt          j        dg          i}| j                            |           |                     d| j                   dS )z.update works with dictr   r   Nr[   arrayrE   updater   r   	new_itemss     r   test_update_dictz+TestAdditionalMappingFuncs.test_update_dict%  sH    "(B4..)	
)$$$c4:&&&&&r   c                     dt          j        dg          fdt          j        dg          fg}| j                            |           |                     d| j                   dS )z.update works with listr   r   r   Nr=  r@  s     r   test_update_iterz+TestAdditionalMappingFuncs.test_update_iter+  sc     "(B4..!"(B4..!
	 	
)$$$c4:&&&&&r   c                     dt          j        dg          i} | j        j        di | |                     d| j                   dS )z.update works with kwargsr   r   Nr'   r=  r@  s     r   test_update_kwargsz-TestAdditionalMappingFuncs.test_update_kwargs4  sM    "(B4..)	
&&I&&&c4:&&&&&r   c                     | j                             d          }|                     || j                             d                     dS )z#.setdefault gets group if it existsrZ   N)rE   
setdefaultr4   r~   r4  s     r   test_setdefaultz*TestAdditionalMappingFuncs.test_setdefault:  sA    
%%c**
s 3 344444r   c                     | j                             dt          j        dg                    }|                     |d           dS )z/.setdefault gets default if group doesn't existr   r   N)rE   rH  r[   r>  r4   r4  s     r   test_setdefault_with_defaultz7TestAdditionalMappingFuncs.test_setdefault_with_default?  sA     
%%c28RD>>::#####r   c                     |                      t                    5  | j                            d           ddd           dS # 1 swxY w Y   dS )z
        .setdefault gets None if group doesn't exist, but as None isn't defined
        as data for a dataset, this should raise a TypeError.
        r   N)r8   rK   rE   rH  r   s    r   test_setdefault_no_defaultz5TestAdditionalMappingFuncs.test_setdefault_no_defaultF  s     y)) 	' 	'J!!#&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'rM   N)r$   r%   r&   rR   r   r"   r/  r2  r6  r8  r;  rB  rD  rF  rI  rK  rM  r'   r   r   r(  r(    s         $ $ $  * * *
* * *
& & && & &- - -
' ' '' ' '' ' '5 5 5
$ $ $' ' ' ' 'r   r(  c                   *    e Zd ZdZd Zd Zd Zd ZdS )TestGetzL
        Feature: The .get method allows access to objects and metadata
    c                    t                      }| j                            d|          }|                     ||           | j                            d          }| j                            d          }|                     ||           dS )z4 Object is returned, or default if it doesn't exist r   rZ   r   N)objectr   r~   assertIsr,   r4   )r   defaultoutr/   s       r   test_get_defaultzTestGet.test_get_defaultV  sx    ((fjjW--c7###f!!#&&fjjc"""""r   c                    | j                             d           | j                             dd          }|                     |t                     | j                             dd           | j                             dd          }|                     |t                     t          j        d          | j         d<   | j                             dd          }|                     |t                     dS )	z/ Object class is returned with getclass option r+   T)getclassbar)rW   rh   bazN)
r   r,   r~   r4   r	   rO   r   r[   rY   r   )r   rT  s     r   test_get_classzTestGet.test_get_class`  s    E"""fjjj..e$$$eT***fjjj..g&&&((ufjjj..h'''''r   c                    t                      }t          d          }t          dd          }| j                            d           || j        d<   || j        d<   | j                            d|dd          }| j                            d|dd          }| j                            d|dd          }|                     |t                     |                     |t                     |                     |t                     d	S )
z Get link classes r   somewhere.hdf5r   hardsoftexternalT)getlinkrW  N)rQ  r
   r   r   r,   r~   r4   r   )r   rS  slelout_hlout_slout_els          r   test_get_link_classzTestGet.test_get_link_classn  s    ((k""*J77F###vzFGTDIIFGTDIIJMM******.....r   c                    t          d          }t          dd          }| j                            d           || j        d<   || j        d<   | j                            dd          }| j                            dd          }| j                            dd          }|                     |t                     |                     |t                      |                     |j        |j                   |                     |t                     |                     |j        |j                   |                     |j	        |j	                   d	S )
z Get link values r   r\  r   r]  r^  r_  Tr`  N)
r
   r   r   r,   r~   r-   r   r4   _path	_filename)r   ra  rb  rc  rd  re  s         r   test_get_linkzTestGet.test_get_link  s*   k""*J77F###vzFD11FD11J55 	fh///fh///rx000fl333rx000)2<88888r   N)r$   r%   r&   rR   rU  rZ  rf  rk  r'   r   r   rO  rO  P  sZ         # # #( ( (/ / /&9 9 9 9 9r   rO  c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )	TestVisitzv
        Feature: The .visit and .visititems methods allow iterative access to
        group and subgroup members
    c                     t          |                                 d          | _        g d| _        | j        D ]}| j                            |           d S )Nr   )grp1zgrp1/sg1zgrp1/sg2r0   zgrp2/sg1zgrp2/sg1/ssg1)r   r   r   r   r,   r   s     r   r   zTestVisit.setUp  sd    dkkmmS))    	# 	#AF""""	# 	#r   c                 8    | j                                          d S r   r    r   s    r   r"   zTestVisit.tearDown  s    r   c                 ~    g }| j                             |j                   |                     || j                   dS )z All subgroups are visited N)r   visitappendr   r   )r   ls     r   
test_visitzTestVisit.test_visit  s;    QX4;/////r   c                      g  fd j         D             } j                            fd                                |           dS )z( All subgroups and contents are visited c                 .    g | ]}|j         |         fS r'   )r   r  s     r   r   z-TestVisit.test_visititems.<locals>.<listcomp>  s#    4441DF1I444r   c                 2                         | |f          S r   )rs  )r   yrt  s     r   <lambda>z+TestVisit.test_visititems.<locals>.<lambda>  s    qxx1 r   N)r   r   
visititemsr   )r   comprt  s   ` @r   test_visititemszTestVisit.test_visititems  s`    44444446666777a(((((r   c                 &   | j                             d           }|                     || j        d                    | j                             d           }|                     || j        d         | j         | j        d                  f           dS )z9 Returning a non-None value immediately aborts iteration c                     | S r   r'   r   s    r   rz  z(TestVisit.test_bailout.<locals>.<lambda>  s    1 r   r   c                 
    | |fS r   r'   )r   ry  s     r   rz  z(TestVisit.test_bailout.<locals>.<lambda>  s
    Aa5 r   N)r   rr  r4   r   r{  r   s     r   test_bailoutzTestVisit.test_bailout  s    FLL%%DKN+++F0011T[^TVDKN-CDEEEEEr   N)	r$   r%   r&   rR   r   r"   ru  r}  r  r'   r   r   rm  rm    sn         
# # #  0 0 0) ) )F F F F Fr   rm  c                   *    e Zd ZdZd Zd Zd Zd ZdS )TestSoftLinkszQ
        Feature: Create and manage soft links with the high-level interface
    c                 Z    t          d          }|                     |j        d           dS )z SoftLink path attribute rt   N)r
   r4   pathr   ra  s     r   
test_spathzTestSoftLinks.test_spath  s-    f&)))))r   c                 t    t          d          }|                     t          |          t                     dS )z SoftLink path repr rt   N)r
   r-   r   r   r  s     r   
test_sreprzTestSoftLinks.test_srepr  s1    fd2hh,,,,,r   c                     | j                             d          }t          d          }|| j         d<   | j         d         }|                     ||           dS )z$ Create new soft link by assignment newz/newaliasN)r   r,   r
   r4   )r   r   ra  g2s       r   r1   zTestSoftLinks.test_create  sV    F&&fwVG_Br   c                     t          d          | j        d<   |                     t                    5  | j        d          ddd           dS # 1 swxY w Y   dS )z0 Opening dangling soft link results in KeyError r  r  N)r
   r   r8   r   r   s    r   r   zTestSoftLinks.test_exc  s    "5//wx(( 	 	F7OO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAN)r$   r%   r&   rR   r  r  r1   r   r'   r   r   r  r    sZ         * * *
- - -
         r   r  c                       e Zd 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dS )TestExternalLinksz7
        Feature: Create and manage external links
    c                     t          |                                 d          | _        |                                 | _        t          | j        d          | _        | j                            d           | j                                         d S )Nr   r_  )r   r   r   enameefr,   r!   r   s    r   r   zTestExternalLinks.setUp  sf    dkkmmS))[[]]
tz3''Z(((r   c                     | j         r| j                                          | j        r| j                                         d S d S r   )r   r!   r  r   s    r   r"   zTestExternalLinks.tearDown  sB    6 	FLLNNN7 	GMMOOOOO	 	r   c                     t          dd          }|                     |j        d           |                     |j        d           dS )z  External link paths attributes foo.hdf5rt   N)r   r4   filenamer  r   rb  s     r   
test_epathzTestExternalLinks.test_epath  sG    *f--j111&)))))r   c                 v    t          dd          }|                     t          |          t                     dS )z External link repr r  rt   N)r   r-   r   r   r  s     r   
test_ereprzTestExternalLinks.test_erepr  s3    *V,,d2hh,,,,,r   c                     t          | j        d          | j        d<   | j        d         }|j        | _        |                     | j        | j                   |                     |j        d           dS )z Creating external links 	/externalextN)r   r  r   filer  assertNotEqualr4   r5   ru   s     r   r1   zTestExternalLinks.test_create  se    $TZ==ufUm(DGTV,,,;/////r   c                     t          | j        d          | j        d<   |                     t                    5  | j        d          ddd           dS # 1 swxY w Y   dS )z5 KeyError raised when attempting to open broken link z/missingr  N)r   r  r   r8   r   r   s    r   r   zTestExternalLinks.test_exc   s    $TZ<<ux(( 	 	F5MM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                     t          dd          | j        d<   |                     t                    5  | j        d          ddd           dS # 1 swxY w Y   dS )z6 KeyError raised when attempting to open missing file r   rt   r  N)r   r   r8   r   r   s    r   test_exc_missingfilez&TestExternalLinks.test_exc_missingfile  s    $_V<<ux(( 	 	F5MM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                     t          | j        d          | j        d<   | j        d         }|j        }|                                 |                     |           dS )zT Files opened by accessing external links can be closed

        Issue 189.
        r   r  N)r   r  r   r  r!   r   )r   r/   f2s      r   test_close_filez!TestExternalLinks.test_close_file  sT    
 %TZ55ufUmX



r   zNo unicode filename supportc                    t           j                            t                      d          }t	          |d          5 }|                    d           ddd           n# 1 swxY w Y   t          |d          | j        d<   dS )zh
        Check that external links encode unicode filenames properly
        Testing issue #732
           α.hdf5r   r_  Nr  r  )osr  joinr   r   r,   r   r   r   ext_filenameext_files      r   test_unicode_encodez%TestExternalLinks.test_unicode_encode  s     w||GIIz::,$$ 	.!!*---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.$\;??us   AA#&A#c                    t           j                            t                      d          }t	          |d          5 }|                    d           d|d         j        d<   ddd           n# 1 swxY w Y   t          |d          | j        d<   | 	                    | j        d         j        d         d           dS )	zh
        Check that external links decode unicode filenames properly
        Testing issue #732
        r  r   r_  r   ext_attrNr  r  
r  r  r  r   r   r,   attrsr   r   r4   r  s      r   test_unicode_decodez%TestExternalLinks.test_unicode_decode$  s     w||GIIz::,$$ 	<!!*---5;HZ &z2	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< %\;??u,Z8&AAAAA   &A//A36A3c                    t           j                            t                      d          }t	          |d          5 }|                    d           d|d         j        d<   ddd           n# 1 swxY w Y   t          |d          | j        d<   | 	                    | j        d         j        d         d           dS )	zi
        Check that external links handle unicode hdf5 paths properly
        Testing issue #333
        zexternal.hdf5r   r   r   r  Nu   /αr  r  r  s      r   test_unicode_hdf5_pathz(TestExternalLinks.test_unicode_hdf5_path1  s    
 w||GII??,$$ 	6!!$'''/5HTN ,	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 %\599u,Z8&AAAAAr  N)r$   r%   r&   rR   r   r"   r  r  r1   r   r  r  r   skipIfNO_FS_UNICODEr  r  r  r'   r   r   r  r    s            * * *- - -
0 0 0    	 	 	 RY};<<@ @ =<@ RY};<<
B 
B =<
B
B 
B 
B 
B 
Br   r  c                       e Zd ZdZd ZdS )TestExtLinkBugsz;
        Bugs: Specific regressions for external links
    c                 ^   d }|                                  }|                                  }t          |d          }|                      ||                     |                    d           |                                 t          |d          }|                      ||                     t          |d          |d<   |                                 t          |d          }|                      ||                     |                     |d         d         t                     dS )zo Issue 212

        Fails with:

        AttributeError: 'SharedConfig' object has no attribute 'lapl'
        c                       fd}|S )Nc                  \    	  r                                   d S d S # t          $ r Y d S w xY wr   )r!   IOErrorr   s   r   r   z9TestExtLinkBugs.test_issue_212.<locals>.closer.<locals>.wK  sM     "					" "   DDs    
++r'   )r   r   s   ` r   closerz.TestExtLinkBugs.test_issue_212.<locals>.closerJ  s#         Hr   r   rZ   r   linkr   N)r   r   
addCleanupr,   r!   r   r-   r	   )r   r  	orig_namenew_namer   r   hs          r   test_issue_212zTestExtLinkBugs.test_issue_212C  s   	 	 	 KKMM	;;==C  q		"""	s				3q		""" C00&					3q		"""aine44444r   N)r$   r%   r&   rR   r  r'   r   r   r  r  =  s-         5 5 5 5 5r   r  c                   :   e Zd 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dS )TestCopyc                     t          |                                 d          | _        t          |                                 d          | _        d S r   )r   r   f1r  r   s    r   r   zTestCopy.setUpe  s8    t{{}}c**t{{}}c**r   c                     | j         r| j                                          | j        r| j                                         d S d S r   )r  r!   r  r   s    r   r"   zTestCopy.tearDowni  sB    7 	GMMOOO7 	GMMOOOOO	 	r   )r      	   z/Bug in HDF5<1.8.8 prevents copying open datasetc                 .   | j                             d          }g d|d<   | j                             dd           | j         d         }|                     |t                     |                     |d         t          j        g d                     d S )Nr+   r   r   r   rX  rY  )r  r,   copyr-   r	   r]   r[   r>  r   r+   rY  s      r   test_copy_path_to_pathzTestCopy.test_copy_path_to_patho  s     g""5))WWE
UE"""genc5)))c%j"(777*;*;<<<<<r   c                 d   | j                             d          }g d|d<   | j                             d          }| j                             d|           | j         d         }|                     |t                     |                     |d         t          j        g d                     | j                             d| j        d                    |                     | j        d         t                     |                     | j        d         t          j        g d                     d S Nr+   r  rX  rY  rz   r   rt   	r  r,   r  r-   r	   r]   r[   r>  r  r  s      r   test_copy_path_to_groupz TestCopy.test_copy_path_to_groupz  s    g""5))WWE
g""5))UC   genc5)))c)nbhwww.?.?@@@UDGCL)))dgfou555dgi0"(7772C2CDDDDDr   c                    | j                             d          }g d|d<   | j                             |d           | j         d         }|                     |t                     |                     |d         t          j        g d                     | j                            |d           |                     | j        d         t                     |                     | j        d         t          j        g d                     d S )Nr+   r  rX  rY  rt   rz   r  r  s      r   test_copy_group_to_pathz TestCopy.test_copy_group_to_path  s     g""5))WWE
S%   genc5)))c%j"(777*;*;<<<S%   dgfou555dgi0"(7772C2CDDDDDr   c                 d   | j                             d          }g d|d<   | j                             d          }| j                             ||           | j         d         }|                     |t                     |                     |d         t          j        g d                     | j                             || j        d                    |                     | j        d         t                     |                     | j        d         t          j        g d                     d S r  r  r  s      r   test_copy_group_to_groupz!TestCopy.test_copy_group_to_group  s    g""5))WWE
g""5))S#genc5)))c)nbhwww.?.?@@@S$'#,'''dgfou555dgi0"(7772C2CDDDDDr   c                    g d| j         d<   | j         d         }| j                             d          }| j                             |d           |                     | j         d         t	          j        g d                     | j                             dd           |                     | j         d         t	          j        g d                     | j                             ||           |                     | j         d         t	          j        g d                     | j                             d| j                   |                     | j        d         t	          j        g d                     | j                            | j         d         | j        d           |                     | j        d         t	          j        g d                     d S )Nr  r+   r/   rX  rY  z/grp/foo)r  r,   r  r]   r[   r>  r  )r   r+   r/   s      r   test_copy_datasetzTestCopy.test_copy_dataset  s    !geng""5))S%   dgenbhwww.?.?@@@UE"""dgenbhwww.?.?@@@S#dgj128GGG3D3DEEEUDG$$$dgenbhwww.?.?@@@TWU^TWe444dgenbhwww.?.?@@@@@r   c                    | j                             d          }|                    d          }g d|d<   g d|d<   | j                             |dd	           | j         d         }|                     |t                     |                     |d         t                     |                     t          |d                   d
           |                     |d         t          j	        g d                     | j
                            |dd	           |                     | j
        d         t                     |                     | j
        d         t                     |                     t          | j
        d                   d
           |                     | j
        d         t          j	        g d                     d S )Nr+   rX  r  quxrW   r      quuxrY  T)shallowr   rt   rz   zfoo/qux)r  r,   r  r-   r	   r4   r   r]   r[   r>  r  )r   r+   rX  rY  s       r   test_copy_shallowzTestCopy.test_copy_shallow  s    g""5))u%%WWE
ggFS%...genc5)))c%j%000SZ!,,,c%j"(777*;*;<<<S%...dgfou555dgi0%888TWY/00!444dgi0"(7772C2CDDDDDr   c                    g d| j         d<   | j         d         }g d|j        d<   | j                             |dd           |                     | j         d         t	          j        g d                     d| j         d         j        vsJ | j                            |dd           |                     | j        d         t	          j        g d                     d| j        d         j        vsJ d S )Nr  r+   r  rX  rY  T)without_attrs)r  r  r  r]   r[   r>  r  r   r+   s     r   test_copy_without_attributesz%TestCopy.test_copy_without_attributes  s     !gen"77	%S%t444dgenbhwww.?.?@@@DGEN00000S%t444dgenbhwww.?.?@@@DGEN0000000r   c                 f   g d| j         d<   | j                             d          }t          d          |d<   | j                             |dd           | j                            |dd           | j         d= |                     | j         d         t                     |                     | j         d	         t          j	        g d                     |                     | j        d
         t                     |                     | j        d         t          j	        g d                     d S )Nr  rX  r+   z/barrY  r  T)expand_softzqux/bazrt   zfoo/baz)
r  r,   r
   r  r  r-   r	   r]   r[   r>  r  s     r   test_copy_soft_linkszTestCopy.test_copy_soft_links  s
    #g""5))f%%E
S%T222S%T222GENdgene444dgi0"(9992E2EFFFdgfou555dgi0"(9992E2EFFFFFr   c                    | j         j        }g d| j         d<   t          |d          | j        d<   | j                                          d | _         |                     | j        d         t          j        g d                     | j                            ddd           t          j
        |           |                     | j        d         t          j        g d                     d S )Nr  r+   rX  rY  T)expand_external)r  r  r   r  r!   r]   r[   r>  r  r  unlink)r   r  s     r   test_copy_external_linksz!TestCopy.test_copy_external_links  s     7# %h66dgenbhwww.?.?@@@UE4888
	(dgenbhwww.?.?@@@@@r   c                 r   g d| j         d<   g d| j         d<   | j         d         }| j         d         }|j        |j        d<   | j                             |dd           |                     | j         d         t          j        g d                     | j         d         j        d         }|                     | j         |         t          j        g d                     |                     | j         |         j        |j                   | j                             d| j	        dd           |                     | j	        d         t          j        g d                     | j	        d         j        d         }|                     | j	        |         t          j        g d                     | j                             d| j	        d	d           |                     | j	        d
         t          j        g d                     |                     | j	        d         t          j        g d                     | j	        d
         j        d         }|                     | j	        |         t          j        g d                     | 
                    | j	        |         | j	        d                    d S )Nr  r+   r  rX  rY  T)expand_refsr   rootzroot/foozroot/bar)r  r   r  r  r]   r[   r>  r  r5   r  r4   )r   r+   rX  baz_barfoo_bars        r   test_copy_refszTestCopy.test_copy_refs	  sM    ! gengen7	%S%T222dgenbhwww.?.?@@@'%.&u-dgg.0A0ABBBDGG,138<<<UDGU===dgenbhwww.?.?@@@'%.&u-dgg.0A0ABBBS$'6t<<<dgj128GGG3D3DEEEdgj128GGG3D3DEEE'*%+E2dgg.0A0ABBB)47:+>?????r   N)r$   r%   r&   r   r"   r   r  r{   versionhdf5_version_tupler  r  r  r  r  r  r  r  r  r  r'   r   r   r  r  c  s       + + +   RYt|.8@B B= =B B= RYt|.8@B BE EB BE RYt|.8@B BE EB BE RYt|.8@B BE EB BE RYt|.8@B BA AB BA( RYt|.8@B BE EB BE( RYt|.8@B B1 1B B1 RYt|.8@B BG GB BG  RYt|.8@B BA AB BA RYt|.8@B B@ @B B@ @ @r   r  c                   *    e Zd ZdZd Zd Zd Zd ZdS )TestMovez7
        Feature: Group.move moves links in a file
    c                 *   | j                             d          }| j                             dd           |                     | j         d         |           | j                             dd           |                     | j         d         |           dS )z Moving an object XYznew/nested/pathN)r   r,   mover4   ru   s     r   test_move_hardlinkzTestMove.test_move_hardlink.  s    f!!#&&Cc***C*+++ 12C88888r   c                     t          j        d          | j        d<   | j                            dd           | j                            dd          }|                     |j        d           dS )z Moving a soft link zrelative/pathr^  new_softTrh  N)r{   r
   r   r  r~   r4   r  )r   lnks     r   test_move_softlinkzTestMove.test_move_softlink6  sb    77vFJ'''fjjTj22?33333r   c                 
   | j                             d           | j                             d           |                     t                    5  | j                             dd           ddd           dS # 1 swxY w Y   dS )z! Move conflict raises ValueError r  r  N)r   r,   r8   r9   r  r   s    r   test_move_conflictzTestMove.test_move_conflict=  s    C   C   z** 	" 	"FKKS!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   A88A<?A<c                 p    | j                             d           | j                             dd           dS )z Test that a null-move works r  N)r   r,   r  r   s    r   test_short_circuitzTestMove.test_short_circuitD  s4    C   Cr   N)r$   r%   r&   rR   r  r   r  r  r'   r   r   r  r  (  sZ         9 9 94 4 4" " "    r   r  c                       e Zd ZdZd Zd ZdS )TestMutableMappingzSTests if the registration of Group as a MutableMapping
    behaves as expected
    c                     t          t          t                    sJ | j                            d          }t          |t                    sJ d S )NK)
issubclassr	   r   r   r,   r   ru   s     r   test_resolutionz"TestMutableMapping.test_resolutionN  sI    %00000f!!#&&#~.......r   c                 ~    t           j         t           j         t           j         t           j         t           j         dS )zC
        Test that the required functions are implemented.
        N)r	   __getitem____setitem____delitem____iter____len__r   s    r   test_validityz TestMutableMapping.test_validityS  s1     	r   N)r$   r%   r&   rR   r
  r  r'   r   r   r  r  J  s<         / / /
    r   r  )1rR   numpyr[   r  os.pathsystempfiler   collections.abcr   commonr   r   r{   r   r	   r
   r   r   r   r   r   h5py._hl.compatr   r  UnicodeEncodeErrorr   r)   rT   re   rm   r   r   r   r   r   r   r   r   r  r(  rO  rm  r  r  r  r  r  r  r'   r   r   <module>r     sT        				  



       * * * * * *                  > > > > > > > > > > > > > > " " " " " " " "       + + + + + +OE MM    MMM       4 4 4 4 4 4 4 4l5 5 5 5 5I 5 5 5$6 6 6 6 6) 6 6 6(:N :N :N :N :N) :N :N :Nz" " " " " " " "H> > > > >y > > >D, , , , ,y , , ,    )   "
: 
: 
: 
: 
:k 
: 
: 
:H) H) H) H) H)9 H) H) H)T    {   (A A A A AY A A A2!2 !2 !2 !2 !2+ !2 !2 !2FR' R' R' R' R' R' R' R'jD9 D9 D9 D9 D9i D9 D9 D9L$F $F $F $F $F $F $F $FL    I   <aB aB aB aB aB aB aB aBF#5 #5 #5 #5 #5h #5 #5 #5LB@ B@ B@ B@ B@x B@ B@ B@J    y   D         s   A A&%A&