Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_baseexception.cpython-311.pyc |
�
�Ke � � � d dl Z d dlZd dlZd dlmZ G d� de j � � Z G d� de j � � Ze dk r e j
� � dS dS )� N)�systemc �F � e Zd ZdZd� Zd� Zd� ZdZd� Zd� Z d� Z
d � Zd
� ZdS )�ExceptionClassTestsz]Tests for anything relating to exception objects themselves (e.g.,
inheritance hierarchy)c �` � | � t t t � � � � d S �N)�
assertTrue�
issubclass� Exception�object��selfs �A/usr/local/apps/python3/lib/python3.11/test/test_baseexception.py�test_builtins_new_stylez+ExceptionClassTests.test_builtins_new_style s$ � ����
�9�f�5�5�6�6�6�6�6� c �x � dD ]6}| � t ||� � |j j �d|�d�� � �7d S )N)�args�__str__�__repr__z missing z
attribute)r �hasattr� __class__�__name__)r
�ins�attrs r �verify_instance_interfacez-ExceptionClassTests.verify_instance_interface s[ � �3� 8� 8�D��O�O�G�C��.�.���/�/�/����7�
8�
8�
8�
8� 8� 8r c �t � t � � }t j � � � D ]B} t |t
� � r|� |j � � �3# t $ r Y �?w xY wt t j � t j �
t � � d d� � d�� � } |� � � � � � } t# t |� � }n(# t$ $ r | � d|z � � Y nw xY w| � ||d|z � � |� |� � g }d}|D �]�}|� � � }|� d� � } || dz d � }
d |
v rW|
� d � � }|
|d
z d� }|
d |d
z
� }
t1 � � |k r|� |
� � ��d|
v r"|
� d� � }
|
d |
d
z
� }
t# t |
� � }n(# t$ $ r | � d
|
z � � Y nw xY w|| k r|� ||f� � n>|| k r8|d d | k r&|� � � |d d | k �&| � t ||d d
� � |j �d|d d
j ��� � | � |� � � � n# t $ r Y nw xY w| � |
|� � |� |
� � |}| }�� |� � � n# |� � � w xY w| � t? |� � dd|z � � d S )Nr zexception_hierarchy.txtzutf-8)�encodingzbase class %s not a built-inz%s not foundu ─� �(� ����[z%s not a built-in exceptionz is not a subclass of z%s not accounted for) �set�builtins�__dict__�valuesr �
BaseException�addr � TypeError�open�os�path�join�split�__file__�readline�rstrip�getattr�AttributeError�fail�assertIn�discard�rindex�index�platform_system�append�popr r �close�assertEqual�len)r
�exc_set�object_�inheritance_tree�superclass_name�last_exc�superclasses�
last_depth�exc_line�depth�exc_name�paren_index�
platform_name�left_bracket�excs r �test_inheritancez$ExceptionClassTests.test_inheritance s# � ��%�%���(�/�/�1�1� � �G�
��g�}�5�5� 2��K�K�� 0�1�1�1����
�
�
���
���� �����R�W�]�]�8�4�4�Q�7�9R�S�S� �"� "� "��. %�.�7�7�9�9�@�@�B�B�O�
L�"�8�_�=�=����!�
L�
L�
L�� � �8�?�J�K�K�K�K�K�
L�����M�M�/�7�(�?�:�
<�
<�
<��O�O�O�,�,�,��L��J�,� !
#� !
#��#�?�?�,�,�� ����.�.��#�E�!�G�H�H�-���(�?�?�"*�.�.��"5�"5�K�$,�[��]�2�-=�$>�M�'���Q���7�H�&�(�(�M�9�9�����1�1�1� ��(�?�?�#+�>�>�#�#6�#6�L�'���a���8�H�H�!�(�H�5�5�C�C��%� H� H� H��I�I�;�h�F�G�G�G�G�G�H������%�%� �'�'��X�(>�?�?�?�?��%�'�'�&�r�*�1�-��6�6�$�(�(�*�*�*� '�r�*�1�-��6�6����
�3��R�0@��0C� D� D�03���� ��$�Q�'�0�0�2�3� 3� 3���2�2�3�3�5�5�9�9�9�9�� � � � ��D������
�
�h��0�0�0�����)�)�)���"�
�
�C!
#�F
�"�"�$�$�$�$���"�"�$�$�$�$��������W���q�*@�7�*J�K�K�K�K�Ks� �/A �
A-�,A-�&M8 �/D �M8 �"D*�'M8 �)D*�*C2M8 �H3�2M8 �3"I�M8 �I�B*M8 �L!� M8 �!
L.�+M8 �-L.�.4M8 �8N)�lengthr �str�reprc
� � t | j |� � D ]'\ }\ }}| � |||�d|�d|��� � �(d S )Nz: z != )�zip�interface_testsr<