
    j                     Z    d dl Z d dlZd dlZd dlZd dlmZ ddlmZ  G d de          Z	dS )    N)_objects   )TestCasec                      e Zd Zd Zd Zd Zej                            d          ej        	                    d          ej        
                     eed           d          d	                                     Zd
S )TestObjectsc                 Z    t          j        d          }~t          j        d          }~d S )Nr   r   )oObjectIDselfoids     Z/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/h5py/tests/test_objects.pytest_invalidzTestObjects.test_invalid   s&    jmmjmmCC    c                     t          j        d          }t          j        d          }t          j        d          }|                     ||           |                     ||           d S )N*   +   )r	   r
   assertEqualassertNotEqual)r   oid1oid2oid3s       r   test_equalityzTestObjects.test_equality   s[    z"~~z"~~z"~~t$$$D$'''''r   c                     t          j        d          }|                     t                    5  t	          |           d d d            d S # 1 swxY w Y   d S )Nr   )r	   r
   assertRaises	TypeErrorhashr   s     r   	test_hashzTestObjects.test_hash%   s    jnny)) 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAz!fork() from a thread may deadlock)reasonzAignore:.*use of fork\(\) may lead to deadlocks:DeprecationWarningforkzfork() not availablec                     t          j                    fd}t          j        |          }|                                                                  	 t          j                    }|dk    rht          j        	                    d          r3t          j        
                                 t          j        d           nt          j        d           nt          j        	                    d          sJ t          j        
                                 t          j        |d          \  }}t          j        |          sJ t          j        |          dk    sJ |                                 dS # |                                 w xY w)a  Test that handling of the phil Lock after fork is correct.

        h5py uses os.register_at_fork() to cause os.fork() to acquire the phil lock
        before forking and release it afterwards, so that the global state of libhdf5
        cannot be cloned in a corrupted state.
        c                      t           j        5                                    t          j        d           d d d            d S # 1 swxY w Y   d S )Nr   )r	   philsettimesleep)thread_acquired_phil_events   r   fz2TestObjects.test_phil_fork_with_threads.<locals>.f:   s       *..000
1                 s   )AAA)targetr   F)blockingr   N)	threadingEventThreadstartwaitosr    r	   r#   acquirerelease_exitwaitpid	WIFEXITEDWEXITSTATUSjoin)r   r(   threadpid_statusr'   s         @r   test_phil_fork_with_threadsz'TestObjects.test_phil_fork_with_threads+   s^    &/_%6%6"	 	 	 	 	 !+++"'')))	 '))Caxx 6>>5>11  FNN$$$HQKKKKHQKKKK v~~u~55555   JsA..	6|F+++++~f--2222KKMMMMMFKKMMMMs   D	E7 7FN)__name__
__module____qualname__r   r   r   pytestmarkthread_unsafefilterwarningsskipifhasattrr0   r<    r   r   r   r      s          ( ( (   [&IJJ[L  [GGB///8NOO+ + PO	  KJ+ + +r   r   )
r0   r+   r%   r@   h5pyr   r	   commonr   r   rF   r   r   <module>rI      s    
			                  I I I I I( I I I I Ir   