
    F-Ph"                    R   d dl mZ d dlmZ d dlmZ d dlZd dlmZ d dlZd dlm	Z	 d dl
mZ d dl
mZ d d	l
mZ d d
l
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ erKd dlmZ d dlmZ d dl Z d dl!m"Z" d dl!m#Z# d dl!m$Z$  e"d          Z% e$de&e&d          Z' e$de&e&          Z(nd dl
m$Z$  e$de&d          Z' e$d e&d          Z) e$d!e&"          Z* e$d#e&"          Z+ e$d$e,"          Z- e$d%e,"          Z.ej/        d&k     rd d'l0m1Z1 d d(l0m2Z2  ej3        d)          j4        Z5ed*d*d+dhd4            Z6ed*d5did9            Z6edjd:            Z6edkdA            Z6	 dldmdDZ6ej,        e6_,        dndGZ7dodKZ8dpdMZ9dqdPZ:drdVZ;dsdXZ<dpdYZ= G dZ d[eee)                   Z>e G d\ d]e>e'                               Z?e G d^ d_e>e1e)                                        Z@e G d` da                      ZA G db dc          ZBdldtdgZCdS )u    )annotations)ABC)abstractmethodN)Pattern)indent)Any)cast)final)Generic)get_args)
get_origin)Literal)overload)TYPE_CHECKING)ExceptionInfo)stringify_exception)fail)PytestWarning)Callable)Sequence)	ParamSpec)	TypeGuard)TypeVarPBaseExcT_co_defaultT)bounddefault	covariantE)r   r   )r   r   BaseExcT_co
BaseExcT_1)r   
BaseExcT_2ExcT_1ExcT_2)      )BaseExceptionGroup)ExceptionGroup .matchcheckexpected_exceptiontype[E] | tuple[type[E], ...]r+   str | re.Pattern[str] | Noner,   Callable[[E], bool]returnRaisesExc[E]c                   d S N )r-   r+   r,   s      N/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/raises.pyraisesr7   I   s	     3    r,   str | re.Pattern[str]Callable[[BaseException], bool]RaisesExc[BaseException]c                    d S r4   r5   r*   s     r6   r7   r7   R   s	      #sr8   c                    d S r4   r5   r9   s    r6   r7   r7   [   s    SVSVr8   funcCallable[..., Any]argsr   kwargsExceptionInfo[E]c                    d S r4   r5   )r-   r?   rA   rB   s       r6   r7   r7   _   s	     sr8   $type[E] | tuple[type[E], ...] | None+RaisesExc[BaseException] | ExceptionInfo[E]c                   d}|sjt          |          h dz
  r;d}|d                    t          |                    z  }|dz  }t          |          | t	          di |S t	          | fi |S | st          d| d          |d	         }t          |          s"t          |d
t          |           d          t	          |           5 } ||dd         i | ddd           n# 1 swxY w Y   	 |~S # ~w xY w)a  Assert that a code block/function call raises an exception type, or one of its subclasses.

    :param expected_exception:
        The expected exception type, or a tuple if one of multiple possible
        exception types are expected. Note that subclasses of the passed exceptions
        will also match.

        This is not a required parameter, you may opt to only use ``match`` and/or
        ``check`` for verifying the raised exception.

    :kwparam str | re.Pattern[str] | None match:
        If specified, a string containing a regular expression,
        or a regular expression object, that is tested against the string
        representation of the exception and its :pep:`678` `__notes__`
        using :func:`re.search`.

        To match a literal string that may contain :ref:`special characters
        <re-syntax>`, the pattern can first be escaped with :func:`re.escape`.

        (This is only used when ``pytest.raises`` is used as a context manager,
        and passed through to the function otherwise.
        When using ``pytest.raises`` as a function, you can use:
        ``pytest.raises(Exc, func, match="passed on").match("my pattern")``.)

    :kwparam Callable[[BaseException], bool] check:

        .. versionadded:: 8.4

        If specified, a callable that will be called with the exception as a parameter
        after checking the type and the match regex if specified.
        If it returns ``True`` it will be considered a match, if not it will
        be considered a failed match.


    Use ``pytest.raises`` as a context manager, which will capture the exception of the given
    type, or any of its subclasses::

        >>> import pytest
        >>> with pytest.raises(ZeroDivisionError):
        ...    1/0

    If the code block does not raise the expected exception (:class:`ZeroDivisionError` in the example
    above), or no exception at all, the check will fail instead.

    You can also use the keyword argument ``match`` to assert that the
    exception matches a text or regex::

        >>> with pytest.raises(ValueError, match='must be 0 or None'):
        ...     raise ValueError("value must be 0 or None")

        >>> with pytest.raises(ValueError, match=r'must be \d+$'):
        ...     raise ValueError("value must be 42")

    The ``match`` argument searches the formatted exception string, which includes any
    `PEP-678 <https://peps.python.org/pep-0678/>`__ ``__notes__``:

        >>> with pytest.raises(ValueError, match=r"had a note added"):  # doctest: +SKIP
        ...     e = ValueError("value must be 42")
        ...     e.add_note("had a note added")
        ...     raise e

    The ``check`` argument, if provided, must return True when passed the raised exception
    for the match to be successful, otherwise an :exc:`AssertionError` is raised.

        >>> import errno
        >>> with pytest.raises(OSError, check=lambda e: e.errno == errno.EACCES):
        ...     raise OSError(errno.EACCES, "no permission to view")

    The context manager produces an :class:`ExceptionInfo` object which can be used to inspect the
    details of the captured exception::

        >>> with pytest.raises(ValueError) as exc_info:
        ...     raise ValueError("value must be 42")
        >>> assert exc_info.type is ValueError
        >>> assert exc_info.value.args[0] == "value must be 42"

    .. warning::

       Given that ``pytest.raises`` matches subclasses, be wary of using it to match :class:`Exception` like this::

           # Careful, this will catch ANY exception raised.
           with pytest.raises(Exception):
               some_function()

       Because :class:`Exception` is the base class of almost all exceptions, it is easy for this to hide
       real bugs, where the user wrote this expecting a specific exception, but some other exception is being
       raised due to a bug introduced during a refactoring.

       Avoid using ``pytest.raises`` to catch :class:`Exception` unless certain that you really want to catch
       **any** exception raised.

    .. note::

       When using ``pytest.raises`` as a context manager, it's worthwhile to
       note that normal context manager rules apply and that the exception
       raised *must* be the final line in the scope of the context manager.
       Lines of code after that, within the scope of the context manager will
       not be executed. For example::

           >>> value = 15
           >>> with pytest.raises(ValueError) as exc_info:
           ...     if value > 10:
           ...         raise ValueError("value must be <= 10")
           ...     assert exc_info.type is ValueError  # This will not execute.

       Instead, the following approach must be taken (note the difference in
       scope)::

           >>> with pytest.raises(ValueError) as exc_info:
           ...     if value > 10:
           ...         raise ValueError("value must be <= 10")
           ...
           >>> assert exc_info.type is ValueError

    **Expecting exception groups**

    When expecting exceptions wrapped in :exc:`BaseExceptionGroup` or
    :exc:`ExceptionGroup`, you should instead use :class:`pytest.RaisesGroup`.

    **Using with** ``pytest.mark.parametrize``

    When using :ref:`pytest.mark.parametrize ref`
    it is possible to parametrize tests such that
    some runs raise an exception and others do not.

    See :ref:`parametrizing_conditional_raising` for an example.

    .. seealso::

        :ref:`assertraises` for more examples and detailed discussion.

    **Legacy form**

    It is possible to specify a callable by passing a to-be-called lambda::

        >>> raises(ZeroDivisionError, lambda: 1/0)
        <ExceptionInfo ...>

    or you can specify an arbitrary callable with arguments::

        >>> def f(x): return 1/x
        ...
        >>> raises(ZeroDivisionError, f, 0)
        <ExceptionInfo ...>
        >>> raises(ZeroDivisionError, f, x=0)
        <ExceptionInfo ...>

    The form above is fully supported but discouraged for new code because the
    context manager form is regarded as more readable and less error-prone.

    .. note::
        Similar to caught exception objects in Python, explicitly clearing
        local references to returned ``ExceptionInfo`` objects can
        help the Python interpreter speed up its garbage collection.

        Clearing those references breaks a reference cycle
        (``ExceptionInfo`` --> caught exception --> frame stack raising
        the exception --> current frame stack --> local variables -->
        ``ExceptionInfo``) which makes Python keep all objects referenced
        from that cycle (including all local variables in the current
        frame) alive until the next cyclic garbage collection run.
        More detailed information can be found in the official Python
        documentation for :ref:`the try statement <python:try>`.
    T>   r,   r+   r-   z6Unexpected keyword arguments passed to pytest.raises: , z"
