
    dn                       d dl Z d dlZd dlZd dl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ZdZn# e$ r dZY nw xY wd dlZd dlZd dlmZ  G d dej                  Z G d d	ej        ej                  Z G d
 de          Z G d de          Z G d de          Z G d dej        ej                  Zej                            ej        j         dk    d           G d dej        ej                              Z! G d dej        ej                  Z" G d dej        ej                  Z# G d dej        ej                  Z$ G d dej        ej                  Z%ej                            ej&        dk     d           G d  d!ej        ej                              Z' G d" d#ej                  Z(ej                            ej)         d$           G d% d&ej*        ej                              Z+d;d'Z,ej                            e d(          ej                             ej-                    .                                d)v d*          ej                            ej)         d$           G d+ d,ej                                                      Z/ G d- d.ej                  Z0 G d/ d0ej                  Z1 G d1 d2ej                  Z2 G d3 d4ej                  Z3 G d5 d6ej                  Z4d7 Z5e6d8k    rA ej7        ej8                    ej9                     ej        :                    d9:           dS dS )<    NPathTF)commonc                   0     e Zd Z fdZd Zd Zd Z xZS )OpenFileFailureTestCasec                     t                                                       t          t          j        j                  | _        t          j        j        | _        d S N)supersetUplentbfile_open_filesN
open_filesself	__class__s    8lib/python3.11/site-packages/tables/tests/test_basics.pyr   zOpenFileFailureTestCase.setUp   s8    RW())'-    c                 <   t          j        d          }|                     t                    5  t	          j        |          }|                                 ddd           n# 1 swxY w Y   |                     | j        t          | j
                             dS )z(Checking opening of a non existing file..h5N)tempfilemktempassertRaisesIOErrorr   	open_filecloseassertEqualr   r   r   r   h5fnameh5files      r   test01_open_filez(OpenFileFailureTestCase.test01_open_file!   s     /%((w'' 	 	\'**FLLNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	T_!5!566666s   )A$$A(+A(c                    t          j        d          }t          |                              d           	 |                     t
          j                  5  t          j        |          }|                                 ddd           n# 1 swxY w Y   | 	                    | j
        t          | j                             t          |                                           dS # t          |                                           w xY w)z.Checking opening of an existing non HDF5 file.r    N)r   r   r   
write_textr   r   HDF5ExtErrorr   r   r   r   r   r   unlinkr    s      r   test02_open_filez(OpenFileFailureTestCase.test02_open_file+   s    /%((W  $$$	#""2?33  g..               TVS%9%9:::MM  """""DMM  """"s/   C' )B C' BC' B0C' '#D
c                 ^   t          j        d          }t          j        |d          }|                                 	 |                     t          t          j        |d           t          |                                           dS # t          |                                           w xY w)z7Checking opening of an existing file with invalid mode.r   wabN)	r   r   r   r   r   r   
ValueErrorr   r(   r    s      r   test03_open_filez(OpenFileFailureTestCase.test03_open_file<   s     /%((gs++	#j",FFFMM  """""DMM  """"s   'B	 	#B,)__name__
__module____qualname__r   r#   r)   r.   __classcell__r   s   @r   r   r      se        . . . . .7 7 7# # #"# # # # # # #r   r   c                       e Zd Z f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 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  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. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZGdF ZHdG ZIdH ZJdI ZK xZLS )JOpenFileTestCasec                 p    t                                                       |                                  d S r	   )r
   r   populateFiler   s    r   r   zOpenFileTestCase.setUpO   s,    r   c                    | j         j        }| j                             |dddgd           | j                             |ddt	          j                    id           d	|j        _        | j                             |d
dgd           | j                             |ddt	          j                    id           | j                             |dd          }d|j        _        | j                             |dg dd          }d|j	        _        | j                             |ddgd           | j                             |ddt	          j                    id           t          j                            dgd          }| j                             |d|d           | j                             |dd           | j                             |dd           }| j                             |d!d"           | j                             |dddgd           d S )#Narray      Array exampletitletablevar1zTable example)   anarrayzArray titleatablezTable titleagroupzGroup title*   anarray1)r:   r;                  Array title 1anarray2Array title 2atable1zTable title 1)r:      azu1,f4,a1)formatsatable2zTable title 2agroup2zGroup title 2agroup3Group title 3agroup4zGroup title 4)r"   rootcreate_arraycreate_tabler   IntCol_v_attrstestattrcreate_groupattrsnprecr9   )r   rX   grouparray1ragroup3s         r   r7   zOpenFileTestCase.populateFileS   s#   { 	  wAo NNN  w0E!0	2 	2 	2!# 	  y1#}EEE  x&")++1F!.	0 	0 	0 ((xGG"$ ))%*?*?*?*9; ; !#  
QCIII  	!'467F	H 	H 	HV\\<.*\==  	2GGG 	  y/BBB ))%OLL 	  ODDD 	  zAq6'6 	! 	8 	8 	8 	8 	8r   c                     | j                             | j         j        dddgd           | j         j        j        j        j        }|                     |                                d           dS )z Checking creation of a new file.	array_newr:   r;   r<   r=   ArrayN)r"   rY   rX   r9   r_   CLASSr   
capitalize)r   class_s     r   test00_newFilezOpenFileTestCase.test00_newFile}   sr     	  !1;A'6 	! 	8 	8 	8 !'-3**,,g66666r   c                 `   t          j                    }	 t          t          |          dz            }t	          j        |d          5 }|                     |t          j                   d d d            n# 1 swxY w Y   t          j	        |           d S # t          j	        |           w xY wNztest.h5r+   )
r   mkdtempstrr   r   r   
assertTrueFileshutilrmtreer   temp_dirr!   r"   s       r   test00_newFile_unicode_filenamez0OpenFileTestCase.test00_newFile_unicode_filename   s    #%%	$$x..9455Ggs++ 1v0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 M(#####FM(####s/   4B 	!A6*B 6A::B =A:>B B-c                 j   t          j                    }	 t          j        t	          |          dz            }t          j        |d          5 }|                     |t
          j                   d d d            n# 1 swxY w Y   t          j
        |           d S # t          j
        |           w xY wrn   )r   ro   r`   str_r   r   r   rq   rr   rs   rt   ru   s       r   !test00_newFile_numpy_str_filenamez2OpenFileTestCase.test00_newFile_numpy_str_filename   s    #%%	$gd8nny899Ggs++ 1v0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 M(#####FM(####/   9B !A;/B ;A??B A?B B2c                 j   t          j                    }	 t          j        t	          |          dz            }t          j        |d          5 }|                     |t
          j                   d d d            n# 1 swxY w Y   t          j
        |           d S # t          j
        |           w xY wrn   )r   ro   r`   unicode_r   r   r   rq   rr   rs   rt   ru   s       r   %test00_newFile_numpy_unicode_filenamez6OpenFileTestCase.test00_newFile_numpy_unicode_filename   s    #%%	$k$x..9"<==Ggs++ 1v0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 M(#####FM(####r{   c                     |                      | j                   | j        j        j                            d          }|                     |d           dS )%Checking opening of an existing file.node_cache_slotsTITLEr<   N)_reopenr   r"   rX   r9   get_attrr   r   r>   s     r   test01_openFilez OpenFileTestCase.test01_openFile   sT     	d&;<<<  &//8800000r   c                 $   | j                                          t          | j                  }t	          j        |          5 }|j        j                            d          }| 	                    |d           ddd           dS # 1 swxY w Y   dS )r   r   r<   N)
r"   r   r   r!   tablesr   rX   r9   r   r   )r   r!   r"   r>   s       r   test01_open_file_pathlibz)OpenFileTestCase.test01_open_file_pathlib   s    t|$$g&& 	5&K%..w77EUO444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s   6BB	B	c                 <   |                      d| j                   | j                            | j        j        dddgd           |                      | j                   | j        j        j                            d	          }|                     |d           d
S )z/Checking appending objects to an existing file.r+moder   array2rG   rH   Title example 2r=   r   r   Nr   r   r"   rY   rX   r   r   r   r   s     r   test02_appendFilez"OpenFileTestCase.test02_appendFile   s     	$1FGGG  !18aV'8 	! 	: 	: 	: 	d&;<<<  '0099 122222r   c                 <   |                      d| j                   | j                            | j        j        dddgd           |                      | j                   | j        j        j                            d	          }|                     |d           d
S )z<Checking appending objects to an existing file ("a" version)rQ   r   r   rG   rH   r   r=   r   r   Nr   r   s     r   test02b_appendFile2z$OpenFileTestCase.test02b_appendFile2   s     	#0EFFF  !18aV'8 	! 	: 	: 	: 	d&;<<<  '0099 122222r   c                 P   |                      d| j                   | j                            | j        j        dddgd           |                      | j                   |                     t                    5  | j        j        j         d	d	d	           d	S # 1 swxY w Y   d	S )
z;Checking appending objects to an existing file in "w" mode.r+   r   r   rG   rH   r   r=   r   N)r   r   r"   rY   rX   r   LookupErrorr9   r   s    r   test03_appendErrorFilez'OpenFileTestCase.test03_appendErrorFile   s    
 	#0EFFF  !18aV'8 	! 	: 	: 	: 	d&;<<<{++ 	# 	#K""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   <BB"Bc                     |                      t                    5  t          j        dd| j                   ddd           dS # 1 swxY w Y   dS )z0Checking opening a non-existing file for readingznonexistent.h5rr   N)r   r   r   r   r   r   s    r   test04a_openErrorFilez&OpenFileTestCase.test04a_openErrorFile   s     w'' 	A 	AL)*.*?A A A A	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A   AA	A	c                 @   |                      d| j                   t          j        rt	          d| j                   | j        j        j                            d          }| j        j        j        }| 	                    |           | 
                    |d           dS )z2Checking alternate root access to the object tree./agrouproot_uepr   z
File tree dump:r   rL   N)r   r   r   verboseprintr"   rX   rF   r   assertIsNotNoner   )r   r>   rF   s      r   test04b_alternateRootFilez*OpenFileTestCase.test04b_alternateRootFile   s     	i&*&; 	 	= 	= 	= > 	4%t{333 )227;; ;#,X&&&00000r   c                     |                      t                    5  |                     d| j                   ddd           dS # 1 swxY w Y   dS )z>Checking non-existent alternate root access to the object treez/nonexistentr   N)r   RuntimeErrorr   r   r   s    r   notest04c_alternateRootFilez,OpenFileTestCase.notest04c_alternateRootFile  s     |,, 	A 	ALL.*.*?  A A A	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	Ar   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j                   ddd           n# 1 swxY w Y   | j                            | j        j        dd           |                      | j                   |                     t                    5  | j        j        j         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&Checking removing a group recursively.r   r   NrD   r:   	recursiver   /agroup/agroup3)r   r   r   r   	NodeErrorr"   remove_noderX   rD   r   get_noder   s    r   test05a_removeGroupRecursivelyz/OpenFileTestCase.test05a_removeGroupRecursively
  s    	$1FGGGr|,, 	= 	=K##DK$4$;<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	 0(aHHH 	d&;<<< {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s5   *A22A69A6C77C;>C;EEEc                    t           j        r,t          dd           t          d| j        j        z             |                     d| j                   |                     t          j	                  5  | j
                            | j
        j        d           ddd           n# 1 swxY w Y   | j
                            | j
        j        dd	           |                     t                    5  | j
        j        j         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 )zKChecking removing a group recursively and access to it
        immediately.
z<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=z,Running %s.test05b_removeGroupRecursively...r   r   rD   Nr:   r   r   )r   r   r   r   r/   r   r   r   r   r   r"   r   rX   r   rD   r   r   s    r   test05b_removeGroupRecursivelyz/OpenFileTestCase.test05b_removeGroupRecursively!  s"    > 	+$	"""@.)* + + + 	$1FGGGr|,, 	@ 	@K##DK$4h???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	 0(aHHH {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s6   4&B&&B*-B*2DDD5EE!$E!c                     |                      d| j                   |                     t                    5  | j        j        `ddd           dS # 1 swxY w Y   dS )z0Checking removing a node using ``__delattr__()``r   r   N)r   r   r   AttributeErrorr"   rX   rD   r   s    r   test06_removeNodeWithDelz)OpenFileTestCase.test06_removeNodeWithDel;  s     	$1FGGG~.. 	( 	(  '	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   AAAc                 F   |                      d| j                   | j                            | j        j        d           |                      | j                   |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z7Checking removing a lonely group from an existing file.r   r   rT   r   N)r   r   r"   r   rX   r   r   rT   r   s    r   test06a_removeGroupz$OpenFileTestCase.test06a_removeGroupE  s     	$1FGGG 0)<<< 	d&;<<< {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%   7BBBc                 F   |                      d| j                   | j                            | j        j        d           |                      | j                   |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z/Checking removing Leaves from an existing file.r   r   rB   r   Nr   r   r"   r   rX   r   r   rB   r   s    r   test06b_removeLeafz#OpenFileTestCase.test06b_removeLeafS  s     	$1FGGG 0)<<< 	d&;<<< {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%r   c                    |                      d| j                   | j                            | j        j        d           |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z3Checking removing Leaves and access it immediately.r   r   rB   Nr   r   s    r   test06c_removeLeafz#OpenFileTestCase.test06c_removeLeaf`  s     	$1FGGG 0)<<< {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   A;;A?A?c                     |                      d| j                   |                     t                    5  | j                            | j        j        d           ddd           dS # 1 swxY w Y   dS )z%Checking removing a non-existent noder   r   nonexistentN)r   r   r   r   r"   r   rX   r   s    r   test06d_removeLeafz#OpenFileTestCase.test06d_removeLeafj  s     	$1FGGG {++ 	E 	EK##DK$4mDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   &A**A.1A.c                 F   |                      d| j                   | j                            | j        j        d           |                      | j                   |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z/Checking removing Tables from an existing file.r   r   rC   r   N)r   r   r"   r   rX   r   r   rC   r   s    r   test06e_removeTablez$OpenFileTestCase.test06e_removeTables  s     	$1FGGG 0(;;; 	d&;<<< {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$r   c                    |                      d| j                   | j                            | j        j        j        d           |                      | j                   | j        j        j        }|                     |j        d           |                     |j	        d           |                     |j
        d           |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z;Checking renaming a leave and access it after a close/open.r   r   rM   r   	/anarray2r:   Nr   r   r"   rename_noderX   rB   rM   r   name_v_pathname_v_depthr   r   r   array_s     r   test07_renameLeafz"OpenFileTestCase.test07_renameLeaf  s6    	$1FGGG 0 8*EEE 	d&;<<< !*j111+[999!,,, {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   C==DDc                    |                      d| j                   | j                            | j        j        j        d           | j        j        j        }|                     |j        d           |                     |j	        d           |                     |j
        d           |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )z7Checking renaming Leaves and accesing them immediately.r   r   rM   r   r:   Nr   r   s     r   test07b_renameLeafz#OpenFileTestCase.test07b_renameLeaf  s    	$1FGGG 0 8*EEE !*j111+[999!,,, {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   C""C&)C&c                 B   |                      d| j                   | j                            | j        j        j        d           | j        j        j        }d|j        _        | 	                    |j
        d           | 	                    |j        j        d           dS )z:Checking renaming Leaves and modify attributes after that.r   r   rM   helloN)r   r   r"   r   rX   rB   rM   r_   r   r   r>   r   s     r   test07c_renameLeafz#OpenFileTestCase.test07c_renameLeaf  s     	$1FGGG 0 8*EEE!*$ 	w///+W55555r   c                     |                      d| j                   | j                            | j        j        j        j        d           | j        j        j        j        }|                     |j	        d           dS )/Checking renaming a Group under a nested group.r   r   anarray3rN   N)
