HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_baseexception.cpython-310.opt-1.pyc
o

�i�@s`ddlZddlZddlZddlmZGdd�dej�ZGdd�dej�Ze	dkr.e�
�dSdS)�N)�systemc@sTeZdZdZdd�Zdd�Zdd�ZdZd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�ExceptionClassTestsz]Tests for anything relating to exception objects themselves (e.g.,
    inheritance hierarchy)cCs|�ttt��dS�N)�
assertTrue�
issubclass�	Exception�object��self�r�4/usr/local/lib/python3.10/test/test_baseexception.py�test_builtins_new_stylesz+ExceptionClassTests.test_builtins_new_stylecCs,dD]}|�t||�d|jj|f�qdS)N)�args�__str__�__repr__z%s missing %s attribute)r�hasattr�	__class__�__name__)r
Zins�attrrrr�verify_instance_interfaces
���z-ExceptionClassTests.verify_instance_interfacec	Csvt�}tj��D]}z
t|t�r|�|j�Wqty Yqwt	t
j�t
j�
t�dd�dd�}z�|����}ztt|�}WntyP|�d|�Ynw|�||d|�|�|�g}d}|D]�}|��}|�d�}	||	dd�}
d	|
vr�|
�d	�}|
|d
d�}|
d|d
�}
t�|kr�|�|
�qed|
vr�|
�d�}
|
d|
d
�}
ztt|
�}Wnty�|�d
|
�Ynw||	kr�|�||f�n||	kr�|dd|	kr�|��|dd|	ks�|�t||dd
�d|j|dd
jf�z|�|��Wn
t�yYnw|�|
|�|�|
�|}|	}qeW|��n|��w|�t|�dd|�dS)Nrzexception_hierarchy.txtzutf-8)�encodingzbase class %s not a built-inz%s not found�-��(�����[z%s not a built-in exceptionz%s is not a subclass of %sz%s not accounted for) �set�builtins�__dict__�valuesr�
BaseException�addr�	TypeError�open�os�path�join�split�__file__�readline�rstrip�getattr�AttributeError�failZassertIn�discard�rindex�index�platform_system�append�poprr�close�assertEqual�len)r
Zexc_set�object_Zinheritance_treeZsuperclass_name�last_excZsuperclassesZ
last_depthZexc_line�depthZexc_nameZparen_indexZ
platform_nameZleft_bracket�excrrr�test_inheritances�
�����





�����
�#z$ExceptionClassTests.test_inheritance)�lengthr�str�reprc	Cs6t|j|�D]\}\}}|�||d|||f�qdS)Nz%s: %s != %s)�zip�interface_testsr6)r
�resultsZ	test_nameZgivenZexpectedrrr�interface_test_driverUs

��z)ExceptionClassTests.interface_test_drivercCsZd}t|�}t|j�dg|jd|gt|�t|�gt|�d|jj|fgf}|�|�dS)N�spamrrz%s(%r))rr7rr>r?rrrC)r
�argr;rBrrr�test_interface_single_argZs�z-ExceptionClassTests.test_interface_single_argcCsdd}tt|��}t|�}t|j�|g|j|gt|�t|�gt|�|jjt|j�gf}|�	|�dS)N�)
�tuple�rangerr7rr>r?rrrC)r
�	arg_countrr;rBrrr�test_interface_multi_argcs�z,ExceptionClassTests.test_interface_multi_argcCsJt�}t|j�dg|jt�gt|�dgt|�|jjdgf}|�|�dS)Nr�z())	rr7rrHr>r?rrrC)r
r;rBrrr�test_interface_no_argms
�z)ExceptionClassTests.test_interface_no_argcsXddl}i�G�fdd�dt�}Gdd�dt�}t�}|��|�<|���|��dS)Nrcs$eZdZdef��fdd�Z�ZS)zXExceptionClassTests.test_setstate_refcount_no_crash.<locals>.HashThisKeyWillClearTheDict�returncs���t���Sr)�clear�super�__hash__r	)r�drrrQ{s
zaExceptionClassTests.test_setstate_refcount_no_crash.<locals>.HashThisKeyWillClearTheDict.__hash__)r�
__module__�__qualname__�intrQ�
__classcell__r�rR)rr�HashThisKeyWillClearTheDictzsrXc@�eZdZdS)zBExceptionClassTests.test_setstate_refcount_no_crash.<locals>.ValueN�rrSrTrrrr�Value~�r[)�gcr>r�__setstate__Zcollect)r
r]rXr[r;rrWr�test_setstate_refcount_no_crashus
z3ExceptionClassTests.test_setstate_refcount_no_crashN)
rrSrT�__doc__r
rr<rArCrFrKrMr_rrrrrs>	
rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
UsageTestszTest usage of exceptionscCsz|�tyYdSw)z6Make sure that raising 'object_' triggers a TypeError.N)r#r.�type�r
r8rrr�raise_fails�s
�zUsageTests.raise_failscCs�zzt�|yYnwWntyYnty(|�dt|��Ynwzzt�|fy8YWdSwtyBYdStyT|�dt|��YdSw)z,Catching 'object_' should raise a TypeError.z#TypeError expected when catching %sNz;TypeError expected when catching %s as specified in a tuple)rr#r.rbrcrrr�catch_fails�s2�����zUsageTests.catch_failscC�*Gdd�dt�}|�|�|�|��dS)Nc@rY)zDUsageTests.test_raise_new_style_non_exception.<locals>.NewStyleClassNrZrrrr�
NewStyleClass�r\rg)rrd)r
rgrrr�"test_raise_new_style_non_exception�s
z-UsageTests.test_raise_new_style_non_exceptioncC�|�d�dS�NrD)rdr	rrr�test_raise_string��zUsageTests.test_raise_stringcCrf)Nc@rY)zAUsageTests.test_catch_non_BaseException.<locals>.NonBaseExceptionNrZrrrr�NonBaseException�r\rm)rre)r
rmrrr�test_catch_non_BaseException�s
z'UsageTests.test_catch_non_BaseExceptioncCs|�t��dSr)rer!r	rrr�!test_catch_BaseException_instance�sz,UsageTests.test_catch_BaseException_instancecCrirj)rer	rrr�test_catch_string�rlzUsageTests.test_catch_stringN)rrSrTr`rdrerhrkrnrorprrrrra�s
ra�__main__)Zunittestrr%�platformrr2ZTestCaserrar�mainrrrr�<module>sB