Use context-manager form instead?NzCExpected an exception type or a tuple of exception types, but got `z`. Raising exceptions is already understood as failing the test, so you don't need any special code to say 'this should never raise an exception'.r   z object (type: z) must be callable   r5   )setjoinsorted	TypeError	RaisesExc
ValueErrorcallabletype)r-   rA   rB   __tracebackhide__msgr?   excinfos          r6   r7   r7   h   s   R  	7v;;AAAA 	!JC499VF^^,,,C88CC.. %&&v&&&+66v666 
ORd O O O
 
 	

 7DD>> R4PP$t**PPPQQQ	%	&	& "'d122h!&!!!" " " " " " " " " " " " " " "GGs   C))C-0C-5C8 8C;Pattern[str]str | Pattern[str]c                4    | j         t          k    r| j        n| S )zJHelper function to remove redundant `re.compile` calls when printing regex)flags_REGEX_NO_FLAGSpattern)r+   s    r6   _match_patternr[   :  s    !K?::5==Er8   funCallable[[BaseExcT_1], bool]strc                     t          |           S )zjGet the repr of a ``check`` parameter.

    Split out so it can be monkeypatched (e.g. by hypothesis)
    )repr)r\   s    r6   repr_callablera   ?  s    
 99r8   sc                    d| z   dz   S )N`r5   rb   s    r6   	backquoterf   G  s    7S=r8   e5type[BaseException] | tuple[type[BaseException], ...]c                    t          | t                    r| j        S t          |           dk    r| d         j        S dd                    d | D                       z   dz   S )NrI   r   (rH   c              3  $   K   | ]}|j         V  d S r4   )__name__).0ees     r6   	<genexpr>z'_exception_type_name.<locals>.<genexpr>R  s$      3322;333333r8   ))
isinstancerQ   rl   lenrK   rg   s    r6   _exception_type_namert   K  sd     !T z
1vv{{t}33333333c99r8   expected_type<type[BaseException] | tuple[type[BaseException], ...] | None	exceptionBaseException
str | Nonec                f   | | dk    rd S t          ||           st          t          t          |                    dz             }t          t          |                     }t          |t                    r2t          | t                    rt          | t                    sd| d| S | d| S d S )Nr5   z()zUnexpected nested z, expected z is not an instance of )rq   rf   rt   rQ   r'   
issubclass)ru   rw   actual_type_strexpected_type_strs       r6   _check_raw_typer~   U  s      3 3t  N $$8i$I$ID$PQQ%&:=&I&IJJy"455	X=$//	X }.@AA	X
 XWWDUWWW!MM:KMMM4r8   boolc                ^     dt           fdt                     D                        S )Nz{}()+.*?^$[]c              3  P   K   | ] \  }}|v o|d k    p|dz
           dk    V  !dS )r   rI   \Nr5   )rm   icmetacharactersrb   s      r6   ro   z#is_fully_escaped.<locals>.<genexpr>o  sX        AG!Q^<a!;1QU8t+;     r8   )any	enumerate)rb   r   s   `@r6   is_fully_escapedr   l  sR    #N     KTUV<<      r8   c                .    t          j        dd|           S )Nz\\([{}()+-.*?^$\[\]\s\\])z\1)resubre   s    r6   unescaper   t  s    6.q999r8   c                  b    e Zd ZdZddZddZedd            Zd dZd!dZ	e
d"d            ZdS )#AbstractRaiseszFABC with common functionality shared between RaisesExc and RaisesGroupr+   str | Pattern[str] | Noner,   $Callable[[BaseExcT_co], bool] | Noner1   Nonec                  t          |t                    ryd }	 t          j        |          | _        n# t          j        $ r}|}Y d }~nd }~ww xY w|t          d|            |dk    r#t          j        t          d          d           n|| _        d | _
        t          |t                    s%t          |t                    ry|j        t          k    rit          |t                    r|j        }|rK|d         dk    r?|d         d	k    r3t          |d
d                   rt!          |d
d                   | _
        || _        d | _        d| _        d| _        d S )Nz+Invalid regex pattern provided to 'match': r)   zmatching against an empty string will *always* pass. If you want to check for an empty message you need to pass '^$'. If you don't want to match you should pass `None` or leave out the parameter.   )
stacklevelr   ^$rI   F)rq   r^   r   compiler+   errorr   warningswarnr   rawmatchr   rX   rY   rZ   r   r   r,   _fail_reason_nestedis_baseexception)selfr+   r,   re_errorrg   s        r6   __init__zAbstractRaises.__init__  s    eS!! 	H24*U2C2C

8   #M8MMNNN{{![ 
  !    DJ %)eS!! 	6ug&&	6+0;/+I+I%)) &6!HOO"I$$$U1R4[11 % !)qt 5 5