r   r   r"   r   rX   rD   rM   r   r   _v_titler   nodes     r   test07d_renameLeafz#OpenFileTestCase.test07d_renameLeaf  sp     	$1FGGG 0 7 @*MMM {&/88888r   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        d           ddd           n# 1 swxY w Y   | j        j        j        }| j                            |dd           | 	                    d| j                   | 
                    | j        j        j        |           dS )z-Checking renaming a node to an existing name.r   r   r9   NT	overwritez/anarray)r   r   r   r   r   r"   r   rX   rB   assertNotInassertIsr9   )r   rB   s     r   test08_renameToExistingLeafz,OpenFileTestCase.test08_renameToExistingLeaf  s!    	$1FGGG r|,, 	G 	GK##DK$4$<gFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G +"*DAAAT[111dk&,g66666s   +A33A7:A7c                    |                      d| j                   t          j                    5  t          j        dt
          j                   |                     t
          j                  5  | j        	                    | j        j
        j        d           ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )z4Checking renaming a node to a non-valid natural namer   r   errorcategoryzarray 2N)r   r   warningscatch_warningsfilterwarningsr   NaturalNameWarningr   r"   r   rX   rB   r   s    r   #test08b_renameToNotValidNaturalNamez4OpenFileTestCase.test08b_renameToNotValidNaturalName  s\    	$1FGGG$&& 	M 	M#Gb6KLLLL ""2#899 M M''(8(@)LLLM M M M M M M M M M M M M M M		M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	Ms6   A B?0+B'B?'B+	+B?.B+	/B??CCc                    |                      d| j                   | j                            | j        j        j        d           |                      | j                   | j        j        j        }|                     |j        d           |                     |j	        d           | j        
                    d          }|                     |j        d           |                     |j	        d           |                     t                    5  | j        j        j         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;Checking renaming a Group and access it after a close/open.r   r   rU   r   /agroup3/agroup3/agroup3Nr   r   r   r"   r   rX   rD   rU   r   _v_namer   r   r   r   r   rb   group2s      r   test09_renameGroupz#OpenFileTestCase.test09_renameGroup  s    	$1FGGG 0 7CCC 	d&;<<<  (	222*J777 %%&899333+-?@@@ {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s$   D11D58D5E>>FFc                    |                      d| j                   | j                            | j        j        j        d           | j        j        j        }|                     |j        d           |                     |j	        d           | j        
                    d          }|                     |j        d           |                     |j	        d           |                     t                    5  | j        j        j         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 )z4Checking renaming a Group and access it immediately.r   r   rU   r   r   Nr   r   r   s      r   test09b_renameGroupz$OpenFileTestCase.test09b_renameGroup  s    	$1FGGG 0 7CCC  (	222*J777 %%&899333+-?@@@ {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s$   8DDD;E##E'*E'c                 B   |                      d| j                   | j                            | j        j        j        d           | j        j        j        }d|j        _        | 	                    |j
        d           | 	                    |j        j        d           dS )z;Checking renaming a Group and modify attributes afterwards.r   r   rU   HelloN)r   r   r"   r   rX   rD   rU   r\   r   r   r   r   rb   s     r   test09c_renameGroupz$OpenFileTestCase.test09c_renameGroup	  s     	$1FGGG 0 7CCC  (&111-w77777r   c                     |                      d| j                   | j                            | j        j        j        j        d           | j        j        j        j        }|                     |j	        d           dS )r   r   r   rW   rV   N)
r   r   r"   r   rX   rD   rU   rW   r   r   r   s     r   test09d_renameGroupz$OpenFileTestCase.test09d_renameGroup  sp     	$1FGGG 0 7 ?KKK  '/99999r   c                    |                      d| j                   | j        j        j        j        j        }|                     |           | j                            ddd           | 	                    d| j                   | 	                    d| j                   d	D ]P}| 
                    || j                   |                     || j                            |          j                   Qd
S )z>Checking renaming a Group with nested groups in the LRU cache.r   r   /rD   agroup_)r   newnamez/agroup_/agroup4r   )z/agroup_z/agroup_/agroup3z/agroup_/agroup3/agroup4N)r   r   r"   rX   rD   rU   rW   r   r   r   assertInr   r   r   )r   gnewpaths      r   test09e_renameGroupz$OpenFileTestCase.test09e_renameGroup  s    	$1FGGG K#+3Q(IFFF 	+T[999DK0004 	D 	DGMM'4;///--g66BD D D D	D 	Dr   c                 V   |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           |                      | j                   | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           |                     t                    5  | j        j        j         d	d	d	           d	S # 1 swxY w Y   d	S )
z9Checking moving a leave and access it after a close/open.r   r   r   newgrouprM   r   /newgroup/anarray2r;   Nr   r   r"   r^   	move_noderX   rB   r  rM   r   r   r   r   r   r   r   r  r   s      r   test10_moveLeafz OpenFileTestCase.test10_moveLeaf4  sS    	$1FGGG;++C<<dk.6*MMM 	d&;<<< !*3j111+-ABBB!,,, {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%   ?DD"%D"c                     |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )	z;Checking moving a leave and access it without a close/open.r   r   r   r  rM   r  r;   Nr  r  s      r   test10b_moveLeafz!OpenFileTestCase.test10b_moveLeafH  s:    	$1FGGG;++C<<dk.6*MMM !*3j111+-ABBB!,,, {++ 	% 	%K$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%   $DD
Dc                    |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           | j        j        j        j        }d|j	        _
        |                     |j        d           |                     |j	        j
        d           dS )z8Checking moving Leaves and modify attributes after that.r   r   r   r  rM   r   N)r   r   r"   r^   r  rX   rB   r  rM   r_   r   r   r>   r  s      r   test10c_moveLeafz!OpenFileTestCase.test10c_moveLeafY  s     	$1FGGG;++C<<dk.6*MMM!*3$ 	w///+W55555r   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        | j        j        d           ddd           dS # 1 swxY w Y   dS )z+Checking moving a leaf to an existing name.r   r   r9   N)	r   r   r   r   r   r"   r  rX   rB   r   s    r   test10d_moveToExistingLeafz+OpenFileTestCase.test10d_moveToExistingLeaff  s     	$1FGGG r|,, 	E 	EK!! ($+*:GE E E	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E   6A??BBc                 V   |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           |                      | j                   | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           |                     t                    5  | j        j        j         d	d	d	           d	S # 1 swxY w Y   d	S )
z9Checking moving a table and access it after a close/open.r   r   r   r  rS   r   /newgroup/atable2r;   Nr   r   r"   r^   r  rX   rC   r  rS   r   r   r   r   r   r   r   r  table_s      r   test10_2_moveTablez#OpenFileTestCase.test10_2_moveTablep  sS    	$1FGGG;++C<<dk.5xKKK 	d&;<<< !*2i000+-@AAA!,,, {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$r  c                     |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           |                     t                    5  | j        j        j         ddd           dS # 1 swxY w Y   dS )	z;Checking moving a table and access it without a close/open.r   r   r   r  rS   r  r;   Nr  r  s      r   test10_2b_moveTablez$OpenFileTestCase.test10_2b_moveTable  s:    	$1FGGG;++C<<dk.5xKKK !*2i000+-@AAA!,,, {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$r
  c                    |                      d| j                   | j                            dd          }| j        j        j        j        }| j                            | j        j        j        |d           | j        j        j        j	        }| 
                    |j        d           | 
                    |j        d           | 
                    |j        d           |j        }| 
                    |j        |j        j                   |j        }|                                 |                                 | 
                    |j        |dz              d	S )
z@Checking moving a table and use cached row without a close/open.r   r   r   r  rS   r  r;   r:   N)r   r   r"   r^   rX   rC   rowr  r  rS   r   r   r   r   r?   nrowsappendflush)r   r  r  r  r  s        r   test10_2b_bis_moveTablez(OpenFileTestCase.test10_2b_bis_moveTable  s0    	$1FGGG;++C<< k%)dk.5xKKK !*2i000+-@AAA!,,, j+SY-BCCC 	

