ó
    EñiJ4  ã                  ó&  • S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	r	SSK
Jr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \(       a  SSKJr  SSKrSSKJr  SSKJr  SSKJr  SSKJr  \" S5      r\S!S j5       r\SS.   S"S jj5       r\S#S j5       r S$       S%S jjr\ S&SS.     S'S jjj5       r\          S(S j5       r\ 4SS.         S)S jjjr " S S\RB                  5      r"\ " S  S\"5      5       r#g)*z/Record warnings during test function execution.é    )Úannotations)ÚCallable)Ú	Generator)ÚIterator)ÚpformatN)ÚTracebackType)ÚAny)Úfinal)Úoverload)ÚTYPE_CHECKING)ÚTypeVar)ÚSelf)Úcheck_ispytest)Úfixture)ÚExit)ÚfailÚTc               #  óŠ   #   • [        SS9n U    [        R                  " S5        U v •  SSS5        g! , (       d  f       g= f7f)z�Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.

See :ref:`warnings` for information on warning categories.
T©Ú	_ispytestÚdefaultN)ÚWarningsRecorderÚwarningsÚsimplefilter)Úwrecs    ÚL/home/mande/repo/quber/.venv/lib/python3.13/site-packages/_pytest/recwarn.pyÚrecwarnr   !   s0   é € ô  dÑ+€DÚ	Ü×Ò˜iÔ(ØŠ
÷ 
�Žüs   ‚AŽ2©	A²
A ¼A.©Úmatchr   c                ó   • g ©N© r   s    r   Údeprecated_callr#   -   s   € ð ó    c                ó   • g r!   r"   )ÚfuncÚargsÚkwargss      r   r#   r#   3   s   € ØMPr$   c                óT   • SnU b  U /UQ7n[        [        [        [        4/UQ70 UD6$ )ae  Assert that code produces a ``DeprecationWarning`` or ``PendingDeprecationWarning`` or ``FutureWarning``.

This function can be used as a context manager::

    >>> import warnings
    >>> def api_call_v2():
    ...     warnings.warn('use v3 of this api', DeprecationWarning)
    ...     return 200

    >>> import pytest
    >>> with pytest.deprecated_call():
    ...    assert api_call_v2() == 200

It can also be used by passing a function and ``*args`` and ``**kwargs``,
in which case it will ensure calling ``func(*args, **kwargs)`` produces one of
the warnings types above. The return value is the return value of the function.

In the context manager form you may use the keyword argument ``match`` to assert
that the warning matches a text or regex.

The context manager produces a list of :class:`warnings.WarningMessage` objects,
one for each warning raised.
T)ÚwarnsÚDeprecationWarningÚPendingDeprecationWarningÚFutureWarning)r&   r'   r(   Ú__tracebackhide__s       r   r#   r#   7   sC   € ð4 ÐØÑØˆ}�t‰}ˆÜÜ	Ô6¼ÐFðØIMòØQWñð r$   ÚWarningsCheckerc               ó   • g r!   r"   )Úexpected_warningr   s     r   r*   r*   Y   s   € ð
 r$   c                ó   • g r!   r"   )r1   r&   r'   r(   s       r   r*   r*   a   s   € ð 	r$   c               óH  • SnU(       d:  U(       a)  SR                  [        U5      5      n[        SU S35      e[        XSS9$ US   n[	        U5      (       d  [        U< S[        U5       S35      e[        U SS	9   U" US
S 0 UD6sSSS5        $ ! , (       d  f       g= f)a–  Assert that code raises a particular class of warning.

Specifically, the parameter ``expected_warning`` can be a warning class or tuple
of warning classes, and the code inside the ``with`` block must issue at least one
warning of that class or classes.

This helper produces a list of :class:`warnings.WarningMessage` objects, one for
each warning emitted (regardless of whether it is an ``expected_warning`` or not).
Since pytest 8.0, unmatched warnings are also re-emitted when the context closes.

This function can be used as a context manager::

    >>> import pytest
    >>> with pytest.warns(RuntimeWarning):
    ...    warnings.warn("my warning", RuntimeWarning)

In the context manager form you may use the keyword argument ``match`` to assert
that the warning matches a text or regex::

    >>> with pytest.warns(UserWarning, match='must be 0 or None'):
    ...     warnings.warn("value must be 0 or None", UserWarning)

    >>> with pytest.warns(UserWarning, match=r'must be \d+$'):
    ...     warnings.warn("value must be 42", UserWarning)

    >>> with pytest.warns(UserWarning):  # catch re-emitted warning
    ...     with pytest.warns(UserWarning, match=r'must be \d+$'):
    ...         warnings.warn("this is not here", UserWarning)
    Traceback (most recent call last):
      ...
    Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted...

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

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

This could be achieved in the same way as with exceptions, see
:ref:`parametrizing_conditional_raising` for an example.