(, # !&s   3 AA		Aexc%type[BaseExcT_1] | types.GenericAliasexpectedr^   type[BaseExcT_1]c                |   t          |t                    r3t          |t                    rt          |t                    sd| _        |S t          |          }|rt          |t                    rt          |          d         }t          |t                    r|t          t          fv s%t          |t                    rL|t          t          fv r<t          |t                    sd| _        t          t          t                   |          S t          d| d          d| d}t          |t                    rt          ||j        z             t          |t                    r(t          |dt          |          j         dz             t          |t!          t          |          j                  z             )	NTr   znOnly `ExceptionGroup[Exception]` or `BaseExceptionGroup[BaseExeption]` are accepted as generic types but got `z`. As `raises` will catch all instances of the specified group regardless of the generic argument specific nested exceptions has to be checked with `RaisesGroup`.expected exception must be , not zan exception instance (rp   )rq   rQ   r{   rx   	Exceptionr   r   r'   r   r(   r   r	   r!   rO   rl   rM   r`   )r   r   r   
origin_excexc_typerS   s         r6   
_parse_exczAbstractRaises._parse_exc  s    c4   	Z]%C%C 	c9-- -(,%J 2<C
 	*Z1CDD 	}}Q'H:~66;C	SVGW;W;W:'9:: <X  444!#y11 1,0D)D,j999 +>A+ + +   =H<<<c4   	8Scl#66777c=)) 	SC"QDII<N"Q"Q"QQRRRd499#5666777r8   ry   c                    | j         S )zSet after a call to :meth:`matches` to give a human-readable reason for why the match failed.
        When used as a context manager the string will be printed as the reason for the
        test failing.)r   r   s    r6   fail_reasonzAbstractRaises.fail_reason  s    
   r8   r   AbstractRaises[BaseExcT_1]rw   r!   r   c                    | j         dS |                      |          rdS | j        rdndt          | j                   z   }d| d| _        dS )NTr)    r,   z did not return TrueF)r,   r   ra   r   )r   rw   
check_reprs      r6   _check_checkzAbstractRaises._check_check  sa     :4::i   	4<LRRS=3L3L-L
DJDDDur8   rg   rx   c                F   | j         +t          j        | j         t          |d          x}          rdS t	          |t
                    r dt          t          |                     dnd}t	          | j        t                    rQddl
m} dd	l
m}  || j        ||          }|d         d         d
k    rdndd                    |          z   | _        dS d| dt          | j                   d|| _        t          | j                   |k    r| xj        dz  c_        dS )NF)include_subexception_msgTz the `z()`r)   r   )
_diff_text)dummy_highlighter-
zRegex pattern did not matchz
.
 Regex: z	
 Input: z*
 Did you mean to `re.escape()` the regex?)r+   r   searchr   rq   r'   rt   rQ   r   r^   _pytest.assertion.utilr   r   rK   r   r[   )r   rg   stringified_exceptionmaybe_specify_typer   r   diffs          r6   _check_matchzAbstractRaises._check_match  sy   :J%8E& & & !"
 "
 4 !/007)$q''227777 	
 dmS)) 	 :99999@@@@@@:dm-BDUVVD)-as):):diiPToo UD5
1*< 1 1%dj111 1,1 1 	
 $*%%)>>>!NNur8   TypeGuard[BaseExcT_1]c                    dS )zCheck if an exception matches the requirements of this AbstractRaises.
        If it fails, :meth:`AbstractRaises.fail_reason` should be set.
        Nr5   r   rw   s     r6   matcheszAbstractRaises.matches  s      r8   N)r+   r   r,   r   r1   r   )r   r   r   r^   r1   r   )r1   ry   )r   r   rw   r!   r1   r   )rg   rx   r1   r   )r   r   rw   rx   r1   r   )rl   
__module____qualname____doc__r   r   propertyr   r   r   r   r   r5   r8   r6   r   r   ~  s        PP2& 2& 2& 2&h#8 #8 #8 #8J ! ! ! X!   # # # #J    ^  r8   r   c                       e Zd ZdZedddd(d            Zeddd)d            Zed*d            Z	 d+dddd, fdZd-dZd.dZd/dZd0d Z	d1d'Z
 xZS )2rN   a  
    .. versionadded:: 8.4


    This is the class constructed when calling :func:`pytest.raises`, but may be used
    directly as a helper class with :class:`RaisesGroup` when you want to specify
    requirements on sub-exceptions.

    You don't need this if you only want to specify the type, since :class:`RaisesGroup`
    accepts ``type[BaseException]``.

    :param type[BaseException] | tuple[type[BaseException]] | None expected_exception:
        The expected type, or one of several possible types.
        May be ``None`` in order to only make use of ``match`` and/or ``check``

        The type is checked with :func:`isinstance`, and does not need to be an exact match.
        If that is wanted you can use the ``check`` parameter.

    :kwparam str | Pattern[str] match
        A regex to match.

    :kwparam Callable[[BaseException], bool] check:
        If specified, a callable that will be called with the exception as a parameter
        after checking the type and the match regex if specified.
        If it returns ``True`` it will be considered a match, if not it will
        be considered a failed match.

    :meth:`RaisesExc.matches` can also be used standalone to check individual exceptions.

    Examples::

        with RaisesGroup(RaisesExc(ValueError, match="string"))
            ...
        with RaisesGroup(RaisesExc(check=lambda x: x.args == (3, "hello"))):
            ...
        with RaisesGroup(RaisesExc(check=lambda x: type(x) is ValueError)):
            ...
    .r*   r-   Atype[BaseExcT_co_default] | tuple[type[BaseExcT_co_default], ...]r+   r   r,   ,Callable[[BaseExcT_co_default], bool] | Noner1   r   c                  d S r4   r5   )r   r-   r+   r,   s       r6   r   zRaisesExc.__init__M  	     sr8   r9   r   r<   &Callable[[BaseException], bool] | Nonec                  d S r4   r5   )r   r+   r,   s      r6   r   zRaisesExc.__init__Y  	     sr8   r;   c                  d S r4   r5   )r   r,   s     r6   r   zRaisesExc.__init__c  s    NQcr8   NHtype[BaseExcT_co_default] | tuple[type[BaseExcT_co_default], ...] | Nonec                  t                                          ||           t          |t                    r|}n|d}n|f}|dk    r||t	          d          t           fd|D                        _        d _        d S )Nr*   r5   z4You must specify at least one parameter to match on.c              3  F   K   | ]}                     |d           V  dS )za BaseException type)r   N)r   rm   rg   r   s     r6   ro   z%RaisesExc.__init__.<locals>.<genexpr>{  sH       )
 )
 OOA(>O??)
 )
 )
 )
 )
 )