uqy11111r   c                    |                      d| j                   | j                            dd          }| j                            | j        j        j        |d           | j        j        j        j        }d|j	        _
        |                     |j        d           |                     |j	        j
        d           dS )z8Checking moving tables and modify attributes after that.r   r   r   r  rS   r   N)r   r   r"   r^   r  rX   rC   r  rS   r_   r   r   r>   r  s      r   test10_2c_moveTablez$OpenFileTestCase.test10_2c_moveTable  s     	$1FGGG;++C<<dk.5xKKK!*2$ 	w///+W55555r   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        | j        j        d           ddd           dS # 1 swxY w Y   dS )z,Checking moving a table to an existing name.r   r   r?   N)	r   r   r   r   r   r"   r  rX   rC   r   s    r   test10_2d_moveToExistingTablez.OpenFileTestCase.test10_2d_moveToExistingTable  s     	$1FGGG r|,, 	+ 	+K!!$+"2"94;;K")+ + +	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+r  c                     |                      d| j                   | j        j        j        }| j                            || j        j        dd           | j        j        j        }|                     ||           dS )z<Checking moving a table to an existing name, overwriting it.r   r   r?   Tr   N)r   r   r"   rX   rC   r  r?   r   r   srcNodedstNodes      r   &test10_2e_moveToExistingTableOverwritez7OpenFileTestCase.test10_2e_moveToExistingTableOverwrite  s~     	$1FGGG+")gt{'7(, 	 	. 	. 	.+"(gw'''''r   c                    |                      d| j                   | j                            | j        j        d          }| j                            | j        j        j        |d           |                      | j                   | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           | j                            d          }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d	           |                     t                    5  | j        j        j         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 )z9Checking moving a Group and access it after a close/open.r   r   r  rU   r   /newgroup/agroup3r;   /newgroup/agroup3/agroup3rG   Nr   r   r   r"   r^   rX   r  rD   r  rU   r   r   r   r   r   r   r   r   r  rb   r   s       r   test11_moveGroupz!OpenFileTestCase.test11_moveGroup  s<    	$1FGGG;++DK,<jIIdk.5xKKK 	d&;<<<  )1	222*,?@@@+++ %%&ABB333+-HIII!,,, {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s$   4FFF7GG#&G#c                    |                      d| j                   | j                            | j        j        d          }| j                            | j        j        j        |d           | j        j        j        j        }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           | j                            d          }| 	                    |j
        d           | 	                    |j        d           | 	                    |j        d           |                     t                    5  | j        j        j         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 )z2Checking moving a Group and access it immediately.r   r   r  rU   r(  r;   r)  rG   Nr   r*  r+  s       r   test11b_moveGroupz"OpenFileTestCase.test11b_moveGroup  s#    	$1FGGG;++DK,<jIIdk.5xKKK  )1	222*,?@@@+++ %%&ABB333+-HIII!,,, {++ 	$ 	$K##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ {++ 	4 	4K  !2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s$   E77E;>E;GGGc                    |                      d| j                   | j                            | j        j        d          }| j                            | j        j        j        |d           | j        j        j        j        }d|j	        _
        d|j	        _        |                     |j        d           |                     |j	        j
        d           |                     |j	        j        d           dS )z9Checking moving a Group and modify attributes afterwards.r   r   r  rU   r   N)r   r   r"   r^   rX   r  rD   r  rU   r\   r   holar   r   )r   r  rb   s      r   test11c_moveGroupz"OpenFileTestCase.test11c_moveGroup  s     	$1FGGG;++DK,<jIIdk.5xKKK  )1&%111-w777,g66666r   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        | j        j        d           ddd           dS # 1 swxY w Y   dS )z,Checking moving a group to an existing name.r   r   rT   N)	r   r   r   r   r   r"   r  rX   rD   r   s    r   test11d_moveToExistingGroupz,OpenFileTestCase.test11d_moveToExistingGroup  s     	$1FGGG r|,, 	- 	-K!!$+"2"94;;K"+- - -	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-r  c                     |                      d| j                   | j        j        j        }| j                            || j        j        dd           | j        j        j        }|                     ||           dS )z<Checking moving a group to an existing name, overwriting it.r   r   rD   Tr   N)r   r   r"   rX   rT   r  rD   r   r#  s      r   $test11e_moveToExistingGroupOverwritez5OpenFileTestCase.test11e_moveToExistingGroupOverwrite&  s     	$1FGGG +"*gt{'7(, 	 	. 	. 	.+")gw'''''r   c                     |                      d| j                   | j        j        j        }| j                            || j        j        d           | j        j        j        }|                     ||           dS )z#Checking moving a node over itself.r   r   r9   N)r   r   r"   rX   r9   r  r   r#  s      r   test12a_moveNodeOverItselfz+OpenFileTestCase.test12a_moveNodeOverItself3  sr     	$1FGGG +"(gt{'7AAA+"(gw'''''r   c                     |                      d| j                   |                     t          j                  5  | j                            | j        j        j        | j        j        j                   ddd           dS # 1 swxY w Y   dS )z$Checking moving a group into itself.r   r   N)	r   r   r   r   r   r"   r  rX   rT   r   s    r   test12b_moveGroupIntoItselfz,OpenFileTestCase.test12b_moveGroupIntoItself?  s     	$1FGGGr|,, 	< 	<K!!$+"2":"&+"2":< < <	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<s   :BB
Bc                    |                      d| j                   | j                            | j        j        j        | j        j        j                  }| j        j        j        j        }|                     ||           dS )zCopying a leaf.r   r   N)r   r   r"   	copy_noderX   r9   rT   r   r   new_noder%  s      r   test13a_copyLeafz!OpenFileTestCase.test13a_copyLeafH  sw     	$1FGGG ;(()9)?)-)9)AC C+"*0h(((((r   c                    |                      d| j                   | j                            | j        j        j        | j        j        j                  }| j        j        j        j        }|                     ||           dS )zCopying a group.r   r   Nr   r   r"   r;  rX   rT   rD   r   r<  s      r   test13b_copyGroupz"OpenFileTestCase.test13b_copyGroupT  sw     	$1FGGG ;(()9)A)-)9)@B B+")1h(((((r   c                    |                      d| j                   | j                            | j        j        j        | j        j        j                  }| j        j        j        j        }|                     ||           dS )zCopying a group into itself.r   r   N)r   r   r"   r;  rX   rT   r   r<  s      r   test13c_copyGroupSelfz&OpenFileTestCase.test13c_copyGroupSelf`  sw     	$1FGGG ;(()9)A)-)9)AC C+"*2h(((((r   c                    |                      d| j                   | j                            | j        j        j        | j        j        j        d          }| j        j        j        j        }|                     ||           |j        }| 	                    |           |j
        }| 	                    |           |j        }| 	                    |           dS )zRecursively copying a group.r   r   Tr   N)r   r   r"   r;  rX   rD   rT   r   rF   r   rM   rU   )r   r=  r%  	dstChild1	dstChild2	dstChild3s         r   test13d_copyGroupRecursivez+OpenFileTestCase.test13d_copyGroupRecursivel  s     	$1FGGG ;((K#T[%5%= ) O O+"*1h((($	Y'''$	Y'''O	Y'''''r   c                    |                      d| j                   t          j        d          }t	          j        |d| j                  }	 | j                            | j        j        |j        d          }|j        }| 	                    ||           | 
                    d|           | 
                    d|           | 
                    d	|           |                                 t          |                                           d
S # |                                 t          |                                           w xY w)zARecursively copying the root group into the root of another file.r   r   r   r+   Tr   r   z/agroup/anarray1r   N)r   r   r   r   r   r   r"   r;  rX   r   r   r   r   r(   r   h5fname2h5file2r=  r%  s        r   test13e_copyRootRecursivez*OpenFileTestCase.test13e_copyRootRecursive~  s4    	$1FGGG?5)),31FH H H	${,, ',$ - @ @HlGMM(G,,,MM)W---MM,g666MM+W555 MMOOONN!!##### MMOOONN!!####s   BD 7Ec                    |                      d| j                   t          j        d          }t	          j        |d| j                  }	 |                    dd           | j                            | j        j	        |j	        j
        d          }|j	        j
        }|                     ||           |                     d	|           |                     d
|           |                     d|           |                                 t          |                                           dS # |                                 t          |                                           w xY w)z@Recursively copying the root group into a group in another file.r   r   r   r+   r   rT   Tr   z/agroup2/agroupz/agroup2/agroup/anarray1z/agroup2/agroup/agroup3N)r   r   r   r   r   r   r^   r"   r;  rX   rT   r   r   r   r   r(   rJ  s        r   test13f_copyRootRecursivez*OpenFileTestCase.test13f_copyRootRecursive  sS    	$1FGGG?5)),31FH H H	$  i000 {,, ',"6$ - H HHl*GMM(G,,,MM+W555MM4g>>>MM3W=== MMOOONN!!##### MMOOONN!!####s   B+D0 07E'c                     |                      d| j                   | j        j        }|                     |           |                     t          | j        j        | j        j        | j        j        d           dS )z/Recursively copying the root group into itself.r   r   Tr   N)r   r   r"   rX   r   r   r   r;  )r   rT   s     r   test13g_copyRootItselfz'OpenFileTestCase.test13g_copyRootItself  s     	$1FGGG+"W%%% 	'4;#8+*DK,< 	 	N 	N 	N 	N 	Nr   c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        d           ddd           dS # 1 swxY w Y   dS )zCopying over an existing node.r   r   rD   r   N)	r   r   r   r   r   r"   r;  rX   rT   r   s    r   test14a_copyNodeExistingz)OpenFileTestCase.test14a_copyNodeExisting  s     	$1FGGGr|,, 	N 	NK!!$+"2":H!MMM	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N   ,A55A9<A9c                     |                      d| j                   | j                            | j        j        j        dd          }| j        j        j        }|                     ||           dS )z.Copying over an existing node, overwriting it.r   r   rD   Tr   r   Nr@  r<  s      r   !test14b_copyNodeExistingOverwritez2OpenFileTestCase.test14b_copyNodeExistingOverwrite  ss     	$1FGGG ;(()9)A19T ) K K+")h(((((r   c                 |   |                      d| j                   t          j        d          }t	          j        |d| j                  }	 | j                            | j        j        j	        j
        |j                  }| j                            | j        j        |j        dd          }|j        }|                     ||           |                                 t          |                                           dS # |                                 t          |                                           w xY w)	z<Copying over an existing node in other file, overwriting it.r   r   r   r+   )	newparentT)r   r   N)r   r   r   r   r   r   r"   r;  rX   rD   rF   r   r   r   r(   rJ  s        r   "test14b2_copyNodeExistingOverwritez3OpenFileTestCase.test14b2_copyNodeExistingOverwrite  s(    	$1FGGG?5)),31FH H H	${,,T[-=-D-M7>| - E EH {,,T[-=w|7;t - M MHlGMM(G,,,MMOOONN!!##### MMOOONN!!####s   A?D 7D;c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        d           ddd           dS # 1 swxY w Y   dS )zCopying over self.r   r   rD   rS  N	r   r   r   r   r   r"   r;  rX   rD   r   s    r   test14c_copyNodeExistingSelfz-OpenFileTestCase.test14c_copyNodeExistingSelf  s     	$1FGGGr|,, 	M 	MK!!$+"2"98!LLL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	MrU  c                    |                      d| j                   |                     t          j                  5  | j                            | j        j        j        dd           ddd           dS # 1 swxY w Y   dS )z'Copying over self, trying to overwrite.r   r   rD   TrW  Nr]  r   s    r   %test14d_copyNodeExistingOverwriteSelfz6OpenFileTestCase.test14d_copyNodeExistingOverwriteSelf  s     	$1FGGGr|,, 	K 	KK!! 'T " K K K	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	Ks   -A66A:=A:c                 $   |                      d| j                   |                     t          j                  5  | j                            | j        j        j        | j        j        j        d           ddd           dS # 1 swxY w Y   dS )z(Recursively copying a group into itself.r   r   Tr   Nr]  r   s    r   test14e_copyGroupSelfRecursivez/OpenFileTestCase.test14e_copyGroupSelfRecursive  s     	$1FGGGr|,, 	K 	KK!!$+"2"9"&+"2"9T " K K K	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	Ks   <BB	B	c                    |                      d| j                   | j        j        j        }| j                            || j        j        j        d           | j        j        j        j        }|                     ||           dS )z.Moving and renaming a node in a single action.r   r   r9   N)	r   r   r"   rX   rF   r  rD   r9   r   r#  s      r   test15a_oneStepMovez$OpenFileTestCase.test15a_oneStepMove   sx     	$1FGGG +"+gt{'7'>HHH+")/gw'''''r   c                 
   |                      d| j                   | j                            | j        j        j        | j        j        j        d          }| j        j        j        j        }|                     ||           dS )z/Copying and renaming a node in a single action.r   r   r9   N)	r   r   r"   r;  rX   rF   rD   r9   r   r<  s      r   test15b_oneStepCopyz$OpenFileTestCase.test15b_oneStepCopy  sy     	$1FGGG ;((K%t{'7'>I I+")/h(((((r   c                 ,   |                      d| j                   | j        j        j        }| j                            |dd          }| j        j        j        }|                     ||           |                     |j	        j
        |j	        j
                   |                     |j        j        j
        |j        j        j
                   |                     |j                                        |j                                                   dS )z&Copying full data and user attributes.r   r   	groupcopyTr   r   N)r   r   r"   rX   rD   r;  rh  r   r   r\   r]   rF   r_   readr   r$  r=  r%  s       r   test16a_fullCopyz!OpenFileTestCase.test16a_fullCopy  s     	$1FGGG +");(([D ) : :+",h((()2G4D4MNNN"+W-=-C-L	N 	N 	N)..00'2B2G2G2I2IJJJJJr   c           	      4   |                      d| j                   | j        j        j        }| j                            |dddddd	          }| j        j        j        }|                     ||           |                     t          |j
        d
                     |                     t          |j        j        d
                     |                     |j                                        ddd         |j                                                   dS )z,Copying partial data and no user attributes.r   r   rh  TFr   rI   r;   )r   r   copyuserattrsstartstopstepr]   N)r   r   r"   rX   rD   r;  rh  r   assertFalsehasattrr\   rF   r_   r   rj  rk  s       r   test16b_partialCopyz$OpenFileTestCase.test16b_partialCopy)  s    	$1FGGG +");(([%!! ) % % +",h(((!1:>>???!1!7DDEEE)..001Q !(!1!6!6!8!8	: 	: 	: 	: 	:r   c                    |                      d| j                   t          j        d          }t	          j        |d| j                  }	 | j        j        }| j                            ||j        dd          }|j        j	        }| 
                    ||           |                     |j        j        |j        j                   |                     |j        j        j        j        |j        j        j        j                   |                     |j        j                                        |j        j                                                   |                                 t'          |                                           dS # |                                 t'          |                                           w xY w)	z:Copying full data and user attributes (from file to file).r   r   r   r+   rh  Tri  N)r   r   r   r   r   r   r"   rX   r;  rh  r   r   r\   r]   rD   rF   r_   rj  r   r   r(   )r   rK  rL  r$  r=  r%  s         r   test16c_fullCopyz!OpenFileTestCase.test16c_fullCopy<  s    	$1FGGG?5)),31FH H H	$k&G{,,{d - L LHl,GMM(G,,,W-6$-68 8 8'-6'-68 8 8 W^499;;$^499;;= = = MMOOONN!!##### MMOOONN!!####s   DF 7Gc                    |                      d| j                   | j        j        j        }| j                            |dd          }|                     |j        d           |                     |j        |j                   dS )z"Copying dataset with a chunkshape.r   r   	tablecopyrP   r   
chunkshape)rP   N)	r   r   r"   rX   r?   r;  r   rz  assertNotEqualr   srcTablenewTables      r   test17a_CopyChunkshapez'OpenFileTestCase.test17a_CopyChunkshapeX  s     	$1FGGG;#);((kb ) : : 	,e444H/1DEEEEEr   c                     |                      d| j                   | j        j        j        }| j                            |dd          }|                     |j        |j                   dS )z4Copying dataset with a chunkshape with 'keep' value.r   r   rx  keepry  Nr   r   r"   rX   r?   r;  r   rz  r|  s      r   test17b_CopyChunkshapez'OpenFileTestCase.test17b_CopyChunkshapec  sq     	$1FGGG;#);((kf ) > > 	,h.ABBBBBr   c                    |                      d| j                   | j        j        j        }| j                            |dd          }| j                            |dd          }|                     |j        |j                   dS )	z4Copying dataset with a chunkshape with 'auto' value.r   r   rx  rP   ry  
tablecopy2autoNr  )r   r}  r~  	newTable2s       r   test17c_CopyChunkshapez'OpenFileTestCase.test17c_CopyChunkshapem  s     	$1FGGG;#);((kb ) : :K))lv * ? ?	 	,i.BCCCCCr   c                 :   |                      | j                   | j        j        j        | j        j        j        fD ]\}|                                 |                     dt          |                     |                     dt          |                     ]dS )z'Representing a closed node as a string.r   closedN)
r   r   r"   rX   rD   rB   _f_closer   rp   reprr   s     r   test18_closedReprz"OpenFileTestCase.test18_closedRepry  s     	d&;<<<[%,dk.>.FG 	0 	0DMMOOOMM(CII...MM(DJJ////	0 	0r   c                     |                      d| j                   | j                                        }t          j        rt          d|           |                     |d           dS )z*Checking that the 'fileno()' method works.r   r   zValue of fileno():r   N)r   r   r"   filenor   r   r   assertGreaterEqual)r   fds     r   test19_filenozOpenFileTestCase.test19_fileno  si     	#0EFFF [!!> 	,&+++A&&&&&r   )Mr/   r0   r1   r   r7   rl   rw   rz   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r	  r  r  r  r  r  r  r!  r&  r,  r.  r1  r3  r5  r7  r9  r>  rA  rC  rH  rM  rO  rQ  rT  rX  r[  r^  r`  rb  rd  rf  rl  rt  rv  r  r  r  r  r  r2   r3   s   @r   r5   r5   M   s           (8 (8 (8T	7 	7 	7$ $ $$ $ $$ $ $	1 	1 	15 5 53 3 3 3 3 3$# # # A A A1 1 1(A A A4 4 4.4 4 44( ( (% % %% % %% % %E E E$ $ $% % %&% % % 
6 
6 
69 9 97 7 7
M 
M 
M4 4 484 4 42
8 
8 
8: : :D D D*% % %(% % %"6 6 6E E E$ $ $($ $ $"2 2 246 6 6+ + +
( 
( 
(4 4 4>4 4 487 7 7- - -( ( (
( 
( 
(< < <
) 
) 
)
) 
) 
)
) 
) 
)( ( ($$ $ $,$ $ $0	N 	N 	NN N N
) 
) 
)$ $ $.M M MK K KK K K
( 
( 
(
) 
) 
)K K K": : :&$ $ $8	F 	F 	FC C C
D 
D 
D0 0 0
' 
' 
' 
' 
' 
' 
'r   r5   c                   >    e Zd Zej        j        Z ee          ZdS )NodeCacheOpenFiler   N	r/   r0   r1   r   
parametersNODE_CACHE_SLOTSr   dictopen_kwargs r   r   r  r    s,        }5$(8999KKKr   r  c                   *    e Zd ZdZ ee          ZdS )NoNodeCacheOpenFiler   r   N)r/   r0   r1   r   r  r  r  r   r   r  r    s'        $(8999KKKr   r  c                   @    e Zd Zej        j         Z ee          ZdS )DictNodeCacheOpenFiler   Nr  r  r   r   r  r    s/        66$(8999KKKr   r  c                        e Zd Z fdZ fdZd Zd Zd Zej	        
                     eed          o ej                    dk    d          d	             Zd
 Zd Zd Zd Zd Zd Zd Z xZS )CheckFileTestCasec                    t                                                       t          j        d          | _        t          | j        d          | _        | j                            d           | j                                         d S )Nr   r+   zHello!)	r
   r   r   r   txtfileopenfilehwriter   r   s    r   r   zCheckFileTestCase.setUp  sj      u--$,,,

