File: //usr/local/lib/python3.10/test/__pycache__/test_baseexception.cpython-310.opt-2.pyc
o
�i � @ s` d dl Z d dlZd dlZd dlmZ G dd� de j�ZG dd� de j�Ze dkr.e �
� dS dS )� N)�systemc @ sR e Zd Z dd� Zdd� Zdd� ZdZdd � Zd
d� Zdd
� Z dd� Z
dd� ZdS )�ExceptionClassTestsc C s | � ttt�� d S �N)�
assertTrue�
issubclass� Exception�object��self� r �4/usr/local/lib/python3.10/test/test_baseexception.py�test_builtins_new_style s z+ExceptionClassTests.test_builtins_new_stylec C s, dD ]}| � t||�d|jj|f � qd S )N)�args�__str__�__repr__z%s missing %s attribute)r �hasattr� __class__�__name__)r
Zins�attrr r r �verify_instance_interface s
���z-ExceptionClassTests.verify_instance_interfacec C sv t � }tj�� D ]}z
t|t�r|�|j� W q ty Y qw t t
j�t
j�
t�d d�dd�}z�|�� �� }ztt|�}W n tyP | �d| � Y nw | �||d| � |�|� g }d}|D ]�}|�� }|�d�} || d d � }
d |
v r�|
�d �}|
|d
d� }|
d |d
� }
t� |kr�|�|
� qed|
v r�|
�d�}
|
d |
d
� }
ztt|
�}W n ty� | �d
|
� Y nw || k r�|�||f� n|| kr�|d d | kr�|�� |d d | ks�| �t||d d
�d|j|d d
jf � z| �|� � W n
t�y Y nw | �|
|� |�|
� |}| }qeW |�� n|�� w | �t|�dd| � d S )Nr zexception_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�popr r �close�assertEqual�len)r
Zexc_set�object_Zinheritance_treeZsuperclass_name�last_excZsuperclassesZ
last_depthZexc_line�depthZexc_nameZparen_indexZ
platform_nameZleft_bracket�excr r r �test_inheritance s�
�����
�����
�#z$ExceptionClassTests.test_inheritance)�lengthr �str�reprc C s6 t | j|�D ]\}\}}| �||d|||f � qd S )Nz%s: %s != %s)�zip�interface_testsr6 )r
�resultsZ test_nameZgivenZexpectedr r r �interface_test_driverU s
��z)ExceptionClassTests.interface_test_driverc C sZ d}t |�}t|j�dg|jd |gt|�t|�gt|�d|jj|f gf}| �|� d S )N�spamr r z%s(%r))r r7 r r>