Hacked By AnonymousFox
�
�܋fP � � � d dl mZ d dlmZ d dlmZmZmZ d dlm Z m
Z
eeee f ZdZ
G d� de� � Z G d� d � � Zed
efd�� � ZdS )
� )�contextmanager��wraps)�Union�Type�Callable)�diff�comparea+
:param exception: This can be one of the following:
* `None`, indicating that an exception must be
raised, but the type is unimportant.
* An exception class, indicating that the type
of the exception is important but not the
parameters it is created with.
* An exception instance, indicating that an
exception exactly matching the one supplied
should be raised.
:param unless: Can be passed a boolean that, when ``True`` indicates that
no exception is expected. This is useful when checking
that exceptions are only raised on certain versions of
Python.
c �: � e Zd Zdez ZdZd dedefd�Zd� Z d� Z
dS )
�ShouldRaisezs
This context manager is used to assert that an exception is raised
within the context it is managing.
NF� exception�unlessc �$ � || _ | | _ d S �N)r
�expected��selfr
r s �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/testfixtures/shouldraise.py�__init__zShouldRaise.__init__* s � �"���"�
��
�
�
� c � � | S r � )r s r � __enter__zShouldRaise.__enter__. s � ��r c �J � d}|| _ | j r�| j ru|�Zt | j t � � rt |� � }| j |urdS n%t | j � � t |� � urdS t | j |dd�� � n|st
d� � �n|rdS dS )NTFr �raised��x_label�y_labelzNo exception raised!)r r r
�
isinstance�typer
�AssertionError)r �type_�actual� traceback�__tracebackhide__s r �__exit__zShouldRaise.__exit__1 s� � � ������=� ��~�
=��%�!�$�.�$�7�7� )�!%�f�����>��7�7�#(�5� 8� ���/�/�t�F�|�|�C�C�#(�5����� *� (�*� *� *� *� *� �
=�$�%;�<�<�<�
=�
� ��5��tr )NF)�__name__�
__module__�__qualname__�
param_docs�__doc__r �ExceptionOrType�boolr r r&