o
    ÑtPf	  ã                   @   sN   d dl Z d dlmZ G dd„ deƒZG dd„ dejƒZedkr%e 	¡  dS dS )é    Nc                   @   s   e Zd ZdS )ÚMyExceptionN)Ú__name__Ú
__module__Ú__qualname__© r   r   ú\/var/www/html/humari/django-venv/lib/python3.10/site-packages/gevent/tests/test__issue330.pyr      s    r   c                       sT   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
‡  ZS )Ú
TestSwitchc                    s"   t t| ƒ ¡  ddg| _d | _d S ©NF)Úsuperr   ÚsetUpÚswitched_toÚcaught)Úself©Ú	__class__r   r   r      s   

zTestSwitch.setUpc                 C   s   d| j |< d S )NT)r   )r   Úir   r   r   Úshould_never_run   s   zTestSwitch.should_never_runc                 C   st   t  ||f¡ |  ddg| j¡ |  |jt j¡ |  |jt j¡ |  |j¡ |  |j¡ |  |j	¡ |  |j	¡ d S r	   )
ÚgeventÚjoinallÚassertEqualr   ÚassertIsInstanceÚvalueÚGreenletExitÚassertIsNoneÚexc_infoÚ	exception©r   ÚgÚg2r   r   r   Úcheck   s   zTestSwitch.checkc                 C   s@   t  | jd¡}t  | jd¡}t  |¡ t  |¡ |  ||¡ d S ©Nr   é   ©r   Úspawnr   Úkillr   r   r   r   r   Útest_gevent_kill#   s
   

zTestSwitch.test_gevent_killc                 C   s<   t  | jd¡}t  | jd¡}| ¡  | ¡  |  ||¡ d S r    r"   r   r   r   r   Útest_greenlet_kill+   s
   zTestSwitch.test_greenlet_killc                 C   sD   t  | jd¡}t  | jd¡}| t j¡ | t j¡ |  ||¡ d S r    )r   r#   r   Úthrowr   r   r   r   r   r   Ú
test_throw3   s
   zTestSwitch.test_throwc              
   C   s<   z	 t  d¡ q ty } z
|| _W Y d }~d S d }~ww )NTr   )r   Úsleepr   r   )r   Úer   r   r   Úcatcher<   s   
ÿ€ÿzTestSwitch.catcherc                 C   sR   t  | j¡}| ¡  t  ¡  t  |tƒ ¡ t  ¡  |  | jt¡ |  	|j
t¡ d S )N)r   r#   r+   Ústartr)   r$   r   r   r   r   r   )r   r   r   r   r   Útest_kill_exceptionC   s   zTestSwitch.test_kill_exception)r   r   r   r   r   r   r%   r&   r(   r+   r-   Ú__classcell__r   r   r   r   r   
   s    	r   Ú__main__)
r   Úgevent.testingÚtestingÚ	greentestÚ	Exceptionr   ÚTestCaser   r   Úmainr   r   r   r   Ú<module>   s   Gÿ