r8   F)superr   rq   tuplerO   expected_exceptions_just_propagate)r   r-   r+   r,   r   	__class__s   `    r6   r   zRaisesExc.__init__f  s     	uE222(%00 	8"4'"$#5"72%%5=U]STTT#( )
 )
 )
 )
()
 )
 )
 $
 $
 
  %r8   rw   BaseException | NoneTypeGuard[BaseExcT_co_default]c                    d| _         |	d| _        dS |                     |          s	d| _         dS |                     |          sdS |                     |          S )a  Check if an exception matches the requirements of this :class:`RaisesExc`.
        If it fails, :attr:`RaisesExc.fail_reason` will be set.

        Examples::

            assert RaisesExc(ValueError).matches(my_exception):
            # is equivalent to
            assert isinstance(my_exception, ValueError)

            # this can be useful when checking e.g. the ``__cause__`` of an exception.
            with pytest.raises(ValueError) as excinfo:
                ...
            assert RaisesExc(SyntaxError, match="foo").matches(excinfo.value.__cause__)
            # above line is equivalent to
            assert isinstance(excinfo.value.__cause__, SyntaxError)
            assert re.search("foo", str(excinfo.value.__cause__)

        FNexception is NoneT)r   r   _check_typer   r   r   s     r6   r   zRaisesExc.matches  sq    ,  % 3D5	** 	#'D 5  ++ 	5  +++r8   r^   c                X   g }| j         r'|                    t          | j                              | j        *|                    dt	          | j                             | j        *|                    dt          | j                              dd                    |           dS )Nmatch=check=z
RaisesExc(rH   rp   )r   appendrt   r+   r[   r,   ra   rK   )r   
parameterss     r6   __repr__zRaisesExc.__repr__  s    
# 	N243KLLMMM:!7
3377   :!B}TZ'@'@BBCCC4DIIj114444r8   rx   c                H    t          | j        |          | _        | j        d u S r4   )r~   r   r   r   s     r6   r   zRaisesExc._check_type  s%    +D,DiPP D((r8   "ExceptionInfo[BaseExcT_co_default]c                @    t          j                    | _        | j        S r4   r   	for_laterrT   r   s    r6   	__enter__zRaisesExc.__enter__  s    ;H;R;T;T|r8   r   type[BaseException] | Noneexc_valexc_tbtypes.TracebackType | Noner   c                   d}|b| j         st          d           t          | j                   dk    rt          d| j                    t          d| j         d                    | j        
J d            |                     |          s| j        rdS t          | j                  t          d	|||f          }| j        	                    |           dS )
NTzDID NOT RAISE any exceptionrI   zDID NOT RAISE any of zDID NOT RAISE r   :Internal error - should have been constructed in __enter__FzJtuple[type[BaseExcT_co_default], BaseExcT_co_default, types.TracebackType])
r   r   rr   rT   r   r   AssertionErrorr   r	   fill_unfilled)r   r   r   r   rR   exc_infos         r6   __exit__zRaisesExc.__exit__  s    !+ 423334+,,q00IT-EIIJJJA$":1"=AABBB|''H ('' ||G$$ 	4# u !2333 Xw'
 
 	""8,,,tr8   )r-   r   r+   r   r,   r   r1   r   )r   r<   r+   r   r,   r   r1   r   )r,   r;   r1   r   r4   )r-   r   r+   r   r,   r   )rw   r   r1   r   r1   r^   )rw   rx   r1   r   )r1   r   r   r   r   r   r   r   r1   r   )rl   r   r   r   r   r   r   r   r   r   r   __classcell__r   s   @r6   rN   rN     sB       % %Z  ,/>A	 	 	 	 	 X	  9<     X QQQ XQ 	% ,0>B% % % % % % % %8!, !, !, !,F5 5 5 5) ) ) )   
       r8   rN   c                  2    e Zd ZdZeddd_d            Zedddd`d            Zeddddad            Zeddddbd            Zeddddcd!            Zedddddd%            Zedddded)            Zeddddfd-            Zddddd.dg fd1Zdh fd7Zedid9            Zedjd;            Zdkd=Zdld>ZdmdAZ	edndE            Z