"""
r   c                     | j                                          t          | j                                                   t                                                       d S r	   )r  r   r   r  r(   r
   tearDownr   s    r   r  zCheckFileTestCase.tearDown  sO    
T\!!###r   c                 ^   | j                             | j         j        dddgd           | j                                          t          j        r0t          d| j        t          j	        | j                  fz             | 
                    t          j	        | j                  d           dS )z2Checking  tables.is_hdf5_file function (TRUE case)r9   r:   r;   Title exampler=   z
isHDF5File(%s) ==> %dN)r"   rY   rX   r   r   r   r   r!   r   is_hdf5_filer   r   s    r   test00_isHDF5Filez#CheckFileTestCase.test00_isHDF5File  s     	  !17QF'6 	! 	8 	8 	8 	 > 	>+bodl;;/= = > > >66:::::r   c                 d    t          j        | j                  }|                     |d           dS )z3Checking  tables.is_hdf5_file function (FALSE case)r   N)r   r  r  assertLessEqualr   versions     r   test01_isHDF5Filez#CheckFileTestCase.test01_isHDF5File  s3     /$,// 	Wa(((((r   c                 R    |                      t          t          j        d           dS )z$Identifying a nonexistent HDF5 file.r   N)r   r   r   r  r   s    r   test01x_isHDF5File_nonexistentz0CheckFileTestCase.test01x_isHDF5File_nonexistent  s"    'BO]CCCCCr   getuidr   zno UIDc                     | j                                          t          | j                                      d           |                     t          t          j        | j                   dS )z$Identifying an unreadable HDF5 file.r   N)	r"   r   r   r!   chmodr   r   r   r  r   s    r   test01x_isHDF5File_unreadablez/CheckFileTestCase.test01x_isHDF5File_unreadable  sX    
 	T\  ###'BOT\BBBBBr   c                 B   | j                             | j         j        dddgd           | j                                          t	          j        | j                  }t          j        r t                       t          d|z             | 
                    |d           dS )	z.Checking is_pytables_file function (TRUE case)r9   r:   r;   r  r=   &
PyTables format version number ==> %sz1.0N)r"   rY   rX   r   r   is_pytables_filer!   r   r   r   r  r  s     r   test02_isPyTablesFilez'CheckFileTestCase.test02_isPyTablesFile  s     	  !17"#Q 	! 	@ 	@ 	@ 	%dl33 > 	GGGG;gEFFF/////r   c                     t          j        | j                  }t          j        r t                       t          d|z             |                     |           dS )z/Checking is_pytables_file function (FALSE case)r  N)r   r  r  r   r   r   assertIsNoner  s     r   test03_isPyTablesFilez'CheckFileTestCase.test03_isPyTablesFile  sZ     %dl33 > 	GGGG;gEFFF'"""""r   c                    t          j        d          }t          j        |d          5 }|                    dd          }|                     |j        d           |                    |dd	          }|                     |j        d           |                    |d
d	          }|                     |j        d
           t           j        r5t          dt          |                     t          d|dd                    |                    ddd          }|                     |j        d           ddd           dS # 1 swxY w Y   dS )z(Checking opening of a generic HDF5 file.ex-noattr.h5r   r   z/columnsGroup)	classnamecolumnsTDCrh   pressurez$Array object with type H5T_ARRAY -->zArray contents -->Nz	/detectorr?   Table)
r   test_filenamer   r   r   r   r   r   r   r  )r   r!   r"   r  r   uir?   s          r   test04_openGenericHDF5Filez,CheckFileTestCase.test04_openGenericHDF5File  s    &~66\',,, 	5 oojGoDDGW_i888 __Wew_GGFV^U333
 *HHBRZ444~ 3<d2hhGGG*BqqqE222 OOKGOLLEU]G444-	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s   DEE	E	c                 V   t          j        d          }t          j        |          5 }|                     t
                    5  |                    d          }ddd           n# 1 swxY w Y   |                     |t          j                   ddd           dS # 1 swxY w Y   dS )z@Checking failure loading resulting in an ``UnImplemented`` node.smpl_unsupptype.h5/CompoundChunkedN)	r   r  r   r   assertWarnsUserWarningr   assertIsInstanceUnImplemented)r   r!   r"   r   s       r   test04b_UnImplementedOnLoadingz0CheckFileTestCase.test04b_UnImplementedOnLoading  s    &';<<\'"" 	:f!!+.. ; ;'9::; ; ; ; ; ; ; ; ; ; ; ; ; ; ;!!$(8999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s5   BA&B&A*	*B-A*	.#BB"%B"c                 R   t          j        t          j        d                    5 }|                     t
                    5  |                    d          }ddd           n# 1 swxY w Y   |                     |t           j                   ddd           dS # 1 swxY w Y   dS )zVChecking opening of HDF5 files containing scalar dataset of
        UnImlemented type.z	scalar.h5z/variable length stringN)	r   r   r   r  r  r  r   r  r  )r   r"   r   s      r   test04c_UnImplementedScalarz-CheckFileTestCase.test04c_UnImplementedScalar  s%    \&.{;;<< 	:!!+.. B B'@AAB B B B B B B B B B B B B B B!!$(8999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s5   BA$B$A(	(B+A(	,#BB #B c                 V   t          j        d          }t          j        |d          5 }|                     t
          |j        d           t          j                    5  t          j	        d           |                    d          }ddd           n# 1 swxY w Y   | 
                    |j        d           t           j        rt          dt          |                     |                     t
          |j        | j        j        d	           ddd           dS # 1 swxY w Y   dS )
7Checking that an UnImplemented object cannot be copied.r  r   r  r  ignoreNCompoundChunkedUnImplement object -->newui)r   r  r   r   r  r  r   r   r   simplefilterr   r   r   r   r  copyr"   rX   )r   r!   r"   r  s       r   test05_copyUnimplementedz*CheckFileTestCase.test05_copyUnimplemented(  s    &';<<\',,, 
	N[&/;MNNN(** 9 9%h///__%7889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 RZ):;;;~ :.R999 ["'4;3CWMMM
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	N 
	Ns6   5D *B
DB	DB	A3DD"%D"c                    t          j        d          }t          j        |d          5 }|                    |j        j        d          }|                     |j        d           t           j	        rt          dt          |                     t          j                    5  t          j        dt                     |                     t                    5  |                    | j        j        d           d	d	d	           n# 1 swxY w Y   d	d	d	           n# 1 swxY w Y   d	d	d	           d	S # 1 swxY w Y   d	S )
r  r  r   r  r  r  r   r   r  N)r   r  r   r   r   rX   r  r   r   r   r   r  r   r   r   r  r   r  r"   )r   rK  rL  r  s       r   _test05_copyUnimplementedz+CheckFileTestCase._test05_copyUnimplemented;  s    '77\(--- 	7 !!',"6
CCBRZ444~ :.R999 (** 7 7'+FFFF&&{33 7 7GGDK,g6667 7 7 7 7 7 7 7 7 7 7 7 7 7 77 7 7 7 7 7 7 7 7 7 7 7 7 7 7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7sZ   A8D5#6D!D:DD

DD
DD5D!	!D5$D!	%D55D9<D9)r/   r0   r1   r   r  r  r  r  r   unittest
skipUnlessrs  osr  r  r  r  r  r  r  r  r  r2   r3   s   @r   r  r    sC               
; ; ; ) ) )D D D _H 5 5 J)")++:J (* *C C* *C0 0 0&
# 
# 
#5 5 5:: : :: : :N N N&7 7 7 7 7 7 7r   r  strictzFILE_OPEN_POLICY = "strict"c                   $     e Zd Z fdZd Z xZS )ThreadingTestCasec                     t                                                       | j                            ddt	          j                    d           | j                                         d S )Nr   
test_array)   i,  )r
   r   r"   create_carrayr   	Int64Atomr   r   s    r   r   zThreadingTestCase.setUpU  sW    !!#|R\^^",	. 	. 	.r   c                   	 t          j                    fd	fd| j        }	fd}g }t          j                    }t          d          D ]C}t          j        |||f          }|                                 |                    |           Dt          d          D ]*}| 	                    |
                                d           +|D ]}|                                 d S )Nc                  ^    5  t          j        | i |cd d d            S # 1 swxY w Y   d S r	   )r   r   )argskwargslocks     r   syncronized_open_filez5ThreadingTestCase.test.<locals>.syncronized_open_file^  s     5 5|T4V445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s   "&&c                 V    5   | j         |i |cd d d            S # 1 swxY w Y   d S r	   )r   )r   r  r  r  s      r   syncronized_close_filez6ThreadingTestCase.test.<locals>.syncronized_close_fileb  s     3 3!tz426223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   ""c                 l   	  | d          }|j         j        ddddf         }|                                |                                cxk    rdk    sn J  |           |                    d           d S # t
          $ r* |                    t          j                               Y d S w xY w)	Nr   r              r   OK)rX   r  maxminput	Exceptionsysexc_info)filenameqfarrr  r  s       r   runz#ThreadingTestCase.test.<locals>.runh  s    ))(===f'"be4wwyyCGGII2222222222&&q))) d  & & &clnn%%%%%%&s   A%A? ?0B32B3
   targetr  r  )	threadingLockr!   queueQueuerangeThreadro  r  r   getjoin)
