a
    v=ic                     @   s8   d Z ddlZddlZdd Zdd Zdd Zd	d
 ZdS )z!
    Tests the h5py.File object.
    Nc              	   C   sR   t | d2}z|d j}W n ty.   Y n0 W d   n1 sD0    Y  dS )z)Create a file and access not existing keywdoesnt_existN)h5pyFilevalueKeyError)filenamenewfiler    r
   g/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/h5py/tests/test_errors.py_access_not_existing_object   s
    r   c                 C   s   | d }zDt j  t| | }|jdks2J |jdks@J W t j  nt j  0 t| | }|jdksxJ |jdksJ dS )z5Check that HDF5 errors can be muted/unmuted from h5pytest.h5 N)r   _errorsZunsilence_errorsr   
readouterrerroutZsilence_errors)tmp_pathcapfdr   capturedr
   r
   r   test_unsilence_errors   s    
r   c                 C   sL   t jt| d fd}|  |  | }|jdks:J |jdksHJ 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   r
   r
   r   )test_thread_hdf5_silence_error_membership2   s    r   c                    sP    fdd}t j|d}|  |  | }|jdks>J |jdksLJ dS )zVerify the error printing is squashed in all threads.

    No console messages should be shown for non-existing attributes
    c               	      sf   t  d dB} g d| d< z| d jd }W n tyB   Y n0 W d    n1 sX0    Y  d S )Nr   r   )         newdatanonexistent_attr)r   r   attrsr   )r	   r#   r   r
   r   testF   s    z1test_thread_hdf5_silence_error_attr.<locals>.test)r   r   N)r   r   r   r   r   r   r   )r   r   r&   r   r   r
   r%   r   #test_thread_hdf5_silence_error_attrA   s    r'   )__doc__r   r   r   r   r   r'   r
   r
   r
   r   <module>
   s   	