ó
    áÅŸg«3  ã                  ó,  • S 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  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)ÚpformatN)ÚTracebackType)ÚAny)ÚCallable)Úfinal)Ú	Generator)ÚIterator)Úoverload)ÚPattern)Ú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    ÚP/var/www/blue/EV-Temp_rev04/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   € ØTWó    c                ó   • g r"   r#   )ÚfuncÚargsÚkwargss      r   r$   r$   2   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$   6   sC   € ð4 ÐØÑØˆ}�t‰}ˆÜÜ	Ô6¼ÐFðØIMòØQWñð r%   ÚWarningsCheckerc               ó   • g r"   r#   )Úexpected_warningr    s     r   r+   r+   X   s   € ð
 r%   c                ó   • g r"   r#   )r2   r'   r(   r)   s       r   r+   r+   `   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Ú	TypeErrorr0   ÚcallableÚtype)r2   r    r(   r)   r/   Úargnamesr'   s          r   r+   r+   i   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   rB   ÚWarningsRecorder.__init__¶   s)   ø€ Ü�yÔ!Ü‰Ñ ÐÑ%ØˆŒØ46ˆ�
r%   c                ó   • U R                   $ )zThe list of recorded warnings.©rD   ©rE   s    r   ÚlistÚWarningsRecorder.list¼   s   € ð �z‰zÐr%   c                ó    • U R                   U   $ )z Get a recorded warning by index.rI   )rE   Úis     r   Ú__getitem__ÚWarningsRecorder.__getitem__Á   s   € à�z‰z˜!‰}Ðr%   c                ó,   • [        U R                  5      $ )z&Iterate through the recorded warnings.)ÚiterrD   rJ   s    r   Ú__iter__ÚWarningsRecorder.__iter__Å   s   € ä�D—J‘JÓÐr%   c                ó,   • [        U R                  5      $ )z The number of recorded warnings.)ÚlenrD   rJ   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)Ú	enumeraterD   ÚcategoryÚpopÚ
issubclassÚAssertionError)rE   ÚclsÚbest_idxrN   Ú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.NrI   rJ   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)rC   ÚRuntimeErrorrA   Ú	__enter__rD   r   r   )rE   r/   rD   rF   s      €r   ri   Ú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)rC   rh   rA   Ú__exit__)rE   Úexc_typeÚexc_valÚexc_tbr/   rF   s        €r   rl   ÚWarningsRecorder.__exit__ï   s?   ø€ ð �}�}Ø $ÐÜ ¨d©XÐ5LÐMÓNÐNä‰Ñ˜¨FÔ3ð ˆ�r%   )rC   rD   )r   ÚboolÚreturnÚNone)rr   zlist[warnings.WarningMessage])rN   Úintrr   úwarnings.WarningMessage)rr   z!Iterator[warnings.WarningMessage])rr   rt   )r_   ztype[Warning]rr   ru   )rr   rs   )rr   r   ©rm   ztype[BaseException] | Nonern   zBaseException | Nonero   zTracebackType | Nonerr   rs   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rB   ÚpropertyrK   rO   rS   rW   ÚWarningr\   rd   ri   rl   Ú__static_attributes__Ú__classcell__©rF   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	$ )r0   é   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   rA   rB   Ú
isinstanceÚtupler]   r}   r9   r;   r2   r5   )rE   r2   r5   r   ÚmsgÚexcÚexpected_warning_tuprF   s          €r   rB   Ú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"   )	r2   r]   r[   rq   r5   ÚreÚsearchÚstrÚmessage)rE   Ú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                 óT   >• [        T V s/ sH  o R                  PM     sn SS9$ s  sn f )Né   )Úindent)r   rŽ   )r@   rE   s    €r   Ú	found_strÚ+WarningsChecker.__exit__.<locals>.found_str7  s$   ø€ Ü¹Ó>¹¨vŸNœN¹Ñ>ÀqÑIÐIùÒ>s   ‹%c              3  ób   >#   • U H%  n[        UR                  TR                  5      v •  M'     g 7fr"   )r]   r[   r2   ©Ú.0ra   rE   s     €r   Ú	<genexpr>Ú+WarningsChecker.__exit__.<locals>.<genexpr>;  s%   øé € ÐSÉdÈ”z !§*¡*¨d×.CÑ.C×DÐDÊdùs   ƒ,/z"DID NOT WARN. No warnings of type z" were emitted.
 Emitted warnings: Ú.c              3  óD   >#   • U H  nTR                  U5      v •  M     g 7fr"   )r�   r™   s     €r   r›   rœ   @  s   øé € Ð7±$¨Q˜Ÿ™ aŸ˜²$ùs   ƒ z* matching the regex were emitted.
 Regex: z
 Emitted warnings: )rŽ   r[   ÚfilenameÚlinenoÚmoduleÚsourcer   z$Warning must be str or Warning, got z (type Ú))rr   r�   )rA   rl   r„   Ú	Exceptionr   Úanyr   r2   r5   r�   r   Úwarn_explicitrŽ   r[   rŸ   r    rx   r¢   r;   ÚUserWarningr(   r�   r9   rw   )	rE   rm   rn   ro   r/   r–   ra   r†   rF   s	   `       €r   rl   Ú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/)r2   r5   )r2   ú)type[Warning] | tuple[type[Warning], ...]r5   ústr | Pattern[str] | Noner   rq   rr   rs   )r�   ru   rr   rq   rv   )
rw   rx   ry   rz   r}   rB   r�   rl   r~   r   r€   s   @r   r0   r0      s‚   ø† ð GNØ04ð%ð
  ñ%àCð%ð .ð%ð
 ð%ð 
÷%ñ %ô4
ðJà,ðJð &ðJð %ð	Jð
 
÷Jõ Jr%   )rr   zGenerator[WarningsRecorder])r    rª   rr   r   )r'   úCallable[..., T]r(   r   r)   r   rr   r   r"   )r'   zCallable[..., Any] | Noner(   r   r)   r   rr   zWarningsRecorder | Any).)r2   r©   r    rª   rr   r0   )
r2   r©   r'   r«   r(   r   r)   r   rr   r   )
r2   r©   r(   r   r    rª   r)   r   rr   zWarningsChecker | Any)$r{   Ú
__future__r   Úpprintr   r‹   Útypesr   Útypingr   r   r   r	   r
   r   r   r   r   Útyping_extensionsr   r   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   Ú_pytest.outcomesr   r   r   r   r$   r+   r}   Úcatch_warningsr   r0   r#   r%   r   Ú<module>rµ      s«  ðá 5å "å Û 	Ý Ý Ý Ý Ý Ý Ý Ý Ý  Ý ö Ý&ã å -Ý $Ý !Ý !ñ ˆCƒL€ð 	óó 	ðð 
Ø:=Ö Wó 
Ø Wð 
Û Pó 
Ø Pð '+ðØ
#ðØ36ðØBEðàõðD 
àBEðð (+ñØ?ðð %ðð õ	ó 
ðð 
ðØ?ðà
ðð ðð ð	ð
 óó 
ðð CJð=-ð (,ñ=-Ø?ð=-àð=-ð %ð=-ð ð	=-ð
 ö=-ô@T�x×.Ñ.ô Tðn ôkÐ&ó kó ñkr%   