
    &Vf                     2    d Z ddlZddlZd Zd Zd Zd ZdS )z!
    Tests the h5py.File object.
    Nc                     t          j        | d          5 }	 |d         j        }n# t          $ r Y nw xY wddd           dS # 1 swxY w Y   dS )z)Create a file and access not existing keywdoesnt_existN)h5pyFilevalueKeyError)filenamenewfiler   s      S/var/www/html/software/conda/lib/python3.11/site-packages/h5py/tests/test_errors.py_access_not_existing_objectr      s    	8S	!	! W	">28LL 	 	 	D	                 s,   A&A
3A3AA
Ac                    | dz  }	 t           j                                         t          |           |                                }|j        dk    sJ |j        dk    sJ 	 t           j                                         n## t           j                                         w xY wt          |           |                                }|j        dk    sJ |j        dk    sJ dS )z5Check that HDF5 errors can be muted/unmuted from h5pytest.h5 N)r   _errorsunsilence_errorsr   
readouterrerroutsilence_errors)tmp_pathcapfdr
   captureds       r   test_unsilence_errorsr      s    )#H
&%%'''#H---##%%|r!!!!|r!!!!! 	##%%%%##%%%%)))!!H<2<2s   AB  B"c                     t          j        t          | dz  f          }|                                 |                                 |                                }|j        dk    sJ |j        dk    sJ dS )zyVerify the error printing is squashed in all threads.

    No console messages should be shown from membership tests
    r   )targetargsr   N)	threadingThreadr   startjoinr   r   r   )r   r   thr   s       r   )test_thread_hdf5_silence_error_membershipr#   2   s    
 
	!< (9 46
8 
8 
8BHHJJJGGIII!!H<2<2    c                       fd}t          j        |          }|                                 |                                 |                                }|j        dk    sJ |j        dk    sJ dS )zVerify the error printing is squashed in all threads.

    No console messages should be shown for non-existing attributes
    c                      t          j        dz  d          5 } g d| d<   	 | d         j        d         }n# t          $ r Y nw xY wd d d            d S # 1 swxY w Y   d S )Nr   r   )         newdatanonexistent_attr)r   r   attrsr	   )r   r+   r   s     r   testz1test_thread_hdf5_silence_error_attr.<locals>.testF   s    Yx	)3// 	7!*GI#*9#5#;<N#O     		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s1   A7A
AAAAAA)r   r   N)r   r   r    r!   r   r   r   )r   r   r-   r"   r   s   `    r   #test_thread_hdf5_silence_error_attrr.   A   s    
     
		&	&	&BHHJJJGGIII!!H<2<2r$   )__doc__r   r   r   r   r#   r.    r$   r   <module>r1      sl             .      r$   