o
    tPfa                     @   s   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 dZe	ddd  dd	d
Z
G dd deejZG dd deZedkrGe  dS dS )    N)Event)TimeAssertMixing?   c                   C      d S N r   r   r   d/var/www/html/humari/django-venv/lib/python3.10/site-packages/gevent/tests/test__hub_join_timeout.py<lambda>       r	      c                    s   t   fdd}|S )Nc                    s   t D ]} |  qd S r   )range)self_funcrepetitionsr   r   f   s   
zrepeated.<locals>.f)	functoolswraps)r   r   r   r   r   r   repeated   s   r   c                   @   sT   e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	dS )Testc                 C   sl   t dd }|   t jdd}W d    n1 sw   Y  | | | |j| | |jd d S )Nc                   S      dS N   r   r   r   r   r   r	      r
   z$Test.test_callback.<locals>.<lambda>
   timeoutr   )geventspawnruns_in_no_timewait
assertTruedeadassertEqualvaluer   xresultr   r   r   test_callback   s   

zTest.test_callbackc                 C   sb   t tdd }| t t jdd}W d    n1 sw   Y  | | | |j| d S )Nc                   S   r   r   r   r   r   r   r   r	   &   r
   z!Test.test_later.<locals>.<lambda>r   r   )r   spawn_later
SMALL_TICKruns_in_given_timer    r!   r"   r%   r   r   r   
test_later#   s   
zTest.test_laterc                 C   s   t ddd }| t t jtd}W d    n1 sw   Y  | | | |j| |  |   t  }W d    n1 sFw   Y  | 	| d S )Nr   c                   S   r   r   r   r   r   r   r   r	   /   r
   z#Test.test_timeout.<locals>.<lambda>r   )
r   r)   r+   r*   r    assertFalser"   killr   r!   r%   r   r   r   test_timeout,   s   


zTest.test_timeoutc                 C   s   t ddd }t }t t|j}| t t |g}W d    n1 s(w   Y  | ||g | |j	| | 
|j	 | 
|j |  |   t  }W d    n1 s^w   Y  | 
| d S )Nr   c                   S   r   r   r   r   r   r   r   r	   =   r
   z!Test.test_event.<locals>.<lambda>)r   r)   r   r*   setr+   r    r#   r-   r"   r!   is_setr.   r   )r   r&   event	event_setr'   r   r   r   
test_event:   s   

zTest.test_eventc                 C   s\   t  jjddddd  |   t  }W d    n1 s"w   Y  | | d S )Nr   F)refc                   S   r   r   r   r   r   r   r   r	   O   r
   z#Test.test_ref_arg.<locals>.<lambda>)r   get_hublooptimerstartr   r    r!   )r   r'   r   r   r   test_ref_argL   s
   

zTest.test_ref_argc                 C   sb   t  jd}|dd  d|_|   t  }W d    n1 s%w   Y  | | d S )Nr   c                   S   r   r   r   r   r   r   r   r	   X   r
   z)Test.test_ref_attribute.<locals>.<lambda>F)	r   r6   r7   r8   r9   r5   r   r    r!   )r   wr'   r   r   r   test_ref_attributeT   s   

zTest.test_ref_attributeN)
__name__
__module____qualname__r   r(   r,   r/   r4   r:   r<   r   r   r   r   r      s    
	



r   c                   @   s   e Zd ZdZdS )	TestAgainzRepeat the same testsN)r=   r>   r?   __doc__r   r   r   r   r@   _   s    r@   __main__)r   )r   unittestr   gevent.coregevent.eventr   gevent.testing.testcaser   r*   signal_handlerr   TestCaser   r@   r=   mainr   r   r   r   <module>   s    
H