Q0.*sh 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 ) )contextmanagerwraps)UnionTypeCallable)diffcomparea+ :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 dedefdZd Z d Z dS ) ShouldRaisezs This context manager is used to assert that an exception is raised within the context it is managing. NF exceptionunlessc $ || _ | | _ d S N)r expectedselfr r s j/builddir/build/BUILD/cloudlinux-venv-1.0.10/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 raisedx_labely_labelzNo exception raised!)r r r isinstancetyper AssertionError)r type_actual traceback__tracebackhide__s r __exit__zShouldRaise.__exit__1 s = ~ =%!$.$77 )!%f>77#(5 8 //tF||CC#(5 * (* * * * * =$%;<<< = 5tr )NF)__name__ __module____qualname__ param_docs__doc__r ExceptionOrTypeboolr r r&