Tz, z5Unexpected keyword arguments passed to pytest.warns: z"
Use context-manager form instead?)Ú
match_exprr   r   z object (type: z) must be callabler   é   N)ÚjoinÚsortedÚ	TypeErrorr/   ÚcallableÚtype)r1   r   r'   r(   r.   Úargnamesr&   s          r   r*   r*   j   s¨   € ð^ ÐÞÞØ—y‘y¤¨£Ó0ˆHÜØGÈÀzØ5ð6óð ô Ð/ÈTÑRÐRà�A‰wˆÜ˜�~‰~Ü˜t™h o´d¸4³j°\ÐASÐTÓUÐUÜÐ-¸Ó>Ù˜˜a˜b˜Ð, VÑ,÷ ?×>×>ús   Á>BÂ
B!c                  ó´   ^ • \ rS rSrSrSS.SU 4S jjjr\SS j5       rSS jrSS jr	SS	 jr
\4SS
 jjrSS jrSU 4S jjr        SU 4S jjrSrU =r$ )r   éª   a.  A context manager to record raised warnings.

Each recorded warning is an instance of :class:`warnings.WarningMessage`.

Adapted from `warnings.catch_warnings`.

.. note::
    ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated
    differently; see :ref:`ensuring_function_triggers`.

Fr   c               óR   >• [        U5        [        TU ]	  SS9  SU l        / U l        g )NT)ÚrecordF)r   ÚsuperÚ__init__Ú_enteredÚ_list)Úselfr   Ú	__class__s     €r   rA   ÚWarningsRecorder.__init__·   s)   ø€ Ü�yÔ!Ü‰Ñ ÐÑ%ØˆŒØ46ˆ�
r$   c                ó   • U R                   $ )zThe list of recorded warnings.©rC   ©rD   s    r   ÚlistÚWarningsRecorder.list½   s   € ð �z‰zÐr$   c                ó    • U R                   U   $ )z Get a recorded warning by index.rH   )rD   Úis     r   Ú__getitem__ÚWarningsRecorder.__getitem__Â   s   € à�z‰z˜!‰}Ðr$   c                ó,   • [        U R                  5      $ )z&Iterate through the recorded warnings.)ÚiterrC   rI   s    r   Ú__iter__ÚWarningsRecorder.__iter__Æ   s   € ä�D—J‘JÓÐr$   c                ó,   • [        U R                  5      $ )z The number of recorded warnings.)ÚlenrC   rI   s    r   Ú__len__ÚWarningsRecorder.__len__Ê   s   € ä�4—:‘:‹Ðr$   c                ó¦  • Sn[        U R                  5       Hˆ  u  p4UR                  U:X  a  U R                  R                  U5      s  $ [	        UR                  U5      (       d  MO  Ub4  [	        UR                  U R                  U   R                  5      (       a  M†  UnMŠ     Ub  U R                  R                  U5      $ Sn[        U< S35      e)z©Pop the first recorded warning which is an instance of ``cls``,
but not an instance of a child class of any other match.
Raises ``AssertionError`` if there is no match.
NTz not found in warning list)Ú	enumeraterC   ÚcategoryÚpopÚ
issubclassÚAssertionError)rD   ÚclsÚbest_idxrM   Úwr.   s         r   r[   ÚWarningsRecorder.popÎ   s­   € ð
  $ˆÜ˜dŸj™jÖ)‰DˆAØ�z‰z˜SÓ Ø—z‘z—~‘~ aÓ(Ò(Ü˜!Ÿ*™* c×*Ó*ØÑ Ü! !§*¡*¨d¯j©j¸Ñ.B×.KÑ.K×LÓLà’ñ *ð ÑØ—:‘:—>‘> (Ó+Ð+Ø ÐÜ ™wÐ&@ÐAÓBÐBr$   c                ó"   • / U R                   SS& g)z$Clear the list of recorded warnings.NrH   rI   s    r   ÚclearÚWarningsRecorder.cleará   s   € àˆ�
‰
‘1‰r$   c                ó¬   >• U R                   (       a  Sn[        SU < S35      e[        TU ]  5       nUc   eX l        [
        R                  " S5        U $ )NTzCannot enter z twiceÚalways)rB   ÚRuntimeErrorr@   Ú	__enter__rC   r   r   )rD   r.   rC   rE   s      €r   rh   ÚWarningsRecorder.__enter__ç   sU   ø€ Ø�=�=Ø $ÐÜ ¨t©h°fÐ=Ó>Ð>Ü‘Ñ!Ó#ˆàÑ Ð Ð ØŒ
Ü×Ò˜hÔ'Øˆr$   c                óz   >• U R                   (       d  Sn[        SU < S35      e[        TU ]  XU5        SU l         g )NTzCannot exit z without entering firstF)rB   rg   r@   Ú__exit__)rD   Úexc_typeÚexc_valÚexc_tbr.   rE   s        €r   rk   ÚWarningsRecorder.__exit__ò   s?   ø€ ð �}�}Ø $ÐÜ ¨d©XÐ5LÐMÓNÐNä‰Ñ˜¨FÔ3ð ˆ�r$   )rB   rC   )r   ÚboolÚreturnÚNone)rq   zlist[warnings.WarningMessage])rM   Úintrq   úwarnings.WarningMessage)rq   z!Iterator[warnings.WarningMessage])rq   rs   )r^   ztype[Warning]rq   rt   )rq   rr   )rq   r   ©rl   ztype[BaseException] | Nonerm   zBaseException | Nonern   zTracebackType | Nonerq   rr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rA   ÚpropertyrJ   rN   rR   rV   ÚWarningr[   rc   rh   rk   Ú__static_attributes__Ú__classcell__©rE   s   @r   r   r   ª   s   ø† ñ
ð -2÷ 7ò 7ð óó ðôô ôð (/ö Cô&÷	ðà,ðð &ðð %ð	ð
 
÷õ r$   c                  ót   ^ • \ rS rSr\S4SS.       S	U 4S jjjjrS
S jr        SU 4S jjrSrU =r	$ )r/   i  NFr   c               óv  >• [        U5        [        TU ]	  SS9  Sn[        U[        5      (       a8  U H/  n[        U[        5      (       a  M  [        U[        U5      -  5      e   UnOE[        U[        5      (       a  [        U[        5      (       a  U4nO[        U[        U5      -  5      eX`l	        X l
        g )NTr   z/exceptions must be derived from Warning, not %s)r   r@   rA   Ú
isinstanceÚtupler\   r|   r8   r:   r1   r4   )rD   r1   r4   r   ÚmsgÚexcÚexpected_warning_tuprE   s          €r   rA   ÚWarningsChecker.__init__  s­   ø€ ô 	�yÔ!Ü‰Ñ 4ÐÑ(à?ˆÜÐ&¬×.Ñ.Û'�Ü! #¤w×/Ó/Ü# C¬$¨s«)¡OÓ4Ð4ñ (ð $4Ñ ÜÐ(¬$×/Ñ/´JØœg÷5
ñ 5
ð %5Ð#6Ñ ä˜C¤$Ð'7Ó"8Ñ8Ó9Ð9à 4ÔØ$�r$   c                ó  • U R                   c   e[        UR                  U R                   5      =(       aR    [        U R                  S L =(       d4    [
        R                  " U R                  [        UR                  5      5      5      $ r!   )	r1   r\   rZ   rp   r4   ÚreÚsearchÚstrÚmessage)rD   Úwarnings     r   ÚmatchesÚWarningsChecker.matches  se   € Ø×$Ñ$Ñ0Ð0Ð0Ü˜'×*Ñ*¨D×,AÑ,AÓB÷ 
ÄtØ�O‰O˜tÐ#×W¤r§y¢y°·±Ä#ÀgÇoÁoÓBVÓ'WóH
ð 	
r$   c                óä  >^ • [         TT ]  XU5        SnUb+  [        U[        5      (       a  [        U[        5      (       a  g SU 4S jjn [        U 4S jT  5       5      (       d"  [        ST R                   SU" 5        S35        OH[        U 4S jT  5       5      (       d.  [        ST R                   ST R                   S	U" 5        S35        T  Hp  nT R                  U5      (       a  M  [        R                  " UR                  UR                  UR                  UR                  UR                   UR"                  S
9  Mr     T  H’  n[%        UR                  5      [&        La  M!  UR                  R(                  (       d  M>  UR                  R(                  S   n[        U[*        5      (       a  Mn  [-        SU< S[%        U5      R.                   S35      e   g ! T  Hp  nT R                  U5      (       a  M  [        R                  " UR                  UR                  UR                  UR                  UR                   UR"                  S
9  Mr     T  H’  n[%        UR                  5      [&        La  M!  UR                  R(                  (       d  M>  UR                  R(                  S   n[        U[*        5      (       a  Mn  [-        SU< S[%        U5      R.                   S35      e   f = f)NTc                 óV   >• [        T V s/ s H  o R                  PM     sn SS9$ s  sn f )Né   )Úindent)r   rŒ   )r?   rD   s    €r   Ú	found_strÚ+WarningsChecker.__exit__.<locals>.found_str:  s$   ø€ Ü¹Ó>º¨vŸNœN¹Ñ>ÀqÑIÐIùÒ>s   ‹&c              3  ód   >#   • U  H%  n[        UR                  TR                  5      v •  M'     g 7fr!   )r\   rZ   r1   ©Ú.0r`   rD   s     €r   Ú	<genexpr>Ú+WarningsChecker.__exit__.<locals>.<genexpr>>  s%   øé € ÐSÊdÈ”z !§*¡*¨d×.CÑ.C×DÐDÊdùs   ƒ-0z"DID NOT WARN. No warnings of type z" were emitted.
 Emitted warnings: Ú.c              3  óF   >#   • U  H  nTR                  U5      v •  M     g 7fr!   )rŽ   r—   s     €r   r™   rš   C  s   øé € Ð7²$¨Q˜Ÿ™ aŸ˜²$ùs   ƒ!z* matching the regex were emitted.
 Regex: z
 Emitted warnings: )rŒ   rZ   ÚfilenameÚlinenoÚmoduleÚsourcer   z$Warning must be str or Warning, got z (type Ú))rq   r‹   )r@   rk   r‚   Ú	Exceptionr   Úanyr   r1   r4   rŽ   r   Úwarn_explicitrŒ   rZ   r�   rž   rw   r    r:   ÚUserWarningr'   r‹   r8   rv   )	rD   rl   rm   rn   r.   r”   r`   r„   rE   s	   `       €r   rk   ÚWarningsChecker.__exit__%  sq  ù€ ô 	‰Ñ˜¨FÔ3à Ðð ÑÜ˜7¤I×.Ñ.ä˜'¤4×(Ñ(à÷	Jð2	ÜÔSÉdÓS×SÑSÜØ8¸×9NÑ9NÐ8Oð P*Ù*3«+¨°að9õô Ô7±$Ó7×7Ñ7ÜØ8¸×9NÑ9NÐ8Oð PØ#Ÿ™Ð/ð 0*Ù*3«+¨°að9ôó �Ø—|‘| A—“Ü×*Ò*Ø !§	¡	Ø!"§¡Ø!"§¡Ø Ÿx™xØ Ÿ|™|Ø Ÿx™xôñ ó& �Ü˜Ÿ	™	“?¬+Ò5ñ Ø—y‘y—~—~áØ—i‘i—n‘n QÑ'�Ü˜c¤3×'Ñ'Ùô  Ø:¸3¹'ÀÌÈcË×I[ÑI[ÐH\Ð\]Ð^óð ò øó' �Ø—|‘| A—“Ü×*Ò*Ø !§	¡	Ø!"§¡Ø!"§¡Ø Ÿx™xØ Ÿ|™|Ø Ÿx™xôñ ó& �Ü˜Ÿ	™	“?¬+Ò5ñ Ø—y‘y—~—~áØ—i‘i—n‘n QÑ'�Ü˜c¤3×'Ñ'Ùô  Ø:¸3¹'ÀÌÈcË×I[ÑI[ÐH\Ð\]Ð^óð ò ús   ÁBG ÇK/Ç=C2K/)r1   r4   )r1   ú)type[Warning] | tuple[type[Warning], ...]r4   ústr | re.Pattern[str] | Noner   rp   rq   rr   )r�   rt   rq   rp   ru   )
rv   rw   rx   ry   r|   rA   rŽ   rk   r}   r~   r   s   @r   r/   r/     s‚   ø† ð GNØ37ð%ð
  ñ%àCð%ð 1ð%ð
 ð%ð 
÷%ñ %ô4
ðJà,ðJð &ðJð %ð	Jð
 
÷Jõ Jr$   )rq   zGenerator[WarningsRecorder])r   r¨   rq   r   )r&   úCallable[..., T]r'   r	   r(   r	   rq   r   r!   )r&   zCallable[..., Any] | Noner'   r	   r(   r	   rq   zWarningsRecorder | Any).)r1   r§   r   r¨   rq   r/   )
r1   r§   r&   r©   r'   r	   r(   r	   rq   r   )
r1   r§   r'   r	   r   r¨   r(   r	   rq   zWarningsChecker | Any)$rz   Ú
__future__r   Úcollections.abcr   r   r   Úpprintr   r‰   Útypesr   Útypingr	   r
   r   r   r   Útyping_extensionsr   r   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   Ú_pytest.outcomesr   r   r   r   r#   r*   r|   Úcatch_warningsr   r/   r"   r$   r   Ú<module>r´      s¼  ðá 5å "å $Ý %Ý $Ý Û 	Ý Ý Ý Ý Ý  Ý ö Ý&ã å -Ý $Ý !Ý !ñ ˆCƒL€ð 	óó 	ðð 
à-0ñØ*ðàôó 
ðð
 
Û Pó 
Ø Pð '+ðØ
#ðØ36ðØBEðàõðD 
àBEðð +.ñØ?ðð (ðð õ	ó 
ðð 
ðØ?ðà
ðð ðð ð	ð
 óó 
ðð CJð=-ð +/ñ=-Ø?ð=-àð=-ð (ð=-ð ð	=-ð
 ö=-ô@V�x×.Ñ.ô Vðr ôkÐ&ó kó ñkr$   