edodG            Z
dpdHZ
edqdM            ZedrdP            ZedsdU            ZedtdV            ZdudWZdvd]Zdld^Z xZS )wRaisesGroupad  
    .. versionadded:: 8.4

    Contextmanager for checking for an expected :exc:`ExceptionGroup`.
    This works similar to :func:`pytest.raises`, but allows for specifying the structure of an :exc:`ExceptionGroup`.
    :meth:`ExceptionInfo.group_contains` also tries to handle exception groups,
    but it is very bad at checking that you *didn't* get unexpected exceptions.

    The catching behaviour differs from :ref:`except* <except_star>`, being much
    stricter about the structure by default.
    By using ``allow_unwrapped=True`` and ``flatten_subgroups=True`` you can match
    :ref:`except* <except_star>` fully when expecting a single exception.

    :param args:
        Any number of exception types, :class:`RaisesGroup` or :class:`RaisesExc`
        to specify the exceptions contained in this exception.
        All specified exceptions must be present in the raised group, *and no others*.

        If you expect a variable number of exceptions you need to use
        :func:`pytest.raises(ExceptionGroup) <pytest.raises>` and manually check
        the contained exceptions. Consider making use of :meth:`RaisesExc.matches`.

        It does not care about the order of the exceptions, so
        ``RaisesGroup(ValueError, TypeError)``
        is equivalent to
        ``RaisesGroup(TypeError, ValueError)``.
    :kwparam str | re.Pattern[str] | None match:
        If specified, a string containing a regular expression,
        or a regular expression object, that is tested against the string
        representation of the exception group and its :pep:`678` `__notes__`
        using :func:`re.search`.

        To match a literal string that may contain :ref:`special characters
        <re-syntax>`, the pattern can first be escaped with :func:`re.escape`.

        Note that " (5 subgroups)" will be stripped from the ``repr`` before matching.
    :kwparam Callable[[E], bool] check:
        If specified, a callable that will be called with the group as a parameter
        after successfully matching the expected exceptions. If it returns ``True``
        it will be considered a match, if not it will be considered a failed match.
    :kwparam bool allow_unwrapped:
        If expecting a single exception or :class:`RaisesExc` it will match even
        if the exception is not inside an exceptiongroup.

        Using this together with ``match``, ``check`` or expecting multiple exceptions
        will raise an error.
    :kwparam bool flatten_subgroups:
        "flatten" any groups inside the raised exception group, extracting all exceptions
        inside any nested groups, before matching. Without this it expects you to
        fully specify the nesting structure by passing :class:`RaisesGroup` as expected
        parameter.

    Examples::

        with RaisesGroup(ValueError):
            raise ExceptionGroup("", (ValueError(),))
        # match
        with RaisesGroup(
            ValueError,
            ValueError,
            RaisesExc(TypeError, match="^expected int$"),
            match="^my group$",
        ):
            raise ExceptionGroup(
                "my group",
                [
                    ValueError(),
                    TypeError("expected int"),
                    ValueError(),
                ],
            )
        # check
        with RaisesGroup(
            KeyboardInterrupt,
            match="^hello$",
            check=lambda x: isinstance(x.__cause__, ValueError),
        ):
            raise BaseExceptionGroup("hello", [KeyboardInterrupt()]) from ValueError
        # nested groups
        with RaisesGroup(RaisesGroup(ValueError)):
            raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),))

        # flatten_subgroups
        with RaisesGroup(ValueError, flatten_subgroups=True):
            raise ExceptionGroup("", (ExceptionGroup("", (ValueError(),)),))

        # allow_unwrapped
        with RaisesGroup(ValueError, allow_unwrapped=True):
            raise ValueError


    :meth:`RaisesGroup.matches` can also be used directly to check a standalone exception group.


    The matching algorithm is greedy, which means cases such as this may fail::

        with RaisesGroup(ValueError, RaisesExc(ValueError, match="hello")):
            raise ExceptionGroup("", (ValueError("hello"), ValueError("goodbye")))

    even though it generally does not care about the order of the exceptions in the group.
    To avoid the above you should specify the first :exc:`ValueError` with a :class:`RaisesExc` as well.

    .. note::
        When raised exceptions don't match the expected ones, you'll get a detailed error
        message explaining why. This includes ``repr(check)`` if set, which in Python can be
        overly verbose, showing memory locations etc etc.

        If installed and imported (in e.g. ``conftest.py``), the ``hypothesis`` library will
        monkeypatch this output to provide shorter & more readable repr's.
    F)flatten_subgroupsr-   *type[BaseExcT_co] | RaisesExc[BaseExcT_co]allow_unwrappedLiteral[True]r   r   r1   r   c                  d S r4   r5   )r   r-   r   r   s       r6   r   zRaisesGroup.__init__P  r   r8   Nr*   other_exceptionsr+   r   r,   8Callable[[BaseExceptionGroup[BaseExcT_co]], bool] | Nonec                  d S r4   r5   )r   r-   r   r+   r,   r  s         r6   r   zRaisesGroup.__init__[  s	     sr8   r   RaisesGroup[ExcT_1] type[ExcT_1] | RaisesExc[ExcT_1]/Callable[[ExceptionGroup[ExcT_1]], bool] | Nonec                  d S r4   r5   r   r-   r+   r,   r  s        r6   r   zRaisesGroup.__init__k  r   r8   #RaisesGroup[ExceptionGroup[ExcT_2]]RaisesGroup[ExcT_2]?Callable[[ExceptionGroup[ExceptionGroup[ExcT_2]]], bool] | Nonec                  d S r4   r5   r	  s        r6   r   zRaisesGroup.__init__u  r   r8   ,RaisesGroup[ExcT_1 | ExceptionGroup[ExcT_2]]6type[ExcT_1] | RaisesExc[ExcT_1] | RaisesGroup[ExcT_2]HCallable[[ExceptionGroup[ExcT_1 | ExceptionGroup[ExcT_2]]], bool] | Nonec                  d S r4   r5   r	  s        r6   r   zRaisesGroup.__init__  r   r8   RaisesGroup[BaseExcT_1](type[BaseExcT_1] | RaisesExc[BaseExcT_1]7Callable[[BaseExceptionGroup[BaseExcT_1]], bool] | Nonec                  d S r4   r5   r	  s        r6   r   zRaisesGroup.__init__  r   r8   +RaisesGroup[BaseExceptionGroup[BaseExcT_2]]RaisesGroup[BaseExcT_2]KCallable[[BaseExceptionGroup[BaseExceptionGroup[BaseExcT_2]]], bool] | Nonec                  d S r4   r5   r	  s        r6   r   zRaisesGroup.__init__  r   r8   8RaisesGroup[BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]]Btype[BaseExcT_1] | RaisesExc[BaseExcT_1] | RaisesGroup[BaseExcT_2]XCallable[[BaseExceptionGroup[BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]]], bool] | Nonec                  d S r4   r5   r	  s        r6   r   zRaisesGroup.__init__  s	    $ sr8   )r   r   r+   r,   ARaisesGroup[ExcT_1 | BaseExcT_1 | BaseExceptionGroup[BaseExcT_2]]bCallable[[BaseExceptionGroup[BaseExcT_1]], bool] | Callable[[ExceptionGroup[ExcT_1]], bool] | Nonec              ~    t          d|          }t                                          ||           | _        | _        d _        |r|rt          d          |r$t          |t                    rt          d          |r||t          d          t           fd|g|R D                        _
        d S )NzVCallable[[BaseExceptionGroup[ExcT_1|BaseExcT_1|BaseExceptionGroup[BaseExcT_2]]], bool]r*   FzYou cannot specify multiple exceptions with `allow_unwrapped=True.` If you want to match one of multiple possible exceptions you should use a `RaisesExc`. E.g. `RaisesExc(check=lambda e: isinstance(e, (...)))`z`allow_unwrapped=True` has no effect when expecting a `RaisesGroup`. You might want it in the expected `RaisesGroup`, or `flatten_subgroups=True` if you don't care about the structure.ax  `allow_unwrapped=True` bypasses the `match` and `check` parameters if the exception is unwrapped. If you intended to match/check the exception you should use a `RaisesExc` object. If you want to match/check the exceptiongroup when the exception *is* wrapped you need to do e.g. `if isinstance(exc.value, ExceptionGroup): assert RaisesGroup(...).matches(exc.value)` afterwards.c              3  D   K   | ]}                     |d           V  dS )z/a BaseException type, RaisesExc, or RaisesGroupN)_parse_excgroupr   s     r6   ro   z'RaisesGroup.__init__.<locals>.<genexpr>  sH       
 
   $UVV
 
 
 
 
 
