Ë
    V.j«3  ã                  ó  — d 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 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 er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d«      Zed"d„«       Zeddœd#d„«       Zed$d„«       Z	 d%	 	 	 	 	 	 	 d&d„Ze	 d'ddœ	 	 	 	 	 d(d„«       Ze	 	 	 	 	 	 	 	 	 	 d)d„«       Ze fddœ	 	 	 	 	 	 	 	 	 d*d„Z G d „ dejB                  «      Z"e G d!„ de"«      «       Z#y)+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               #  ó„   K  — t        d¬«      } | 5  t        j                  d«       | –— ddd«       y# 1 sw Y   yxY w­w)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    úQC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\_pytest/recwarn.pyÚrecwarnr   "   s1   è ø€ ô  dÔ+€DÚ	Ü×Ñ˜iÔ(ØŠ
÷ 
�‰üs   ‚A ‘4«	A ´=¹A .©Úmatchr   c                 ó   — y ©N© r   s    r   Údeprecated_callr$   .   s   € ØTWó    c                 ó   — y r"   r#   )ÚfuncÚargsÚkwargss      r   r$   r$   2   s   € ØMPr%   c                óR   — d}| �| g|¢­}t        t        t        t        fg|¢­i |¤ŽS )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

    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                ó   — y r"   r#   )Úexpected_warningr    s     r   r+   r+   X   s   € ð
 r%   c                 ó   — y r"   r#   )r2   r'   r(   r)   s       r   r+   r+   `   s   € ð 	r%   c               ó,  — d}|s9|r)dj                  t        |«      «      }t        d|› d�«      ‚t        | |d¬«      S |d   }t	        |«      st        |›dt        |«      › d�«      ‚t        | d¬	«      5   ||d
d i |¤Žcddd«       S # 1 sw Y   yxY w)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óð ô Ð/¸EÈTÔRÐRà�A‰wˆÜ˜Œ~Ü˜t˜h o´d¸4³j°\ÐASÐTÓUÐUÜÐ-¸Ö>Ù˜˜a˜b˜Ð, VÑ,÷ ?×>Ò>ús   Á5B
Â
Bc                  ó�   ‡ — e Zd ZdZddœdˆ fd„Zedd„«       Zdd„Zdd„Zdd„Z	e
fdd	„Zdd
„Zdˆ fd„Z	 	 	 	 	 	 	 	 dˆ fd„Zˆ xZS )r   aF  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               óX   •— t        |«       t        ‰| �	  d¬«       d| _        g | _        y )NT)ÚrecordF)r   ÚsuperÚ__init__Ú_enteredÚ_list)Úselfr   Ú	__class__s     €r   rA   zWarningsRecorder.__init__¶   s)   ø€ Ü�yÔ!Ü‰Ñ ÐÔ%ØˆŒØ46ˆ�
r%   c                ó   — | j                   S )zThe list of recorded warnings.©rC   ©rD   s    r   ÚlistzWarningsRecorder.list¼   s   € ð �z‰zÐr%   c                ó    — | j                   |   S )z Get a recorded warning by index.rG   )rD   Úis     r   Ú__getitem__zWarningsRecorder.__getitem__Á   s   € à�z‰z˜!‰}Ðr%   c                ó,   — t        | j                  «      S )z&Iterate through the recorded warnings.)ÚiterrC   rH   s    r   Ú__iter__zWarningsRecorder.__iter__Å   s   € ä�D—J‘JÓÐr%   c                ó,   — t        | j                  «      S )z The number of recorded warnings.)ÚlenrC   rH   s    r   Ú__len__zWarningsRecorder.__len__É   s   € ä�4—:‘:‹Ðr%   c                ó„  — d}t        | j                  «      D ]z  \  }}|j                  |k(  r| j                  j                  |«      c S t	        |j                  |«      sŒI|�.t	        |j                  | j                  |   j                  «      rŒy|}Œ| |�| j                  j                  |«      S d}t        |›d�«      ‚)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_idxrK   Úwr/   s         r   rV   zWarningsRecorder.popÍ   s©   € ð
  $ˆÜ˜dŸj™jÖ)‰DˆAˆqØ�z‰z˜SÒ Ø—z‘z—~‘~ aÓ(Ò(Ü˜!Ÿ*™* cÕ*ØÐ Ü! !§*¡*¨d¯j©j¸Ñ.B×.KÑ.KÕLà‘ð *ð ÐØ—:‘:—>‘> (Ó+Ð+Ø ÐÜ ˜wÐ&@ÐAÓBÐBr%   c                ó"   — g | j                   dd y)z$Clear the list of recorded warnings.NrG   rH   s    r   ÚclearzWarningsRecorder.clearà   s   € àˆ�
‰
‘1‰r%   c                óž   •— | j                   rd}t        d| ›d�«      ‚t        ‰| �  «       }|€J ‚|| _        t        j                  d«       | S )NTzCannot enter z twiceÚalways)rB   ÚRuntimeErrorr@   Ú	__enter__rC   r   r   )rD   r/   rC   rE   s      €r   ra   zWarningsRecorder.__enter__ä   sW   ø€ Ø�=Š=Ø $ÐÜ ¨t¨h°fÐ=Ó>Ð>Ü‘Ñ!Ó#ˆàÐ Ð Ð ØˆŒ
Ü×Ñ˜hÔ'Øˆr%   c                óp   •— | j                   sd}t        d| ›d�«      ‚t        ‰| �  |||«       d| _         y )NTzCannot exit z without entering firstF)rB   r`   r@   Ú__exit__)rD   Úexc_typeÚexc_valÚexc_tbr/   rE   s        €r   rc   zWarningsRecorder.__exit__ï   sA   ø€ ð �}Š}Ø $ÐÜ ¨d¨XÐ5LÐMÓNÐNä‰Ñ˜ 7¨FÔ3ð ˆ�r%   )r   ÚboolÚreturnÚNone)rh   zlist[warnings.WarningMessage])rK   Úintrh   úwarnings.WarningMessage)rh   z!Iterator[warnings.WarningMessage])rh   rj   )rY   ztype[Warning]rh   rk   )rh   ri   )rh   r   ©rd   ztype[BaseException] | Nonere   zBaseException | Nonerf   zTracebackType | Nonerh   ri   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rA   ÚpropertyrI   rL   rO   rR   ÚWarningrV   r]   ra   rc   Ú__classcell__©rE   s   @r   r   r   ©   sz   ø„ ñ
ð -2÷ 7ð òó ðóó óð (/ô Có&õ	ðà,ðð &ðð %ð	ð
 
÷ñ r%   c                  ó^   ‡ — e Zd Zedfddœ	 	 	 	 	 	 	 dˆ fd„Zdd„Z	 	 	 	 	 	 	 	 d	ˆ fd„Zˆ xZS )
r0   NFr   c               óT  •— t        |«       t        ‰| �	  d¬«       d}t        |t        «      r1|D ])  }t        |t        «      rŒt        |t        |«      z  «      ‚ |}n;t        |t        «      rt        |t        «      r|f}nt        |t        |«      z  «      ‚|| _	        || _
        y )NTr   z/exceptions must be derived from Warning, not %s)r   r@   rA   Ú
