ó
    ùÞ j36  ã                  ó<  • 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Jr  \" S5      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!\"S4         S+S  jjr! " S! S\RF                  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)Ú	ParamSpec)ÚSelfÚP)Ú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    ÚI/var/www/html/gaurav/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%   0   s   € ð ó    c                ó   • g r#   r$   )ÚfuncÚargsÚkwargss      r   r%   r%   6   s   € ØSVr&   c                ó¨   • Sn[         [        [        4nU c  [        U/UQ70 UD6$ [        U5         U " U0 UD6sSSS5        $ ! , (       d  f       g= f)a  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
    >>> with pytest.deprecated_call(match="^use v3 of this api$") as warning_messages:
    ...    assert api_call_v2() == 200

You may use the keyword argument ``match`` to assert
that the warning matches a text or regex.

The return value is a list of :class:`warnings.WarningMessage` objects,
one for each warning emitted
(regardless of whether it is an ``expected_warning`` or not).
TN)ÚDeprecationWarningÚPendingDeprecationWarningÚFutureWarningÚwarns)r(   r)   r*   Ú__tracebackhide__Údep_warningss        r   r%   r%   :   sR   € ð2 ÐÜ&Ô(AÄ=ÐQ€LØ�|Ü�\Ð3 DÒ3¨FÑ3Ð3ä	ˆ|Õ	Ù�TÐ$˜VÑ$÷ 
×	×	ús   ±AÁ
AÚWarningsCheckerc               ó   • g r#   r$   )Úexpected_warningr!   s     r   r/   r/   \   s   € ð
 r&   c                ó   • g r#   r$   )r4   r(   r)   r*   s       r   r/   r/   d   s   € ð 	r&   c                ób  • SnUcS  U(       dL  UR                  SS5      nU(       a)  SR                  [        U5      5      n[        SU S35      e[	        XSS9$ [        U5      (       d  [        U< S[        U5       S	35      e[	        U SS
9   U" U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 should be used as a context manager::

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

The ``match`` keyword argument can be used 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: Regex pattern did not match any of the 1 warnings emitted.
     Regex: ...
     Emitted warnings: ...UserWarning...

**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.

TNr!   z, z5Unexpected keyword arguments passed to pytest.warns: z"
Use context-manager form instead?)Ú
match_exprr   z object (type: z) must be callabler   )ÚpopÚjoinÚsortedÚ	TypeErrorr2   ÚcallableÚtype)r4   r(   r)   r*   r0   r!   Úargnamess          r   r/   r/   m   s­   € ðb ÐØ�|žDØ.4¯j©j¸À$Ó.GˆÞØ—y‘y¤¨£Ó0ˆHÜØGÈÀzØ5ð6óð ô Ð/ÈTÑRÐRä˜�~‰~Ü˜t™h o´d¸4³j°\ÐASÐTÓUÐUÜÐ-¸Ó>Ù˜Ð( Ñ(÷ ?×>×>ú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   rD   ÚWarningsRecorder.__init__¼   s)   ø€ Ü�yÔ!Ü‰Ñ ÐÑ%ØˆŒØ46ˆ�
r&   c                ó   • U R                   $ )zThe list of recorded warnings.©rF   ©rG   s    r   ÚlistÚWarningsRecorder.listÂ   s   € ð �z‰zÐr&   c                ó    • U R                   U   $ )z Get a recorded warning by index.rK   )rG   Úis     r   Ú__getitem__ÚWarningsRecorder.__getitem__Ç   s   € à�z‰z˜!‰}Ðr&   c                ó,   • [        U R                  5      $ )z&Iterate through the recorded warnings.)ÚiterrF   rL   s    r   Ú__iter__ÚWarningsRecorder.__iter__Ë   s   € ä�D—J‘JÓÐr&   c                ó,   • [        U R                  5      $ )z The number of recorded warnings.)ÚlenrF   rL   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)Ú	enumeraterF   Úcategoryr8   Ú
issubclassÚAssertionError)rG   ÚclsÚbest_idxrP   Úwr0   s         r   r8   Ú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.NrK   rL   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)rE   ÚRuntimeErrorrC   Ú	__enter__rF   r   r   )rG   r0   rF   rH   s      €r   rj   Ú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)rE   ri   rC   Ú__exit__)rG   Úexc_typeÚexc_valÚexc_tbr0   rH   s        €r   rm   ÚWarningsRecorder.__exit__÷   s?   ø€ ð �}�}Ø $ÐÜ ¨d©XÐ5LÐMÓNÐNä‰Ñ˜¨FÔ3ð ˆ�r&   )rE   rF   )r   ÚboolÚreturnÚNone)rs   zlist[warnings.WarningMessage])rP   Úintrs   úwarnings.WarningMessage)rs   z!Iterator[warnings.WarningMessage])rs   ru   )r`   ztype[Warning]rs   rv   )rs   rt   )rs   r   ©rn   ztype[BaseException] | Nonero   zBaseException | Nonerp   zTracebackType | Noners   rt   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rD   ÚpropertyrM   rQ   rU   rY   ÚWarningr8   re   rj   rm   Ú__static_attributes__Ú__classcell__©rH   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	$ )r2   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   rC   rD   Ú
isinstanceÚtupler^   r~   r;   r=   r4   r7   )rG   r4   r7   r   ÚmsgÚexcÚexpected_warning_tuprH   s          €r   rD   Ú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#   )	r4   r^   r]   rr   r7   ÚreÚsearchÚstrÚmessage)rG   Ú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                ób  >^ • [         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        O‡[        U 4S jT  5       5      (       dm  Sn[        T R                  [        5      (       a  [        U 4S	 jT  5       5      (       a  S
n[        S[        T 5       ST R                  < SU" 5        SU 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      R0                   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      R0                   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Ž   )rB   rG   s    €r   Ú	found_strÚ+WarningsChecker.__exit__.<locals>.found_str?  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]   r4   ©Ú.0rb   rG   s     €r   Ú	<genexpr>Ú+WarningsChecker.__exit__.<locals>.<genexpr>C  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œ   H  s   øé € Ð7±$¨Q˜Ÿ™ aŸ˜²$ùs   ƒ Ú c              3  ó´   >#   • U HN  n[        UR                  TR                  5      (       d  M*  TR                  [	        UR
                  5      :H  v •  MP     g 7fr#   )r^   r]   r4   r7   r�   rŽ   r™   s     €r   r›   rœ   J  s?   øé € ð <á!˜Ü! !§*¡*¨d×.CÑ.C×Dó 6�D—O‘O¤s¨1¯9©9£~Ö5Ú!ùs
   ƒ(A¯)Az*
 Did you mean to `re.escape()` the regex?z'Regex pattern did not match any of the z warnings emitted.
 Regex: z
 Emitted warnings: )rŽ   r]   ÚfilenameÚlinenoÚmoduleÚsourcer   z$Warning must be str or Warning, got z (type Ú))rs   r�   )rC   rm   r„   Ú	Exceptionr   Úanyr   r4   r7   r�   rX   r�   r   Úwarn_explicitrŽ   r]   r¡   r¢   ry   r¤   r=   ÚUserWarningr)   r;   rx   )
rG   rn   ro   rp   r0   r–   Úescape_hintrb   r†   rH   s
   `        €r   rm   ÚWarningsChecker.__exit__*  sª  ù€ ô 	‰Ñ˜¨FÔ3à Ðð ÑÜ˜7¤I×.Ñ.ä˜'¤4×(Ñ(à÷	Jð9	ÜÔSÉdÓS×SÑSÜØ8¸×9NÑ9NÐ8Oð P*Ù*3«+¨°að9õô Ô7±$Ó7×7Ñ7Ø �Ü˜dŸo™o¬s×3Ñ3¼ô <á!ó<÷ 9ñ 9ð
 #P�KÜØ=¼cÀ$»i¸[ð IØ#Ÿ™Ñ1ð 2*Ù*3«+¨°a¸°}ðFôó �Ø—|‘| 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   ÁCH ÈL.È<C2L.)r4   r7   )r4   ú)type[Warning] | tuple[type[Warning], ...]r7   ústr | re.Pattern[str] | Noner   rr   rs   rt   )r�   rv   rs   rr   rw   )