r8   )r	   r   r   r   r   r   rO   rq   r   r   r   )r   r-   r   r   r+   r,   r  r   s   `      r6   r   zRaisesGroup.__init__  s1   * d
 
 	uE222.'8 % 	/ 	J    	z*<kJJ 	S  
  	 1U5FK    
 
 
 
 #! 
 
 
 
 
 	   r8   r   Xtype[BaseExcT_co] | types.GenericAlias | RaisesExc[BaseExcT_1] | RaisesGroup[BaseExcT_2]r   r^   Ctype[BaseExcT_co] | RaisesExc[BaseExcT_1] | RaisesGroup[BaseExcT_2]c                   t          |t                    r4| j        rt          d          | xj        |j        z  c_        d|_        |S t          |t                    r| xj        |j        z  c_        d|_        |S t          |t                    r(t          d| dt          |          j
        d          t                                          ||          S )NzYou cannot specify a nested structure inside a RaisesGroup with `flatten_subgroups=True`. The parameter will flatten subgroups in the raised exceptiongroup before matching, which would never match a nested structure.Tr   r   z.
RaisesGroup does not support tuples of exception types when expecting one of several possible exception types like RaisesExc.
If you meant to expect a group with multiple exceptions, list them as separate arguments.)rq   r   r   rO   r   r   rN   r   rM   rQ   rl   r   r   )r   r   r   r   s      r6   r"  zRaisesGroup._parse_excgroup  s    c;'' 	5%  1   !!S%99!!CKJY'' 	5!!S%99!!CKJU## 	5lh l ld3ii>P l l l   77%%c8444r8   %ExceptionInfo[ExceptionGroup[ExcT_1]]c                    d S r4   r5   r   s    r6   r   zRaisesGroup.__enter__  s	     14r8   -ExceptionInfo[BaseExceptionGroup[BaseExcT_1]]c                    d S r4   r5   r   s    r6   r   zRaisesGroup.__enter__  s	     9<r8   0ExceptionInfo[BaseExceptionGroup[BaseException]]c                @    t          j                    | _        | j        S r4   r   r   s    r6   r   zRaisesGroup.__enter__"  s    #%% 	 |r8   c                   d | j         D             }| j        r|                    d| j                    | j        r|                    d| j                    | j        *|                    dt          | j                             | j        *|                    dt          | j                              dd                    |           dS )	Nc                d    g | ]-}t          |t                    r|j        nt          |          .S r5   )rq   rQ   rl   r`   rm   rg   s     r6   
<listcomp>z(RaisesGroup.__repr__.<locals>.<listcomp>)  sC     
 
 
 %Q--:AJJ477
 
 
r8   zallow_unwrapped=zflatten_subgroups=r   r   zRaisesGroup(rH   rp   )	r   r   r   r   r+   r[   r,   ra   rK   )r   reqss     r6   r   zRaisesGroup.__repr__(  s    
 
-
 
 
  	CKKA4+?AABBB! 	GKKET-CEEFFF:!KK?
!;!;??@@@:!KK<tz!:!:<<===0diioo0000r8   
exceptionsSequence[BaseException]c                    g }|D ]Z}t          |t                    r.|                    |                     |j                             E|                    |           [|S )z!Used if `flatten_subgroups=True`.)rq   r'   extend_unroll_exceptionsr1  r   )r   r1  resr   s       r6   r5  zRaisesGroup._unroll_exceptions8  sh    
 $& 	  	 C#122  

4223>BBCCCC 

3
r8   rw   r   !TypeGuard[ExceptionGroup[ExcT_1]]c                    d S r4   r5   r   s     r6   r   zRaisesGroup.matchesF  s	     -0Cr8   )TypeGuard[BaseExceptionGroup[BaseExcT_1]]c                    d S r4   r5   r   s     r6   r   zRaisesGroup.matchesK  s	     58Cr8   c           
     x   d| _         |	d| _         dS t          |t                    sdt          |          j         d}t          | j                  dk    r	|| _         dS |                     | j        d         |          }|	| j        rdS || d	| _         n| j        r|| _         n|| _         dS |j	        }| j
        r|                     |          }|                     |          st          t          | j                   | _         | j         }t          |          t          | j                  cxk    rdk    rn nt          | j        d         x}t                    rt          |d         x}|          r{|                     |          rf| j        
J d
            | j         |cxu rn J | xj         d|                     |           d|j         dt#          | j                  dz  c_         n|| _         dS |                     ||          st          t          | j                   | _         | j         J | j         }| j
        st'          d | j        D                       sct'          d |D                       rJ|                     ||                     |j	                            rd| j         vrdnd}|d| dz   | _         n|| _         dS |                     |          st          t          | j                   dt          |          j         z   }	t          |          t          | j                  cxk    rdk    rjn ngt          | j        d         x}t                    rE|                     |d                   r*|	d|                     |           d|j         dz   | _         n|	| _         dS dS )a0  Check if an exception matches the requirements of this RaisesGroup.
        If it fails, `RaisesGroup.fail_reason` will be set.

        Example::

            with pytest.raises(TypeError) as excinfo:
                ...
            assert RaisesGroup(ValueError).matches(excinfo.value.__cause__)
            # the above line is equivalent to
            myexc = excinfo.value.__cause
            assert isinstance(myexc, BaseExceptionGroup)
            assert len(myexc.exceptions) == 1
            assert isinstance(myexc.exceptions[0], ValueError)
        Nr   Frd   z()` is not an exception grouprI   r   Tz-, but would match with `allow_unwrapped=True`z$can't be None if _check_match failedz
 but matched the expected `z*`.
 You might want `RaisesGroup(RaisesExc(z, match=z))`c              3  @   K   | ]}t          |t                    V  d S r4   )rq   r   r.  s     r6   ro   z&RaisesGroup.matches.<locals>.<genexpr>  s=        34Jq+..     r8   c              3  @   K   | ]}t          |t                    V  d S r4   )rq   r'   r.  s     r6   ro   z&RaisesGroup.matches.<locals>.<genexpr>  s-      UUa
1&899UUUUUUr8   r     r)   z-Did you mean to use `flatten_subgroups=True`?z on the z', but did return True for the expected z'. You might want RaisesGroup(RaisesExc(z, check=<...>)))r   rq   r'   rQ   rl   rr   r   _check_expectedr   r1  r   r5  r   r	   r^   r+   _repr_expectedr[   _check_exceptionsr   r   )
r   rw   not_group_msgr6  actual_exceptions
old_reasonr   actualr   reasons
             r6   r   zRaisesGroup.matchesQ  s   $ ! 3D5)%788 	 XY 8WWWM4+,,q00$1!u &&t'?'BINNC{t3{t{$SSS !! % 2$'!!$1!55>5I! 	K $ 7 78I J J  ++ 	 $S$*; < <D*J%&&#d.F*G*GLLLL1LLLLL4+CA+FFxMM M):1)==vxHH M %%f-- M
 z--/U---(JBBBBBBBBB!!k262E2Eh2O2Ok k /7.?k k JXX\XbIcIck k k!!! %/!5 %%
 
 	 !%S$*; < <D$000*J */  8<8P    /
 UUCTUUUUU/ **++I,@AA / "&T->!>!>BP6PPPQ !!
 %/!5   ++ 	S$+,,/T$y//:R/T/TT  %&&#d.F*G*GLLLL1LLLLL4+CA+FFxMM M %%&7&:;; M
 %+`d>Q>QRZ>[>[ ` `=E=N` ` `%!!
 %+!5tr8   ru   Ktype[BaseException] | RaisesExc[BaseException] | RaisesGroup[BaseException]rx   ry   c                   t          | t                    rt          | |          S |                     |          }|rdS | j        J | j                            d          rd| dt          | j        d           S | d| j         S )zHelper method for `RaisesGroup.matches` and `RaisesGroup._check_exceptions`
        to check one of potentially several expected exceptions.Nr   z: r>  )rq   rQ   r~   r   r   
startswithr   )ru   rw   r6  s      r6   r?  zRaisesGroup._check_expected  s     mT** 	="=)<<<##I.. 	4(444$//55 	UTTT6-2KT+R+RTTT@@]%>@@@r8   rg   3type[BaseException] | AbstractRaises[BaseException]c                h    t          | t                    rt          |           S t          |           S )zhGet the repr of an expected type/RaisesExc/RaisesGroup, but we only want
        the name if it's a type)rq   rQ   rt   r`   rs   s    r6   r@  zRaisesGroup._repr_expected  s/     a 	+'***Awwr8   
_exceptionr   rC  Sequence[Exception]c                    d S r4   r5   r   rL  rC  s      r6   rA  zRaisesGroup._check_exceptions  s	    
 -0Cr8   c                    d S r4   r5   rO  s      r6   rA  zRaisesGroup._check_exceptions  s	    
 58Cr8   c                V	    t           j                  }t          t          t	                                        }g }i }t           j                  D ]p\  }}|D ]S}	                     ||	                   }
