HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/greenlet/tests/__pycache__/test_throw.cpython-310.pyc
o

���g��@s<ddlZddlmZddlmZdd�ZGdd�de�ZdS)	�N)�greenlet�)�TestCasecGst��jj|�S)N)r�
getcurrent�parent�switch)�args�r	�D/usr/local/lib/python3.10/dist-packages/greenlet/tests/test_throw.pyrsrc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�
ThrowTestscCs>dd�}t|�}|��}|�|d�|�t�}|�|d�dS)NcSs6ztd�Wntytd�YdSwtd�dS�N�ok�fail)r�RuntimeErrorr	r	r	r
�f
s�z ThrowTests.test_class.<locals>.fr
�rr�assertEqual�throwr��selfr�g�resr	r	r
�
test_classs
zThrowTests.test_classcCsvdd�}t|�}|��}|�|d�|�td��}|�|d�t|�}|��}|�|d�|�td�}|�|d�dS)NcSsRztd�Wnty"t��d}t|�dkr td�YdSYnwtd�dS)Nr
r�ciaor)rr�sys�exc_info�str)�valr	r	r
rs��zThrowTests.test_val.<locals>.fr
rrrr	r	r
�test_vals
zThrowTests.test_valcCshdd�}t|�}|��}|�|d�|��}|�t|tj��|�|j�|��}|�t|tj��dS)NcSstd�td�dSr�rr	r	r	r
r2szThrowTests.test_kill.<locals>.fr
)rrrr�
assertTrue�
isinstance�GreenletExit�deadrr	r	r
�	test_kill1szThrowTests.test_killcsDt����fdd�}�fdd�}t|�}t||d�}|�t��
|�t�Wd�n1s/wY|�|j�|�|j�t|�}t||d�}|��}|�|d�|�t�}|�|d�|�|j�|�|j�t|�}t||d�}|��}|�|d�|��}|�|d�|�t�}|�|d�|�|j�|�|j�dS)	Ncs&z��d�WdStyYdSw)N�f1 ready to catch�caughtznormal exit)r�
IndexErrorr	��mainr	r
�f1As��z9ThrowTests.test_throw_goes_to_original_parent.<locals>.f1cs��d�dS)N�from f2rr	r(r	r
�f2Hsz9ThrowTests.test_throw_goes_to_original_parent.<locals>.f2)rr%r&r+)	rr�assertRaisesr'rr r#rr)rr*r,�g1�g2rr	r(r
�"test_throw_goes_to_original_parent>s8�

z-ThrowTests.test_throw_goes_to_original_parentcCsT|�t��}t���tt�|�Wd�n1swY|�t|j�d�dS)Nz1throw() third argument must be a traceback object)	r-�	TypeErrorrrr�	Exceptionrr�	exception�r�excr	r	r
�test_non_traceback_paramfs���z#ThrowTests.test_non_traceback_paramcCsT|�t��}t���t�t��Wd�n1swY|�t|j	�d�dS)Nz0instance exception may not have a separate value)
r-r1rrrr2�
BaseExceptionrrr3r4r	r	r
�test_instance_of_wrong_typeps���z&ThrowTests.test_instance_of_wrong_typecCsN|�t��}t���d�Wd�n1swY|�t|j�d�dS)N�abcz1exceptions must be classes, or instances, not str)r-r1rrrrrr3r4r	r	r
�test_not_throwablezs���zThrowTests.test_not_throwableN)
�__name__�
__module__�__qualname__rrr$r0r6r8r:r	r	r	r
rs
(

r)rr�rrrr	r	r	r
�<module>s