r   r  r  threadsr  itr  r  r  s
          @@@r   testzThreadingTestCase.test[  s+   ~	5 	5 	5 	5 	5	3 	3 	3 	3 	3 <		 		 		 		 		 		 KMMr 	 	A 8Q-@@@AGGIIINN1r 	, 	,AQUUWWd++++ 	 	AFFHHHH	 	r   )r/   r0   r1   r   r  r2   r3   s   @r   r  r  R  sG            # # # # # # #r   r  c                   *    e Zd ZdZd Zd Zd Zd ZdS )PythonAttrsTestCasez7Test interactions of Python attributes and child nodes.c                    | j         j        }| j                             |ddg          }d}|                     t          j        t          |d|           |                     |j        |           |                     |	                    d          |           |`|                     |j        |           | 
                    t          t          |d           dS )z-Setting a Python attribute over a child node.r  r:   foobarN)r"   rX   rY   r  r   r   setattrr   r  _f_get_childr   r   delattr)r   rX   childattrs       r   test00_attrOverChildz(PythonAttrsTestCase.test00_attrOverChild  s     { ((vs;;.vtLLLdi&&&d''//777 Idi''' 	.!4	1 	1 	1 	1 	1r   c                    | j         }|j        }d}||_        |                     t          j        |j        |ddg           |                    d          }|                     |j        |           |                     |	                    d          |           |`|                     |j        |           | 
                    t          t          |d           dS )z/Creating a child node under a Python attribute.r  r  r:   /testN)r"   rX   r  r  r   r   rY   r   r   r  r   r   r  )r   r"   rX   r  r  s        r   test01_childUnderAttrz)PythonAttrsTestCase.test01_childUnderAttr  s     { 	.,dFQC	A 	A 	A((di&&&d''//777 Idi''' 	.'4@@@@@r   c                    | j         }|                    dddg          }|                    dddg          }||_        ||_        |                     |j        |           |                     |j        |           |                     t          j        |j        d           |                     t          j        |j        d           dS )z9Assigning a ``Node`` value as an attribute to a ``Leaf``.r   rc   r:   r   z/array1/array2z/array2/array3N)	r"   rY   r   rc   r   r   r   NoSuchNodeErrorr   )r   r"   rc   r   s       r   test02_nodeAttrInLeafz)PythonAttrsTestCase.test02_nodeAttrInLeaf  s     $$S(QC88$$S(QC88  	fmV,,,fmV,,,", /+;	= 	= 	=", /+;	= 	= 	= 	= 	=r   c                    | j         }|j        }|                    dddg          }||_        |                     t
          j        t          |d|           |                     |j        |           |                     |j	        |           | 
                    t
          j        |j        d           |                     |                    d          |           |`	| 
                    t          t          |d           dS )z:Assigning a ``Node`` value as an attribute to a ``Group``.r   r9   r:   z/arrayAlias/arrayN)r"   rX   rY   
arrayAliasr  r   r   r  r   r9   r   r   r   r   r  )r   r"   rX   r9   s       r   test03_nodeAttrInGroupz*PythonAttrsTestCase.test03_nodeAttrInGroup  s     {##C1#66  .wNNN 	dou---dj%(((",fo}MMMfooh//777 J 	.'4AAAAAr   N)r/   r0   r1   __doc__r  r  r!  r%  r  r   r   r  r    s^        AA1 1 1,A A A0= = =(B B B B B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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 Zd ZdS )StateTestCasezzTest that ``File`` and ``Node`` operations check their state (open or
    closed, readable or writable) before proceeding.c                    | j                                          t          j        d          }	 |                     t
          j        | j         j        |           t          |          	                                r#t          |          
                                 dS dS # t          |          	                                r"t          |          
                                 w w xY w)zTest copying a closed file.r   suffixN)r"   r   r   r   r   r   ClosedFileError	copy_filer   is_filer(   )r   h5cfnames     r   test00_fileCopyFileClosedz'StateTestCase.test00_fileCopyFileClosed  s     	?%000	(b0"k3X? ? ? H~~%%'' (X%%'''''( (tH~~%%'' (X%%''''(s   +B! !AC&c                     | j                                          	 | j                                          dS # t          j        $ r |                     d           Y dS w xY w)z$Test closing an already closed file.z&could not close an already closed fileN)r"   r   r   r,  failr   s    r   test01_fileCloseClosedz$StateTestCase.test01_fileCloseClosed  sv     		@K! 	@ 	@ 	@II>??????	@s   6 $AAc                     | j                                          |                     t          j        | j         j                   dS )zTest flushing a closed file.N)r"   r   r   r   r,  r  r   s    r   test02_fileFlushClosedz$StateTestCase.test02_fileFlushClosed  s<     	",dk.?@@@@@r   c                     |                      d           	 | j                                         dS # t          j        $ r |                     d           Y dS w xY w)zFlushing a read-only file.r   z could not flush a read-only fileN)r   r"   r  r   FileModeErrorr2  r   s    r   test03_fileFlushROz StateTestCase.test03_fileFlushRO  so     	S	:K 	: 	: 	:II8999999	:s   2 $AAc                     | j                                          |                     t          j        | j         j        dd           dS )z&Test creating a node in a closed file.r   r  N)r"   r   r   r   r,  r^   r   s    r   test04_fileCreateNodeClosedz)StateTestCase.test04_fileCreateNodeClosed  sP     	",+2C	A 	A 	A 	A 	Ar   c                     |                      d           |                     t          j        | j        j        dd           dS )z)Test creating a node in a read-only file.r   r   r  N)r   r   r   r7  r"   r^   r   s    r   test05_fileCreateNodeROz%StateTestCase.test05_fileCreateNodeRO  sN     	S"*+2C	A 	A 	A 	A 	Ar   c                     | j                             dd           | j                                          |                     t          j        | j         j        dd           dS )z(Test removing a node from a closed file.r   r  N)r"   r^   r   r   r   r,  r   r   s    r   test06_fileRemoveNodeClosedz)StateTestCase.test06_fileRemoveNodeClosed  sh     	  f---",+13	@ 	@ 	@ 	@ 	@r   c                     | j                             dd           |                     d           |                     t          j        | j         j        dd           dS )z+Test removing a node from a read-only file.r   r  r   N)r"   r^   r   r   r   r7  r   r   s    r   test07_fileRemoveNodeROz%StateTestCase.test07_fileRemoveNodeRO!  sf     	  f---S"*+13	@ 	@ 	@ 	@ 	@r   c                     | j                             dd           | j                             dd           | j                                          |                     t          j        | j         j        ddd           dS )z$Test moving a node in a closed file.r   test1test2/test1N)r"   r^   r   r   r   r,  r  r   s    r   test08_fileMoveNodeClosedz'StateTestCase.test08_fileMoveNodeClosed)       	  g...  g...",+/3	I 	I 	I 	I 	Ir   c                     | j                             dd           | j                             dd           |                     d           |                     t          j        | j         j        ddd           dS )z'Test moving a node in a read-only file.r   rB  rC  r   rD  N)r"   r^   r   r   r   r7  r  r   s    r   test09_fileMoveNodeROz#StateTestCase.test09_fileMoveNodeRO2  s     	  g...  g...S"*+/3	I 	I 	I 	I 	Ir   c                     | j                             dd           | j                             dd           | j                                          |                     t          j        | j         j        ddd           dS )z%Test copying a node in a closed file.r   rB  rC  rD  N)r"   r^   r   r   r   r,  r;  r   s    r   test10_fileCopyNodeClosedz'StateTestCase.test10_fileCopyNodeClosed;  rF  r   c                     | j                             dd           |                     d           |                     t          j        | j         j        ddd           dS )z(Test copying a node in a read-only file.r   rB  r   rD  rC  N)r"   r^   r   r   r   r7  r;  r   s    r   test11_fileCopyNodeROz#StateTestCase.test11_fileCopyNodeROD  sh     	  g...S"*+/3	I 	I 	I 	I 	Ir   c                     | j                             dd           | j                                          |                     t          j        | j         j        d           dS )z'Test getting a node from a closed file.r   r  r  N)r"   r^   r   r   r   r,  r   r   s    r   test13_fileGetNodeClosedz&StateTestCase.test13_fileGetNodeClosedL  sV     	  f---",dk.BGLLLLLr   c                    | j                             dd           | j                             dd           | j                                          |                     t          j        t          | j                                                    dS )zTest walking a closed file.r   rB  rC  N)r"   r^   r   r   r   r,  next
walk_nodesr   s    r   test14_fileWalkNodesClosedz(StateTestCase.test14_fileWalkNodesClosedS  sw     	  g...  g...",dDK4J4J4L4LMMMMMr   c                     | j                             dd           | j                                          |                     t          j        | j         j        ddd           |                     t          j        | j         j        dd           dS )z<Test setting and deleting a node attribute in a closed file.r   r  r  foobarN)r"   r^   r   r   r   r,  set_node_attrdel_node_attrr   s    r   test15_fileAttrClosedz#StateTestCase.test15_fileAttrClosed[  s     	  f---",+3WeU	L 	L 	L",+3We	E 	E 	E 	E 	Er   c                 P   | j                             dd           | j                             ddd           |                     d           |                     t
          j        | j         j        ddd           |                     t
          j        | j         j        dd           dS )z?Test setting and deleting a node attribute in a read-only file.r   r  r  rT  r   rU  N)r"   r^   rV  r   r   r   r7  rW  r   s    r   test16_fileAttrROzStateTestCase.test16_fileAttrROe  s     	  f---!!'5%888S"*+3WeU	L 	L 	L"*+3We	E 	E 	E 	E 	Er   c                    | j                                          | j                             dd           | j                                          |                     t
          j        | j         j                   |                     t
          j        | j         j                   |                     t
          j        | j         j	                   |                     t
          j        | j         j
                   dS )z&Test undo operations in a closed file.r   rC  N)r"   enable_undor^   r   r   r   r,  is_undo_enabledget_current_markundodisable_undor   s    r   test17_fileUndoClosedz#StateTestCase.test17_fileUndoClosedp  s     	!!!  g...",dk.IJJJ",dk.JKKK",dk.>???",dk.FGGGGGr   c                     | j                                          | j                             dd           |                     d           |                     | j         j        d           dS )z)Test undo operations in a read-only file.r   r  r   FN)r"   r\  r^   r   r   _undoEnabledr   s    r   test18_fileUndoROzStateTestCase.test18_fileUndoRO{  sc     	!!!  f---S1599999r   c                    | j                             dd          }| j                             dd          }|                                 |                     t          j        |j        d           |                     t          j        | j         j        |           	 | j                             d          }n*# t          j        $ r |                     d           Y nw xY w| 	                    |j
        dd           | 	                    |j
        d	d           | j                             d          }| 	                    |j
        dd
           | 	                    |j
        d	d           dS )z&Test getting a child of a closed node.r   g1z/g1g2z/g1/g2z)closed parent group has not been reopenedFz.open child of closed group has not been closedTz*already closed group is not closed anymorez"newly opened group is still closedN)r"   r^   r  r   r   ClosedNodeErrorr  r   r2  r   	_v_isopen)r   rf  rg  g2_g1_s        r   test19a_getNodezStateTestCase.test19a_getNode  s    [%%c400[%%eT22 	",botDDD 	",dk.BBGGG	C+&&x00CC! 	C 	C 	CIIABBBBB	C 	blEF	H 	H 	HcmTF	H 	H 	H k""5))blEB	D 	D 	DcmT:	< 	< 	< 	< 	<s   B8 8$CCc                     | j                             ddddgd           |                     t          | j         j        d           dS )z;Test getting a node that does not start with a slash ('/').r   r9   r:   r;   r  r=   N)r"   rY   r   	NameErrorr   r   s    r   test19b_getNodezStateTestCase.test19b_getNode  sL     	  g1v_ MMM 	)T[%97CCCCCr   c                    | j                             dd          }| j                             dddg          }|                                 |                     t
          j        |j                   |                     t
          j        | j         j        |           	 | j                             dd           n*# t
          j        $ r | 	                    d           Y nw xY w|                     t
          j        |j                   | 
                    d	| j                    | 
                    d| j                    d
S )zTest removing a closed node.r   rb   z/groupr9   r:   Tr   z!closed node has not been reloadedz/group/arrayN)r"   r^   rY   r  r   r   rh  	_f_remover   r2  r   )r   rb   r9   s      r   test20_removeNodezStateTestCase.test20_removeNode  s0    ((g66((7QC@@ 	",eo>>>",dk.EuMMM	;K##H#====! 	; 	; 	;II9:::::	;
 	",eo>>>5554;/////s   B; ;$C"!C"c                 0   | j                             dd          }|j        }dx|_        }|                                 |                     t          j        t          |d           | 	                    | j         
                    dd          |           dS )z2Test manipulating the attributes of a closed node.r   r  rT  r\   r  N)r"   r^   r\   r  r  r   r   rh  getattrr   get_node_attr)r   r   	nodeAttrsr  s       r   test21_attrsOfNodez StateTestCase.test21_attrsOfNode  s     {''V44M	 %%	",gtZHHH 	227FCCTJJJJJr   c                     | j                             dd           | j                             ddd           |                     d           |                     t
          j        | j         j        ddd           dS )z?Test manipulating the attributes of a node in a read-only file.r   r  r  rT  r   rU  N)r"   r^   rV  r   r   r   r7  r   s    r   test21b_attrsOfNodez!StateTestCase.test21b_attrsOfNode  s     	  f---!!'65999S"*+3Wfe	M 	M 	M 	M 	Mr   c                     | j                             dd          }| j                                          |                     t          j        t          |d           dS )z*Test node closing because of file closing.r   r  r\   N)r"   r^   r   r   r   rh  rt  r   s     r   test22_fileClosesNodez#StateTestCase.test22_fileClosesNode  sR     {''V44",gtZHHHHHr   c                 2   | j                             ddg d           | j                                          t          j        | j        d          5 }t          j        j        dk    r-|                     t          t          j        | j        d           nt          j        | j        d          5 }t          j        r t          d|j        j        d                    |                     |j        j        d         d           |                                 t          j        r t          d	|j        j        d                    |                     |j        j        d         d           d
d
d
           n# 1 swxY w Y   d
d
d
           d
S # 1 swxY w Y   d
S )z6Testing reopening a file and closing it several times.r   r  )r:   r;   rG   r   r  z(h5file1) test[1]:r:   r;   z(h5file2) test[1]:N)r"   rY   r   r   r   r!   r   _FILE_OPEN_POLICYr   r-   r   r   r   rX   r  r   )r   h5file1rL  s      r   test23_reopenFilezStateTestCase.test23_reopenFile  s    	  fiii888\$,,, 	>w(H44!!*blDL#NNNN\$,44 >~ J2GL4Ea4HIII$$W\%6q%91===MMOOO~ J2GL4Ea4HIII$$W\%6q%91===> > > > > > > > > > > > > > >		> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s8   AF/B9E4(F4E8	8F;E8	<FFFN)r/   r0   r1   r&  r0  r3  r5  r8  r:  r<  r>  r@  rE  rH  rJ  rL  rN  rR  rX  rZ  ra  rd  rl  ro  rr  rw  ry  r{  r  r  r   r   r(  r(    s       8 8( ( (@ @ @A A A: : :A A AA A A@ @ @@ @ @I I II I II I II I IM M MN N NE E E	E 	E 	E	H 	H 	H: : :< < <@D D D0 0 06K K KM M MI I I> > > > >r   r(  c                        e Zd ZdZ ej        d          Z ej        d          Zd fd	Z	 fdZ
d Zd Zd Zd	 Zd
 Zd Zd Zd Z xZS )FlavorTestCasezaTest that setting, getting and changing the ``flavor`` attribute of a
    leaf works as expected.r  r   c                     t                                          |           | j                            d          | _        | j                            d          | _        dS )Nr#  z/scalarT)r
   r   r"   r   r9   scalar)r   r   r   s     r   r   zFlavorTestCase._reopen  sL    [))(33
k**955tr   c                     t                                                       | j                            dd| j                  | _        | j                            dd| j                  | _        d S )Nr   r9   r  )r
   r   r"   rY   
array_datar9   scalar_datar  r   s    r   r   zFlavorTestCase.setUp  sS    [--c7DOLL
k..sHd>NOOr   c                 `    |                      t          j        t          | j        dd           dS )zSetting an invalid flavor.flavorrT  N)r   r   FlavorErrorr  r9   r   s    r   test00_invalidzFlavorTestCase.test00_invalid  s*     	".'4:xOOOOOr   c                     |                      d           |                     t          j        t          | j        dt          j        j                   dS )z%Setting a flavor in a read-only file.r   r  r  N)r   r   r   r7  r  r9   r  internal_flavorr   s    r   test01_readonlyzFlavorTestCase.test01_readonly  sP     	#"*!4:x)3	5 	5 	5 	5 	5r   c                 @   t           j        j        D ]}|| j        _        |                     | j        j        |           t           j                            | j        |          }| j        dd         }|                     t          j	        |||                     dS )z%Changing the flavor and reading data.N)
r   r  all_flavorsr9   r   array_of_flavorr  rq   r   allequalr   r  idataodatas       r   test02_changezFlavorTestCase.test02_change  s     i+ 	C 	CF &DJTZ.777I--dovFFEJqqqMEOOFOE5&AABBBB	C 	Cr   c                     t           j        j        D ]d}|| j        _        |                     | j        j        |           |                     d           |                     | j        j        |           edS )zStoring a changed flavor.r   r  N)r   r  r  r9   r   r   )r   r  s     r   test03_storezFlavorTestCase.test03_store(  sy     i+ 	8 	8F &DJTZ.777LLdL###TZ.7777		8 	8r   c                    | j         j        }d| j         j        _        |                     d           t
          j                            | j        |          }|                     t
          j	                  5  | j         
                                }ddd           n# 1 swxY w Y   |                     t          j        |||                     dS )z&Reading a dataset of a missing flavor.r  r   r  N)r9   r  r\   FLAVORr   r   r  r  r  FlavorWarningrj  rq   r   r  r  s       r   test04_missingzFlavorTestCase.test04_missing1  s     "%-