isinstanceÚtuplerW   rr   r9   r;   r2   r5   )rD   r2   r5   r   ÚmsgÚexcÚexpected_warning_tuprE   s          €r   rA   zWarningsChecker.__init__  s£   ø€ ô 	�yÔ!Ü‰Ñ 4ÐÔ(à?ˆÜÐ&¬Ô.Û'�Ü! #¤wÕ/Ü# C¬$¨s«)¡OÓ4Ð4ð (ð $4Ñ ÜÐ(¬$Ô/´JØœgô5
ð %5Ð#6Ñ ä˜C¤$Ð'7Ó"8Ñ8Ó9Ð9à 4ˆÔØ$ˆ�r%   c                óú   — | j                   €J ‚t        |j                  | j                   «      xrL t        | j                  d u xs3 t        j                  | j                  t        |j                  «      «      «      S r"   )	r2   rW   rU   rg   r5   ÚreÚsearchÚstrÚmessage)rD   Úwarnings     r   Úmatchesz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         ‰‰ �  |||«       d}|�!t        |t        «      rt        |t        «      ry dˆ fd„}	 t        ˆ fd„‰ D «       «      s"t        d‰ j                  › d |«       › d�«       nBt        ˆ fd„‰ D «       «      s.t        d‰ j                  › d‰ j                  › d	 |«       › d�«       ‰ D ]k  }‰ j                  |«      rŒt        j                  |j                  |j                  |j                  |j                  |j                   |j"                  ¬
«       Œm ‰ D ]ƒ  }t%        |j                  «      t&        urŒ|j                  j(                  sŒ6|j                  j(                  d   }t        |t*        «      rŒ`t-        d|›dt%        |«      j.                  › d�«      ‚ y # ‰ D ]k  }‰ j                  |«      rŒt        j                  |j                  |j                  |j                  |j                  |j                   |j"                  ¬
«       Œm ‰ D ]ƒ  }t%        |j                  «      t&        urŒ|j                  j(                  sŒ6|j                  j(                  d   }t        |t*        «      rŒ`t-        d|›dt%        |«      j.                  › d�«      ‚ w xY w)NTc                 óX   •— t        ‰D � cg c]  } | j                  ‘Œ c} d¬«      S c c} w )Né   )Úindent)r   r€   )r?   rD   s    €r   Ú	found_strz+WarningsChecker.__exit__.<locals>.found_str7  s&   ø€ Ü¹Ó>¹¨v˜FŸN›N¸Ñ>ÀqÔIÐIùÒ>s   ‹'c              3  ó^   •K  — | ]$  }t        |j                  ‰j                  «      –— Œ& y ­wr"   )rW   rU   r2   ©Ú.0r[   rD   s     €r   Ú	<genexpr>z+WarningsChecker.__exit__.<locals>.<genexpr>;  s#   øè ø€ ÐSÉdÈ”z !§*¡*¨d×.CÑ.C×DÉdùs   ƒ*-z"DID NOT WARN. No warnings of type z" were emitted.
 Emitted warnings: Ú.c              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­wr"   )r‚   r‰   s     €r   r‹   z+WarningsChecker.__exit__.<locals>.<genexpr>@  s   øè ø€ Ð7±$¨Q˜Ÿ™ aŸ±$ùs   ƒz* matching the regex were emitted.
 Regex: z
 Emitted warnings: )r€   rU   ÚfilenameÚlinenoÚmoduleÚsourcer   z$Warning must be str or Warning, got z (type Ú))rh   r   )r@   rc   rw   Ú	Exceptionr   Úanyr   r2   r5   r‚   r   Úwarn_explicitr€   rU   rŽ   r�   rn   r‘   r;   ÚUserWarningr(   r   r9   rm   )	rD   rd   re   rf   r/   r‡   r[   ry   rE   s	   `       €r   rc   zWarningsChecker.__exit__"  s]  ù€ ô 	‰Ñ˜ 7¨FÔ3à Ðð ÐÜ˜7¤IÔ.ä˜'¤4Ô(àõ	Jð2	ÜÓSÉdÓSÔSÜØ8¸×9NÑ9NÐ8Oð P*Ù*3«+¨°að9õô Ó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   Á A8F1 Æ1J+Ç	C"J+)r2   ú)type[Warning] | tuple[type[Warning], ...]r5   ústr | Pattern[str] | Noner   rg   rh   ri   )r�   rk   rh   rg   rl   )rm   rn   ro   rr   rA   r‚   rc   rs   rt   s   @r   r0   r0      s}   ø„ ð GNØ04ð%ð
  ñ%àCð%ð .ð%ð
 ð%ð 
õ%ó4
ðJà,ðJð &ðJð %ð	Jð
 
÷Jñ Jr%   )rh   zGenerator[WarningsRecorder])r    r˜   rh   r   )r'   úCallable[..., T]r(   r   r)   r   rh   r   r"   )r'   zCallable[..., Any] | Noner(   r   r)   r   rh   zWarningsRecorder | Any).)r2   r—   r    r˜   rh   r0   )
r2   r—   r'   r™   r(   r   r)   r   rh   r   )
r2   r—   r(   r   r    r˜   r)   r   rh   zWarningsChecker | Any)$rp   Ú
__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+   rr   Ú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%   