|                    ||	|
           |
|                    |	           |	||<    nT|	                    |           q|s|sdS dt	                    cxk    rt	           j                  k    rn n|rJ |
 _
        dS t           j                  D ]\\  }}t                    D ]G\  }}|                    ||          r|                    ||                     ||                     H]|r*t	          |           dt	          |          dk    rdnd dnd}|s/|                    |          r| d	fd
|D              _
        dS |sE|                    |          r0d                     fd|D                       }| d| d _
        dS dt	          |          cxk    rt	          |          k    rZn nW|                    |          rB|                    |          r-| |                    |d         |d                     _
        dS d}|r|d| z  }d}d}|s|dz  }n|s|dz  }|r#|dz  }d |                                D             }|D ]}|d|                       j        |                    z  }t                    D ]u\  }}|                    ||          Z|d| dt%          t'          |                     dt%                                j        ||                                      z   z  }v|r|dz  }|D ]}|d| |         dz  }t           j                  D ]\  }}|                    ||          }
||v r(|
J |
d         dk    r|dz  }|t)          |
|          z  }|
T|d| dt%                               |                     dt%          t'          ||                                       z  }t	           j                  t	                    k    rt+          |          r|dz  }| _
        dS )z]Helper method for RaisesGroup.matches that attempts to pair up expected and actual exceptionsNTrI   Fz matched exceptionrb   r)   z. zUnexpected exception(s): c                     g | ]
}|         S r5   r5   )rm   r   rC  s     r6   r/  z1RaisesGroup._check_exceptions.<locals>.<listcomp>0  s    DDDa&q)DDDr8   rH   c              3  X   K   | ]$}                     j        |                   V  %d S r4   )r@  r   )rm   r   r   s     r6   ro   z0RaisesGroup._check_exceptions.<locals>.<genexpr>5  sM       ) ) ##D$<Q$?@@) ) ) ) ) )r8   z0Too few exceptions raised, found no match for: []r   r   r>  z    z
Too few exceptions raised!z
Unexpected exception(s)!z8
The following expected exceptions did not find a match:c                    i | ]\  }}||	S r5   r5   )rm   kvs      r6   
<dictcomp>z1RaisesGroup._check_exceptions.<locals>.<dictcomp>T  s    <<<DAq1a<<<r8   zIt matches z which was paired with z5
The following raised exceptions did not find a match:z
There exist a possible match when attempting an exhaustive check, but RaisesGroup uses a greedy algorithm. Please make your expected exceptions more stringent with `RaisesExc` etc so the greedy algorithm can function.)ResultHolderr   listrangerr   r   r?  
set_resultremover   r   
has_resultno_match_for_actualno_match_for_expectedrK   
get_resultitemsr@  rf   r`   r   possible_match)r   rL  rC  resultsremaining_actualfailed_expectedr   i_expr   i_remr6  i_actualrE  successful_strno_match_for_strrb   indent_1indent_2rev_matchesi_faileds   ` `                 r6   rA  zRaisesGroup._check_exceptions  s{    t79JKK  c*;&<&< = =>>%'"$  ))ABB 		. 		.OE8) . .**85Fu5MNN""5%555;$++E222%*GENE 
  &&u---   	 	4 %&&GGGG#d.F*G*GGGGGG #D5  ))ABB 	 	OE8$-.?$@$@   &%%eX66 ""8T%9%9(F%K%K    s7||RRc'llQ6F6FssBRRRR 	  	7#>#>?O#P#P 	! I IDDDD3CDDDI I  5 	G$A$A/$R$R 	#yy ) ) ) )() ) )     $2 v vcs v v vD5
 %&&>>>>#o*>*>>>>>>++,<== ?--o>> ? $2 p73E3EoVWFXZjklZm3n3n p pD5  	'&n&&&A 	.//AA  	.--A 	=LLA<<GMMOO<<<K' 	 	HXXXt2243KH3UVVXXA %..?$@$@ 
 
 &%%eX66>bXbb)DLL2I2Ibbb# // $ 8X9N O  A
  	JIIA( 	 	H@h@ 1( ;@@@@A#,T-E#F#F  x((99O++???1v~~T	X...A;fX f f)D<O<OPX<Y<Y2Z2Z f f1:4@QRYZ_R`@a;b;b1c1cf fA t'((C0A,B,BBB~H
 H
B 9A ur8   r   r   r   r   r   c                r   d}|%t          d|                                  d           | j        
J d            | j        rt	          |t
                    sdnd}|                     |          st          d| d| j                    t          d	|||f          }| j        	                    |           dS )