"#	))$/6BBb.// 	& 	&JOO%%E	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&uf==>>>>>s   8BB"%B"c                 l   d| j         _        |                     | j         j        d           |                     | j         j        j        d           | j         `|                     | j         j        t
          j        j                   |                     t          t          | j         j        d           dS )z!Deleting the flavor of a dataset.pythonr  N)
r9   r  r   r_   r  r   r  r   r   rt  r   s    r   test05_deletezFlavorTestCase.test05_delete<  s     %
*H555)0(;;;J*BI,EFFF.'4:3CXNNNNNr   c           
         d | j         | j        fD             }d |D             }|D ]}| j                            d|          }|` dD ]}|                     |           t          ||          D ]\  }}|dk    r2| j                            d|          }|                    d|          }n!|dk    r| j                            d|          }|                     |j        t          j        j
        d|j        d|j                   d	S )
z0Copying a node with a deleted flavor (see #100).c                     g | ]	}|j         
S r  )r   ).0r   s     r   
<listcomp>z5FlavorTestCase.test06_copyDeleted.<locals>.<listcomp>I  s    EEE4$,EEEr   c                     g | ]}d |z  S )z%s_copyr  )r  r   s     r   r  z5FlavorTestCase.test06_copyDeleted.<locals>.<listcomp>J  s    666t)d"666r   r   )r   r   r   r   zflavor of node ``z`` is not internal: N)r9   r  r"   r   r  r   zipr  r   r   r  r   )	r   snamesdnamesr   r   fmodesnamednamesnodes	            r   test06_copyDeletedz!FlavorTestCase.test06_copyDeletedF  sQ    FEDJ+DEEE66v666 	 	D;''T22D  
	D 
	DELL #FF 3 3 D DuD== K00e<<E ::c511DDc\\;//U;;D  bi.G.G$($4$4$4dkk"CD D D DD
	D 
	Dr   c                 Z   t          t          j        j                  }t          j        j                                        }t          j        j                                        }t          j        j                                        }t          j        j                                        }	 t          j        	                    g            | 
                    t          t          j        j                  t          |                     | 
                    t          t          j        j                  t          |                     |d d          t          j        j        d d <   t          j        j                            |           t          j        j                            |           t          j        j                            |           t          j        j                            |           d S # |d d          t          j        j        d d <   t          j        j                            |           t          j        j                            |           t          j        j                            |           t          j        j                            |           w xY w)N)r  )listr   r  r  	alias_mapr  converter_mapidentifier_mapdescription_maprestrict_flavors
assertLessr   update)r   r  r  r  r  r  s         r   test07_restrict_flavorsz&FlavorTestCase.test07_restrict_flavors[  s    29011I',,..		/446616688)388::	>I&&B&///OOC	 344c)nnEEEOOBI+,,M""$ $ $ (3111~BI!!!!$I&&y111I#**=999I$++N;;;I%,,_=====	 (3111~BI!!!!$I&&y111I#**=999I$++N;;;I%,,_====s   ,BG: :B0J*)r   )r/   r0   r1   r&  r`   aranger  int32r  r   r   r  r  r  r  r  r  r  r  r2   r3   s   @r   r  r    s	         2J"(2,,K     P P P P P
P P P
5 5 5C C C8 8 8	? 	? 	?O O OD D D*> > > > > > >r   r  c                   V     e Zd ZdZd Z fdZd Zd Zd Ze	d             Z
d Z xZS )	UnicodeFilenameu	   paraŀlelc                 8    t          j        | j        d          S )Nr   prefixr+  )r   r   unicode_prefixr   s    r   _getTempFileNamez UnicodeFilename._getTempFileNamew  s    d&9%HHHHr   c                     t                                                       | j                            ddddg          | _        |                                  d S Nr   r  r:   r;   r
   r   r"   rY   r  r   r   s    r   r   zUnicodeFilename.setUpz  F    K,,S&1a&AA	 	r   c                     | j         j        j        }t          j        r?t          d| j                   t          d|dd                    t          dddg           |                     |dd         ddgd           dS )z0Checking creating a filename with Unicode chars.	Filename:Array:NShould look like:r:   r;   Values does not match.r"   rX   r  r   r   r   r!   r   r   r  s     r   test01zUnicodeFilename.test01       {$> 	/+t|,,,(DG$$$%1v...aaa1a&*BCCCCCr   c                     | j                                          t          j        r<t	          d| j                   t	          dt          j        | j                             |                     t          j        | j                             dS )z6Checking  tables.is_hdf5_file with a Unicode filename.r   tables.is_hdf5_file?:N	r"   r   r   r   r   r!   r   r  rq   r   s    r   test02zUnicodeFilename.test02  sv     	> 	K+t|,,,*BODL,I,IJJJ5566666r   c                 "   | j                                          t          j        r<t	          d| j                   t	          dt          j        | j                             |                     t          j        | j                  d           dS )z2Checking is_pytables_file with a Unicode filename.r  is_pytables_file?:FN	r"   r   r   r   r   r!   r   r  r{  r   s    r   test03zUnicodeFilename.test03  |     	> 	K+t|,,,&(;DL(I(IJJJB/==uEEEEEr   c                     t           j                            |j                  }t          j        || |j        |          }||d d <   d S )N)shapeatom)r   Atom
from_dtypedtypeCArrayr  )r   datarb   r  r   s        r   _store_carrayzUnicodeFilename._store_carray  sD    w!!$*--yDJTBBBQQQr   c                    | j                                          t          j        | j        d          | _         | j         j        }| j                             |d          }d}t          j        t          j	        ddd                    }t          j                    5  t          j        dt          j                   |                     |||           d d d            n# 1 swxY w Y   | j                             |d          }d S )	NrQ   	face_datau   data at 40°Cgffffffgffffff?i  r  vertex_data)r"   r   r   r   r!   rX   r^   r`   sinhlinspacer   r   r  r   r  )r   rX   rb   
array_namer  s        r   -test_store_and_load_with_non_ascii_attributesz=UnicodeFilename.test_store_and_load_with_non_ascii_attributes  s   l4<55{(({;;1
wr{4c2233$&& 	8 	8!(B,ABBBz4777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 ((}==s   7C  C$'C$)r/   r0   r1   r  r  r   r  r  r  staticmethodr  r  r2   r3   s   @r   r  r  t  s        $NI I I    D D D7 7 7F F F   \

> 
> 
> 
> 
> 
> 
>r   r  )rG   rJ   z%PEP 519 was implemented in Python 3.6c                   <     e Zd Zd Z fdZd Zd Zd Zd Z xZ	S )PathLikeFilenamec                 J    ddl m}  |t          j        d                    S )Nr   r   r   r*  )pathlibr   r   r   )r   r   s     r   r  z!PathLikeFilename._getTempFileName  s1          tHO5111222r   c                     t                                                       | j                            ddddg          | _        |                                  d S r  r  r   s    r   r   zPathLikeFilename.setUp  r  r   c                     | j         j        j        }t          j        r?t          d| j                   t          d|dd                    t          dddg           |                     |dd         ddgd           dS )z@Checking creating a file with a PathLike object as the filename.r  r  Nr  r:   r;   r  r  r  s     r   r  zPathLikeFilename.test01  r  r   c                     | j                                          t          j        r<t	          d| j                   t	          dt          j        | j                             |                     t          j        | j                             dS )zLChecking tables.is_hdf5_file with a PathLike object as the
        filename.r  r  Nr  r   s    r   r  zPathLikeFilename.test02  sv     	> 	K+t|,,,*BODL,I,IJJJ5566666r   c                 "   | j                                          t          j        r<t	          d| j                   t	          dt          j        | j                             |                     t          j        | j                  d           dS )zAChecking is_pytables_file with a PathLike object as the filename.r  r  FNr  r   s    r   r  zPathLikeFilename.test03  r  r   c                 .    t          | j                   d S r	   )rp   r"   r   s    r   
