Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/__pycache__/shouldraise.cpython-311.pyc

�

�܋fP���ddlmZddlmZddlmZmZmZddlm	Z	m
Z
eeeefZdZ
Gd�de��ZGd�d	��Zed
efd���ZdS)
�)�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�:�eZdZdezZdZd	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�$�||_||_dS�N)r
�expected��selfr
rs   �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/testfixtures/shouldraise.py�__init__zShouldRaise.__init__*s��"���"�
��
�
�
�c��|Sr�)rs r�	__enter__zShouldRaise.__enter__.s���rc�J�d}||_|jr�|jru|�Zt|jt��rt	|��}|j|urdSn%t	|j��t	|��urdSt|j|dd���n|st
d���n|rdSdS)NTFr�raised��x_label�y_labelzNo exception raised!)rrr
�
isinstance�typer
�AssertionError)r�type_�actual�	traceback�__tracebackhide__s     r�__exit__zShouldRaise.__exit__1s��� ������=�	��~�
=��%�!�$�.�$�7�7�)�!%�f�����>��7�7�#(�5�8� ���/�/�t�F�|�|�C�C�#(�5����� *� (�*�*�*�*�*��
=�$�%;�<�<�<�
=�
�	��5��tr)NF)�__name__�
__module__�__qualname__�
param_docs�__doc__r�ExceptionOrType�boolrrr&rrrrr sq���������G��F�#�#�/�#�$�#�#�#�#��������rrc�:�eZdZdezZd	dedefd�Zdedefd�Z	dS)
�should_raisez�
    A decorator to assert that the decorated function will raised
    an exception. An exception class or exception instance may be
    passed to check more specifically exactly what exception will be
    raised.
    Nr
rc�"�||_||_dSr)r
rrs   rrzshould_raise.__init__Qs��"�������r�target�returnc�@���t�����fd���}|S)Nc�~��t�j�j��5�|i|��ddd��dS#1swxYwYdSr)rr
r)�args�kwrr1s  ��r�_should_raise_wrapperz4should_raise.__call__.<locals>._should_raise_wrapperWs�����T�^�T�[�9�9�
$�
$����#��#�#�#�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$�
$�
$s�	2�6�6r)rr1r7s`` r�__call__zshould_raise.__call__Us:����	�v���	$�	$�	$�	$�	$�
��	$�%�$r)NN)
r'r(r)r*r+r,r-rrr8rrrr/r/Isn�������
��G���/��$�����%�x�%�H�%�%�%�%�%�%rr/�
expected_textc	#��K�	dV�td|z���#t$r@}t|��}||kr tt||dd������Yd}~dSd}~wwxYw)zo
    A context manager to check that an :class:`AssertionError`
    is raised and its text is as expected.
    Nz)Expected AssertionError(%r), None raised!rr#r)r!�strr	)r9�e�actual_texts   r�ShouldAssertr>_s�����	,�
�����H�*�+�,�,�	,��
�M�M�M��!�f�f���K�'�'� ��m�[�.8�(�"L�"L�"L�M�M�
M�(�'�'�'�'�'�����M���s��
A$�5A�A$N)�
contextlibr�	functoolsr�typingrrr�testfixturesr	r
�	Exceptionr,r*�objectrr/r;r>rrr�<module>rEs���%�%�%�%�%�%�������(�(�(�(�(�(�(�(�(�(�&�&�&�&�&�&�&�&��	�4�	�?�2�3���
�,&�&�&�&�&�&�&�&�&�R%�%�%�%�%�%�%�%�,�,��,�,�,���,�,�,r

Hacked By AnonymousFox1.0, Coded By AnonymousFox