
    jA	                         d Z ddlZddlZddlZddlmZ d Zej                            d          d             Z	d	 Z
d
 ZdS )z!
    Tests the h5py.File object.
    N   )	make_namec                     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      Y/var/www/html/Carbon-Document/venv/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zChanges global state)reasonc                    | 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 h5pyz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          | 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
    {}.h5)targetargsr   N)		threadingThreadr   r   startjoinr   r   r   )r   r   thr   s       r   )test_thread_hdf5_silence_error_membershipr&   7   s    
 
	!< (9W+=+= =?
A 
A 
AB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        t          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   )r         newdatanonexistent_attr)r   r	   r   attrsr   )r   r-   r   s     r   testz1test_thread_hdf5_silence_error_attr.<locals>.testK   s    Yx	' 2 22C88 	G!*GI#*9#5#;<N#O     		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s4   A!A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_attrr0   F   s    
     
		&	&	&BHHJJJGGIII!!H<2<2r'   )__doc__r!   pytestr   commonr   r   markthread_unsafer   r&   r0    r'   r   <module>r7      s                   "899  :9.      r'   