test04_strzPathLikeFilename.test04_str  s    DKr   )
r/   r0   r1   r  r   r  r  r  r  r2   r3   s   @r   r  r    s        3 3 3    D D D7 7 7F F F      r   r  c                   X     e Zd Z fdZ fdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Z xZS )FilePropertyTestCasec                     t                                                       t          j        d          | _        d | _        d S )Nr   )r
   r   r   r   r!   r"   r   s    r   r   zFilePropertyTestCase.setUp  s0    u--r   c                     | j         r| j                                          t          | j                                                  r&t          | j                                                   t                                                       d S r	   )r"   r   r   r!   r.  r(   r
   r  r   s    r   r  zFilePropertyTestCase.tearDown  sw    ; 	 K%%'' 	(%%'''r   c                    t          j        d          }t          j        |j                  |j        j        z  }t          j        | j        d          | _	        | j	        
                    | j	        j        d|           | j	                                        }| j	                                         t          | j                                                  j        }|                     ||           |                     ||           d S )N)  r  r+   r  r9   )r`   zerosprodr  r  itemsizer   r   r!   r"   rY   rX   get_filesizer   r   statst_sizer  r   )r   r  datasizeh5_filesizefs_filesizes        r   test_get_filesizez&FilePropertyTestCase.test_get_filesize  s    x%%74:&&)<<l4<c:::  !17DAAAk..004<((--//7X666k22222r   c                     t          j        | j        d          | _        | j                            | j        j        dddg           |                     | j                                        d           d S )Nr+   r  r9   r:   r;   r   r   r   r!   r"   rY   rX   r   get_userblock_sizer   s    r   test01_null_userblock_sizez/FilePropertyTestCase.test01_null_userblock_size  sg    l4<c:::  !17QFCCC77991=====r   c                 b   t          j        | j        d          | _        | j                            | j        j        dddg           | j                                         t          j        | j        d          | _        |                     | j                                        d           d S )Nr+   r  r9   r:   r;   r   r   	r   r   r!   r"   rY   rX   r   r   r  r   s    r   test02_null_userblock_sizez/FilePropertyTestCase.test02_null_userblock_size  s    l4<c:::  !17QFCCCl4<c:::77991=====r   c                     d}t          j        | j        d|          | _        | j                            | j        j        dddg           |                     | j                                        d           d S )Nr   r+   r   user_block_sizer9   r:   r;   r  r   USER_BLOCK_SIZEs     r   test03_null_userblock_sizez/FilePropertyTestCase.test03_null_userblock_size
  sx    lLsOE E E  !17QFCCC77991=====r   c                     d}t          j        | j        d|          | _        | j                            | j        j        dddg           |                     | j                                        |           d S )N   r+   r  r9   r:   r;   r  r
  s     r   test01_userblock_sizez*FilePropertyTestCase.test01_userblock_size  sx    lLsOE E E  !17QFCCC7799?KKKKKr   c                 h   d}t          j        | j        d|          | _        | j                            | j        j        dddg           | j                                         t          j        | j        d          | _        |                     | j                                        |           d S )	Nr  r+   r  r9   r:   r;   r   r  r  r
  s     r   test02_userblock_sizez*FilePropertyTestCase.test02_userblock_size  s    lLsOE E E  !17QFCCCl4<c:::7799?KKKKKr   c                 f    d}|                      t          t          j        | j        d|           d S )Nr  r+   r  r   r-   r   r   r!   r
  s     r   test_small_userblock_sizez.FilePropertyTestCase.test_small_userblock_size!  s=    *blDLs*9 	 	; 	; 	; 	; 	;r   c                 f    d}|                      t          t          j        | j        d|           d S )Ni  r+   r  r  r
  s     r   test_invalid_userblock_sizez0FilePropertyTestCase.test_invalid_userblock_size&  s=    *blDLs*9 	 	; 	; 	; 	; 	;r   )r/   r0   r1   r   r  r  r  r  r  r  r  r  r  r2   r3   s   @r   r  r    s            
    3 3 3> > >
> > >> > >L L LL L L; ; ;
; ; ; ; ; ; ;r   r  zBlosc not availablec                   4    e Zd Z ej        d          Zd ZdS )BloscBigEndianzblosc_bigendian.h5c           	          dD ]f}t          j        d|          }| j                            d|z             }|                     t          j        ||dd                   d           gdS )z9Checking compatibility with Blosc on big-endian machines.)i1i2i4i8r  )r  r   NzError in big-endian data!)r`   r  r"   r   rq   r   r  )r   	dset_namerQ   dsets       r   test00_bigendianzBloscBigEndian.test00_bigendian1  s~     2 	9 	9I	"I...A;''I66DOOFOAtAAAw7779 9 9 9	9 	9r   N)r/   r0   r1   r   r  r!   r   r  r   r   r  r  -  s6        "f"#788G9 9 9 9 9r   r  c                    t          j        |           }t          j        rt	          d|            |j        j                            d          }t          j        rt	          d           t          |           t          j        rt	          d           |	                                 ||
                    d           d S d S )NzAbout to load: z	(f0 < 10)z"Got the iterator, about to iteratezSucceeded in one iteration
Done)r   r   r   r   r   rX   r?   whererP  r   r  )fnqoutfprowss       r   _workerr(  @  s    	b		B~ %$$$7={++D~ 42333JJJ~ .,---HHJJJ r   z$multiprocessing module not available)gnuzgnu/kfreebsdz8multiprocessing module is not supported on Hurd/kFreeBSDc                       e Zd Zd ZdS )BloscSubprocessc           
         t          j        dd          }	 d}t          j        d t	          |          D             d          }t          j        |d          5 }|                    |j        d|t          j	        d	d
          |dz  f           d d d            n# 1 swxY w Y   t          j        rt          d           t          |           t          j        rt          d           	 t          j                    }t          j        t          ||f          }d|_        |                                 |                                }t          j        rt          |           n# t(          $ r t          d           Y nw xY wt+          |                                           d S # t+          |                                           w xY w)Nzmultiproc-blosc9-r   r  i c              3   ,   K   | ]}||d z  |dz  fV  dS )r;   rG   Nr  )r  r  s     r   	<genexpr>z4BloscSubprocess.test_multiprocess.<locals>.<genexpr>b  s0      CC!q!Q$1oCCCCCCr   zi4,i8,f8r+   r?   	   blosc)	complevelcomplibrG   )filtersrz  z**** Running from main process:z**** Running from subprocess:r  Tz*Permission denied due to /dev/shm settings)r   r   r`   fromiterr
  r   r   rZ   rX   Filtersr   r   r   r(  mpr	  Processdaemonro  r  OSErrorr   r(   )r   r!   sizesar"   r%  psresults           r   test_multiprocessz!BloscSubprocess.test_multiprocess]  s	   /)<UKKK	#DCCuT{{CCC') )Bgs++ -v##K"JGDDD $	| $ - - -- - - - - - - - - - - - - - - ~ 97888G~ 75666"xzz Zwgt5EFFF 	


> "&MMM  D D DBCCCCCD MM  """""DMM  """"sV   AF- 8BF- B##F- &B#'AF- 0E+ A(F- +FF- FF- -#GN)r/   r0   r1   r>  r  r   r   r+  r+  V  s#        !# !# !# !# !#r   r+  c                   L     e Zd Z fdZ fdZd Zd Zd Zd Zd Z	d Z
 xZS )	HDF5ErrorHandlingc                 t    t                                                       t          j        j        | _        d S r	   )r
   r   r   r'   DEFAULT_H5_BACKTRACE_POLICY_old_policyr   s    r   r   zHDF5ErrorHandling.setUp  s'    ?Fr   c                 t    | j         t          j        _        t	                                                       d S r	   )rC  r   r'   rB  r
   r  r   s    r   r  zHDF5ErrorHandling.tearDown  s,    6:6F3r   c                 4   d}t          j        dd          }	 t          |d          5 }|                    ||z             d d d            n# 1 swxY w Y   t	          j        t          j        |gt          j        t          j                  }|	                                \  }}| 
                    d|                    d                     t          |                                           d S # t          |                                           w xY w)	Nz
import tables as tb
tb.silence_hdf5_messages(False)
tb.silence_hdf5_messages()
try:
    tb.open_file(r'%s')
except tb.HDF5ExtError, e:
    pass
hdf5-error-handling-.pyr  r+   stdoutstderr	HDF5-DIAGascii)r   r   r  r  
subprocessPopenr  
executablePIPEcommunicater   decoder   r(   )r   coder  r&  prI  rJ  s          r   test_silence_messagesz'HDF5ErrorHandling.test_silence_messages  s;    ?*@OOO	$h$$ *)))* * * * * * * * * * * * * * *  #.(!;(2(29 9 9A  !}}VV[&--*@*@AAANN!!#####DNN!!####s/   C4 AC4 AC4 AA:C4 4#Dc                    d}t          j        dd          }	 t          |                              ||z             t	          j        t          j        |gt          j        t          j                  }|	                                \  }}| 
                    d|                    d                     t          |                                           d S # t          |                                           w xY w)Nz
import tables as tb
tb.silence_hdf5_messages()
tb.silence_hdf5_messages(False)
try:
    tb.open_file(r'%s')
except tb.HDF5ExtError as e:
    pass
rF  rG  r  rH  rK  rL  )r   r   r   r&   rM  rN  r  rO  rP  rQ  r   rR  r(   )r   rS  r  rT  rI  rJ  s         r   _test_enable_messagesz'HDF5ErrorHandling._test_enable_messages  s     ?*@OOO
	$NN%%dXo666 #.(!;(2(29 9 9A  !}}VVMM+v}}W'='=>>>NN!!#####DNN!!####s   BC #C<c                 R   t          j        d          }t          |                              d           	 t	          j        |          }|                                 t          |                                           d S # t          |                                           w xY w)Nr   r%   )r   r   r   r&   r   r   r   r(   r    s      r   _raise_exterrorz!HDF5ErrorHandling._raise_exterror  s    /%((W  $$$	#\'**FLLNNNMM  """""DMM  """"s   (B #B&c                     dt           j        _        |                     t           j                  5 }|                                  d d d            n# 1 swxY w Y   |                     |j        j                   d S )NT)r   r'   rB  r   rY  r   	exceptionh5backtracer   cms     r   test_h5_backtrace_quietz)HDF5ErrorHandling.test_h5_backtrace_quiet  s    6:3r// 	#2  """	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	R\566666   AAAc                 |   dt           j        _        |                     t           j                  5 }|                                  d d d            n# 1 swxY w Y   |                     |j        j                   t          |j                  }| 	                    |j        j        d         d         |           d S )NVERBOSE)
r   r'   rB  r   rY  r   r[  r\  rp   r   )r   r^  msgs      r   test_h5_backtrace_verbosez+HDF5ErrorHandling.test_h5_backtrace_verbose  s    6?3r// 	#2  """	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	R\5666",bl.r226<<<<<r`  c                     dt           j        _        |                     t           j                  5 }|                                  d d d            n# 1 swxY w Y   |                     |j        j                   d S )NF)r   r'   rB  r   rY  r  r[  r\  r]  s     r   test_h5_backtrace_ignorez*HDF5ErrorHandling.test_h5_backtrace_ignore  s    6;3r// 	#2  """	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	",233333r`  )r/   r0   r1   r   r  rU  rW  rY  r_  re  rg  r2   r3   s   @r   r@  r@    s        G G G G G    $ $ $J$ $ $0# # #7 7 7= = =4 4 4 4 4 4 4r   r@  c                   V    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S )TestDescriptionc                      G d dt           j                  } G d d|          }|                     d|j                   d S )Nc                   ,    e Zd Z ej                    ZdS )FTestDescription.test_isdescription_inheritance.<locals>.TestDescParentN)r/   r0   r1   r   Int32Colcr  r   r   TestDescParentrl    s        AAAr   ro  c                       e Zd ZdS )@TestDescription.test_isdescription_inheritance.<locals>.TestDescN)r/   r0   r1   r  r   r   TestDescrq    s        Dr   rr  rn  )r   IsDescriptionr   r  )r   ro  rr  s      r   test_isdescription_inheritancez.TestDescription.test_isdescription_inheritance  sx    	 	 	 	 	R- 	 	 		 	 	 	 	~ 	 	 	 	c8+,,,,,r   c                    t          j        ddt          fg          }t          j                            |          \  }}|                     d|j                   |                     d|j                   |                     t          |j                  d           | 
                    |j        d         t          j                   | 
                    |j        d         t          j                   |                     |j        d         j        t           j                   |                     |j        d         j        t                     d S )Ncol1int16col2rw  r;   )r`   r  floatr   descriptiondescr_from_dtyper   _v_colobjectsr   r   r  Colrx  )r   r  descr	byteorders       r   test_descr_from_dtypez%TestDescription.test_descr_from_dtype  s   H'&%9::>::1==yfe1222fe1222U0111555e1&926BBBe1&926BBB,V4:BHEEE,V4:EBBBBBr   c                    ddg}t          j        |          }t          j                            |          \  }}|                     t          |j                  d           |                     t          |j                  ddg           d S )N))	timestampr  u4))zunit (cluster) idunitu2r;   r  r  )	r`   r  r   r{  r|  r   r   _v_namessorted)r   headerr  r  r  s        r    test_descr_from_dtype_rich_dtypez0TestDescription.test_descr_from_dtype_rich_dtype	  s    ,79HV>::1==yU^,,a000//#v?????r   c                    t          j        ddg          }t          j        dd|fg          }t          j                            |          \  }}|                     |j                   |                     d|j                   |                     d|j                   | 	                    t          |j                  d           |                     |j        d         t          j                   |                     t          |j        d         t          j                             | 	                    |j        d         j        t           j                   d S )Nxrx  yrx  timefloat64valuer  r;   )r`   r  r   r{  r|  rq   _v_is_nestedr   r}  r   r   r  r~  
isinstanceDescriptionr  r   d1d_compr  r  s        r   test_descr_from_dtype_comp_01z-TestDescription.test_descr_from_dtype_comp_01	  s'   X~~677.">??>::6BBy*+++fe1222gu2333U0111555e1&926BBB
5#6w#?#%>3 3 	4 	4 	4,V4:BJGGGGGr   c                 $   t          j        ddg          }t          j        dd|dffg          }|                     t                    5  t          j                            |          \  }}d d d            n# 1 swxY w Y   |                     |j                   | 	                    d|j
                   | 	                    d|j
                   |                     t          |j
                  d           |                     |j
        d         t          j                   |                     t          |j
        d         t          j                             |                     |j
        d         j        t           j                   d S )Nr  r  r  r  )r:   r  r;   )r`   r  r  r  r   r{  r|  rq   r  r   r}  r   r   r  r~  r  r  r  r  s        r   test_descr_from_dtype_comp_02z-TestDescription.test_descr_from_dtype_comp_02	  s   X~~677.2t*0EFGGk** 	G 	G!~>>vFFE9	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	*+++fe1222gu2333U0111555e1&926BBB
5#6w#?#%>3 3 	4 	4 	4,V4:BJGGGGGs   #A::A>A>c                      G d dt           j                  }t          j        ddt          fg          }t           j                            |          }|                     ||           d S )Nc                   J    e Zd Z ej                    Z ej                    ZdS )LTestDescription.test_dtype_from_descr_is_description.<locals>.TestDescParentNr/   r0   r1   r   Int16Colrw  FloatColry  r  r   r   ro  r  .	  (        2;==D2;==DDDr   ro  rv  ry  r   rs  r`   r  rz  r{  dtype_from_descrr   r   ro  r  r  s       r   $test_dtype_from_descr_is_descriptionz4TestDescription.test_dtype_from_descr_is_description,	  s{    	! 	! 	! 	! 	!R- 	! 	! 	! +fe_=>>N++N;;E"""""r   c                      G d dt           j                  }t          j        ddt          fg          }t           j                             |                      }|                     ||           d S )Nc                   J    e Zd Z ej                    Z ej                    ZdS )UTestDescription.test_dtype_from_descr_is_description_instance.<locals>.TestDescParentNr  r  r   r   ro  r  9	  r  r   ro  rv  ry  r  r  s       r   -test_dtype_from_descr_is_description_instancez=TestDescription.test_dtype_from_descr_is_description_instance7	  s    	! 	! 	! 	! 	!R- 	! 	! 	! +fe_=>>N++NN,<,<==E"""""r   c                     G d dt           j                  }t          j        ddt          fg          }t          j         |            j                  }t           j                            |          }| 	                    ||           d S )Nc                   J    e Zd Z ej                    Z ej                    ZdS )RTestDescription.test_dtype_from_descr_description_instance.<locals>.TestDescParentNr  r  r   r   ro  r  D	  r  r   ro  rv  ry  )
r   rs  r`   r  rz  r  r  r{  r  r   )r   ro  r  desctiptionr  s        r   *test_dtype_from_descr_description_instancez:TestDescription.test_dtype_from_descr_description_instanceB	  s    	! 	! 	! 	! 	!R- 	! 	! 	! +fe_=>>n^^%5%5%=>>N++K88E"""""r   c                     t          j        ddt          fg          }t          j                            t          j                    t          j                    d          }|                     ||           d S )Nrv  ry  )rw  ry  )	r`   r  rz  r   r{  r  r  r  r   )r   r  r  s      r   test_dtype_from_descr_dictz*TestDescription.test_dtype_from_descr_dictN	  sg    +fe_=>>N++[]]BKMM::< < 	E"""""r   c                 \    |                      t          t          j        j        g            d S r	   )r   r-   r   r{  r  r   s    r   "test_dtype_from_descr_invalid_typez2TestDescription.test_dtype_from_descr_invalid_typeV	  s%    *bn&ErJJJJJr   c                      G d dt           j                  }t           j                            |d          }|                     |d         j        d           |                     |d         j        d           d S )Nc                   J    e Zd Z ej                    Z ej                    ZdS )GTestDescription.test_dtype_from_descr_byteorder.<locals>.TestDescParentNr  r  r   r   ro  r  \	  r  r   ro  >)r  rw  ry  )r   rs  r{  r  r   r  )r   ro  r  s      r   test_dtype_from_descr_byteorderz/TestDescription.test_dtype_from_descr_byteorderZ	  s    	! 	! 	! 	! 	!R- 	! 	! 	! N++Nc+JJ6,c2226,c22222r   c                    dt          j                    i}t          j        |          }|                     t	          |j                  t	          |                                                     |                     |j        t          j
                   |                     t	          |j        j                  t	          |                                                     d S )Nr   )r   r  r  r   r  r  keysr  _v_dtyper`   r  rq   fields)r   dr  s      r   test_str_nameszTestDescription.test_str_namese	  s    R[]]#q!!//1A1ABBBenbh777u~455vaffhh7G7GHHHHHr   N)r/   r0   r1   rt  r  r  r  r  r  r  r  r  r  r  r  r  r   r   ri  ri    s        - - -
C 
C 
C@ @ @H H HH H H"	# 	# 	#	# 	# 	#
# 
# 
## # #K K K	3 	3 	3I I I I Ir   ri  c                   &    e Zd Zd Zd Zd Zd ZdS )TestAtomc                    d}t          j        |          }|                     |j        d           |                     |j        t          j        t
          j        |f                     |                     |j        |j        j        j                   |                     |j	        d           |                     |j
        t          |                     |                     |j        |           |                     |j        |j        t          j        |          z             |                     |j        d           d S )Nr  r  r  g        rz  r  )r   Float64Atomr   dfltr  r`   r  r  basekindndimr   r  r:  r  type)r   r  rQ   s      r   test_atom_attributes01zTestAtom.test_atom_attributes01o	  s   N'''$$$"(BJ+>"?"?@@@QW\%:;;;)))U,,,%(((bgenn!<===+++++r   c                     d}t          j        |          }|                                }|                     |j        |           d S Nr  r  )r   r  r  r   r  )r   r  rQ   aas       r   test_atom_copy01zTestAtom.test_atom_copy01}	  sD    N'''VVXX5)))))r   c                     d}t          j        |          }|                                }|                     |j        |           d S N       @r  )r   r  r  r   r  )r   r  rQ   r  s       r   test_atom_copy02zTestAtom.test_atom_copy02	  sD    N%%%VVXX$'''''r   c                    d}d}t          j        ||          }|                    |           }|                     |j        |           |                     |j        |           |                     |j        |            d S )Nr  r  )r  r  r  )r   r  r  r   r  r{  r  )r   r  r  rQ   r  s        r   test_atom_copy_overridez TestAtom.test_atom_copy_override	  s    NT222VV$V5)))BGT***4%(((((r   N)r/   r0   r1   r  r  r  r  r  r   r   r  r  n	  sP        , , ,* * *( ( () ) ) ) )r   r  c                        e Zd Zd Zd Zd ZdS )TestColc                     d}t          j        |          }|                                }|                     |j        |           d S r  )r   
Float64Colr  r   r  )r   r  rn  ccs       r   test_col_copy01zTestCol.test_col_copy01	  sD    M&&&VVXX5)))))r   c                     d}t          j        |          }|                                }|                     |j        |           d S r  )r   r  r  r   r  )r   r  rn  r  s       r   test_col_copy02zTestCol.test_col_copy02	  sD    Mt$$$VVXX$'''''r   c                 D   d}d}d}t          j        |||          }|                    d          }|                     |j        |           |                     |j        |           |                     |j        |           |                     |j        d           d S )Nr  r  rG   )r  r  posr;   )r  )r   r  r  r   r  r  r{  _v_pos)r   r  r  r  rn  r  s         r   test_col_copy_overridezTestCol.test_col_copy_override	  s    MDc:::VVV]]5)))$'''BIs+++A&&&&&r   N)r/   r0   r1   r  r  r  r  r   r   r  r  	  sA        * * *( ( (	' 	' 	' 	' 	'r   r  c                       e Zd Zd Zd ZdS )TestSysattrCompatibilityc                     t          j        d          }t          j        |d          5 }|                     |j                   d d d            d S # 1 swxY w Y   d S )Nz
python2.h5r   r   r  r   r   rq   isopenr    s      r   test_open_python2z*TestSysattrCompatibility.test_open_python2	      &|44\'3'' 	+6OOFM***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+   AAAc                     t          j        d          }t          j        |d          5 }|                     |j                   d d d            d S # 1 swxY w Y   d S )Nz
python3.h5r   r  r    s      r   test_open_python3z*TestSysattrCompatibility.test_open_python3	  r  r  N)r/   r0   r1   r  r  r  r   r   r  r  	  s2        + + +
+ + + + +r   r  c                     t           j                                        } d}t          |          D ]}|                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                               |                     t           j                            t                                |                     t           j                            t"                               |                     t           j                            t$                               |                     t           j                            t&                               |                     t           j                            t(                               |                     t           j                            t*                               |                     t           j                            t,                               |                     t           j                            t.                               |                     t           j                            t0                               | S )Nr:   )r   r  	TestSuiter
  addTest	makeSuiter   r  r  r  r  r  r  r(  r  r  r  r  r  r+  r@  ri  r  r  r  )theSuiteniterr  s      r   suiter  	  s   ((**HE5\\ N N223JKKLLL223DEEFFF223FGGHHH223HIIJJJ223DEEFFF223DEEFFF223FGGHHH22=AABBB22>BBCCC22?CCDDD223CDDEEE223GHHIII22>BBCCC22?CCDDD223DEEFFF22?CCDDD228<<===227;;<<<223KLLMMMMOr   __main__r  )defaultTestr	   );r  r  rs   platformr   r   r  rM  r  r  r   r   multiprocessingr6  multiprocessing_importedImportErrornumpyr`   r   tables.testsr   PyTablesTestCaser   TempFileMixinr5   r  r  r  r  r  skipIfr   r}  r  r  r(  r  r  version_infor  r  blosc_availTestFileMixinr  r(  systemlowerr+  r@  ri  r  r  r  r  r/   
parse_argvargvprint_versionsmainr  r   r   <module>r     s   				 



                    %    # % % %$%              0# 0# 0# 0# 0#f5 0# 0# 0#f@' @' @' @' @'v+V-D @' @' @'F": : : : :( : : :
: : : : :* : : :
: : : : :, : : :
p7 p7 p7 p7 p7,f.E p7 p7 p7f 1X=57 7* * * * *,f.E * *7 7*Z\B \B \B \B \B&.0G \B \B \B~\> \> \> \> \>F(&*A \> \> \>~p> p> p> p> p>V)6+B p> p> p>j:> :> :> :> :>f*F,C :> :> :>z (61?A A, , , , ,v+V-D , ,A A,^G; G; G; G; G;62 G; G; G;V F..0EFF9 9 9 9 9V)6+B 9 9 GF9$   , 44>@ @))//115LL56 6 F..0EFF"# "# "# "# "#f- "# "# GF6 6@ @"#Jh4 h4 h4 h4 h4/ h4 h4 h4VI I I I If- I I ID") ") ") ") ")v& ") ") ")J' ' ' ' 'f% ' ' '2	+ 	+ 	+ 	+ 	+v6 	+ 	+ 	+  8 zFchF
OW----- s   7 A A