rx   ry   rz   r{   r~   rD   r�   rm   r   r€   r�   s   @r   r2   r2     s‚   ø† ð GNØ37ð%ð
  ñ%àCð%ð 1ð%ð
 ð%ð 
÷%ñ %ô4
ðQà,ðQð &ðQð %ð	Qð
 
÷Qõ Qr&   )rs   zGenerator[WarningsRecorder])r!   r­   rs   r   )r(   úCallable[P, T]r)   úP.argsr*   úP.kwargsrs   r   r#   )r(   zCallable[..., Any] | Noner)   r	   r*   r	   rs   zWarningsRecorder | Any).)r4   r¬   r!   r­   rs   r2   )
r4   r¬   r(   r®   r)   r¯   r*   r°   rs   r   )
r4   r¬   r(   zCallable[..., object] | Noner)   r	   r*   r	   rs   zWarningsChecker | Any)&r|   Ú
__future__r   Úcollections.abcr   r   r   Úpprintr   r‹   Útypesr   Útypingr	   r
   r   r   r   Útyping_extensionsr   r   r   r   Ú_pytest.deprecatedr   Ú_pytest.fixturesr   Ú_pytest.outcomesr   r   r   r   r%   r/   r~   Úcatch_warningsr   r2   r$   r&   r   Ú<module>r»      sÁ  ðá 5å "å $Ý %Ý $Ý Û 	Ý Ý Ý Ý Ý  Ý ö Ý+Ý&á�#‹€Aã å -Ý $Ý !Ý !ñ ˆCƒL€ð 	óó 	ðð 
à-0ñØ*ðàôó 
ðð
 
Û Vó 
Ø Vð '+ð%Ø
#ð%Ø36ð%ØBEð%àõ%ðD 
àBEðð +.ñØ?ðð (ðð õ	ó 
ðð 
ðØ?ðà
ðð ðð ð	ð
 óó 
ðð CJØ)-ð?)Ø?ð?)à
&ð?)ð ð?)ð ð	?)ð
 õ?)ôDV�x×.Ñ.ô Vðr ôrÐ&ó ró ñrr&   