NTz'DID NOT RAISE any exception, expected `rd   r   z(group)groupzRaised exception z did not match: zbtuple[type[BaseExceptionGroup[BaseExcT_co]], BaseExceptionGroup[BaseExcT_co], types.TracebackType])
r   ru   rT   r   r{   r'   r   r   r	   r   )r   r   r   r   rR   	group_strr   s          r6   r   zRaisesGroup.__exit__  s     !R4;M;M;O;ORRRSSS|''H ('' #,6xAS,T,TII 	 ||G$$ 	USYSS@QSSTTT pw'
 
 	""8,,,tr8   c                   g }| j         D ]}t          |t                    r#|                    t	          |                     :t          |t
                    r(|                    |                                           wt          |t                    r|                    |j                   t          d          | j
        rdnd}| dd                    |           dS )Nzunknown typeBaser)   zExceptionGroup(rH   rp   )r   rq   rN   r   r`   r   ru   rQ   rl   r   r   rK   )r   subexcsrg   
group_types       r6   ru   zRaisesGroup.expected_type  s    ) 	5 	5A!Y'' 5tAww''''A{++ 5q001111At$$ 5qz****$^444#4<VV"
BBTYYw-?-?BBBBr8   )r-   r   r   r   r   r   r1   r   )r-   r   r  r   r   r   r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r+   r   r,   r  r1   r   )r   r
  r-   r  r  r  r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r+   r   r,   r  r1   r   )r   r  r-   r  r  r  r   r   r   r   r+   r   r,   r  )r   r#  r   r^   r1   r$  )r   r  r1   r&  )r   r  r1   r(  )r1   r*  r   )r1  r2  r1   r2  )r   r  rw   r   r1   r7  )r   r  rw   r   r1   r9  )rw   r   r1   r   )ru   rG  rw   rx   r1   ry   )rg   rJ  r1   r^   )r   r  rL  r   rC  rM  r1   r7  )r   r  rL  rx   rC  r2  r1   r9  )rL  rx   rC  r2  r1   r   r   )rl   r   r   r   r   r   r"  r   r   r5  r   staticmethodr?  r@  rA  r   ru   r   r   s   @r6   r   r     s       m mb  #(     X  ,0JN     X  ,0AE     X  ,0QU     X  ,0 	 	 	 	 	 X	  ,0IM     X  ,0 	 	 	 	 	 X	  ,0 !     X8 !&"'+/
 !=
 =
 =
 =
 =
 =
 =
 =
~"5 "5 "5 "5 "5 "5H 4 4 4 X4 < < < X<   1 1 1 1     0 0 0 X0 8 8 8 X8
y y y yv A A A \A$    \ 0 0 0 X0
 8 8 8 X8M M M M^       DC C C C C C C Cr8   r   c                      e Zd ZdZdS )
NotCheckedz.Singleton for unchecked values in ResultHolderN)rl   r   r   r   r5   r8   r6   rz  rz    s        8888r8   rz  c                  B    e Zd ZdZddZddZddZddZddZddZ	dS )rZ  zpContainer for results of checking exceptions.
    Used in RaisesGroup._check_exceptions and possible_match.
    r   ?tuple[type[BaseException] | AbstractRaises[BaseException], ...]rC  r2  r1   r   c                .    fd|D             | _         d S )Nc                (    g | ]}d  D             S )c                    g | ]	}t           
S r5   )rz  )rm   _s     r6   r/  z4ResultHolder.__init__.<locals>.<listcomp>.<listcomp>  s    555AZ555r8   r5   )rm   r  r   s     r6   r/  z)ResultHolder.__init__.<locals>.<listcomp>  s<     C
 C
 C
:;55!4555C
 C
 C
r8   re  )r   r   rC  s    ` r6   r   zResultHolder.__init__  s8    C
 C
 C
 C
?PC
 C
 C
r8   r   intrE  resultry   c                &    || j         |         |<   d S r4   r  )r   r   rE  r  s       r6   r]  zResultHolder.set_result  s    )/VX&&&r8   c                B    | j         |         |         }|t          usJ |S r4   re  rz  )r   r   rE  r6  s       r6   rb  zResultHolder.get_result  s)    l6"8,*$$$$
r8   r   c                6    | j         |         |         t          uS r4   r  )r   r   rE  s      r6   r_  zResultHolder.has_result  s    |F#H-Z??r8   	list[int]c                ^    |D ])}| j         D ]}||         t          usJ ||           dS  *dS NFTr  )r   r   r   actual_resultss       r6   ra  z"ResultHolder.no_match_for_expected  s]     	! 	!A"&, ! !%a(
::::!!$, 555 -! tr8   c                R    |D ]#}| j         |         D ]}|t          usJ |  dS $dS r  r  )r   rE  r   r6  s       r6   r`  z ResultHolder.no_match_for_actual  sV     	! 	!A|A ! !*,,,,; 555 ! tr8   N)r   r|  rC  r2  r1   r   )r   r  rE  r  r  ry   r1   r   )r   r  rE  r  r1   ry   )r   r  rE  r  r1   r   )r   r  r1   r   )rE  r  r1   r   )
rl   r   r   r   r   r]  rb  r_  ra  r`  r5   r8   r6   rZ  rZ    s         	
 	
 	
 	
0 0 0 0   @ @ @ @        r8   rZ  re  usedset[int] | Nonec                     t                      t                    }|t           j                  k    rdS t           fdt	           j        |                   D                       S )NTc              3  V   K   | ]#\  }}|d u o|vot          |hz            V  $d S r4   )rd  )rm   r   valre  r  s      r6   ro   z!possible_match.<locals>.<genexpr>  s]        Q 	tMM.$!**M*M     r8   )rJ   rr   re  r   r   )re  r  curr_rows   `` r6   rd  rd    s    |uu4yyH3w''''t     !'/(";<<     r8   )r-   r.   r+   r/   r,   r0   r1   r2   )r+   r:   r,   r;   r1   r<   )r,   r;   r1   r<   )
r-   r.   r?   r@   rA   r   rB   r   r1   rC   r4   )r-   rE   rA   r   rB   r   r1   rF   )r+   rU   r1   rV   )r\   r]   r1   r^   )rb   r^   r1   r^   )rg   rh   r1   r^   )ru   rv   rw   rx   r1   ry   )rb   r^   r1   r   )re  rZ  r  r  r1   r   )D
__future__r   abcr   r   r   r   systextwrapr   typingr   r	   r
   r   r   r   r   r   r   r   _pytest._coder   _pytest._code.coder   _pytest.outcomesr   _pytest.warning_typesr   collections.abcr   r   typestyping_extensionsr   r   r   r   rx   r   r   r    r!   r"   r   r#   r$   version_infoexceptiongroupr'   r(   r   rX   rY   r7   r[   ra   rf   rt   r~   r   r   r   rN   r   rz  rZ  rd  r5   r8   r6   <module>r     s   " " " " " "             				       



                                                                    ' ' ' ' ' ' 2 2 2 2 2 2 ! ! ! ! ! ! / / / / / /  (((((((((((( LLL++++++++++++))))))	#A "'	   	=-@@@AA!']d  
 gm=DIIIW\777
W\777
		+	+	+		+	+	+g111111------ "*S//' 
 +.!$	     
 

 .1	# # # # # 
# 
 V V V 
 V 
   
 @DD D D D D^ > F F F F
      : : : :   .   : : : :] ] ] ] ]S'+. ] ] ]@ { { { { {23 { { {| SC SC SC SC SC.!3K!@A SC SC SCl 9 9 9 9 9 9 9 9* * * * * * * *Z	 	 	 	 	 	 	r8   