GhostManSec
Server: Apache
System: Linux s323.xrea.com 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User: moonarc (17751)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //usr/lib/python2.7/site-packages/_pytest/recwarn.pyo
�
��abc@`s�dZddlmZmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZe
d��Zdd�Zdefd	��YZd
�Zde
jfd��YZd
efd��YZdS(s4 recording warnings during test function execution. i(tabsolute_importtdivisiontprint_functionN(t
yield_fixture(tfailcc`s,t�}|�tjd�|VWdQXdS(sReturn a WarningsRecorder instance that provides these methods:

    * ``pop(category=None)``: return last warning matching the category.
    * ``clear()``: clear list of warnings

    See http://docs.python.org/library/warnings.html for information
    on warning categories.
    tdefaultN(tWarningsRecordertwarningstsimplefilter(twrec((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pytrecwarns
	
cO`s4|s
t�St}t��|||�SWdQXdS(sGcontext manager that can be used to ensure a block of code triggers a
    ``DeprecationWarning`` or ``PendingDeprecationWarning``::

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

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

    ``deprecated_call`` 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.
    N(t_DeprecatedCallContexttTrue(tfunctargstkwargst__tracebackhide__((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pytdeprecated_call!s

RcB`s5eZdZd�Zd�Zdd�Zd�ZRS(sJImplements the logic to capture deprecation warnings as a context manager.cC`s=g|_tj|_tj|_|jt_|jt_dS(N(t_captured_categoriesRtwarnt	_old_warnt
warn_explicitt_old_warn_explicitt_warn_explicitt_warn(tself((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt	__enter__<s
	cO`s|jj|�dS(N(Rtappend(RtmessagetcategoryRR((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyRCscO`s9t|t�r%|jj|j�n|jj|�dS(N(t
isinstancetWarningRRt	__class__(RRRRR((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyRFsc`sq|jt_|jt_|dkrmttf�t�fd�|j	D��smt
}d}t|��qmndS(Nc3`s|]}t|��VqdS(N(t
issubclass(t.0tc(tdeprecation_categories(s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pys	<genexpr>Rss?Did not produce DeprecationWarning or PendingDeprecationWarning(RRRRRtNonetDeprecationWarningtPendingDeprecationWarningtanyRRtAssertionError(Rtexc_typetexc_valtexc_tbRtmsg((R$s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt__exit__LsN(t__name__t
__module__t__doc__RRR%RR.(((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR9s
		cO`sd}|s:d|kr*|jd�}nt|d|�St|dt�r�|\}tjd�}|jj�}|j	|�t|d|��6t
jj|�j
�}tjj||j|�WdQXn4|d}t|d|��||d|�SWdQXdS(s�Assert that code raises a particular class of warning.

    Specifically, the input @expected_warning can be a warning class or
    tuple of warning classes, and the code must return that warning
    (if a single class) or one of those warnings (if a tuple).

    This helper produces a list of ``warnings.WarningMessage`` objects,
    one for each warning raised.

    This function can be used as a context manager, or any of the other ways
    ``pytest.raises`` can be used::

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

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

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

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

        >>> with 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... was emitted...

    tmatcht
match_expriiN(R%tpoptWarningsCheckerRtstrtsyst	_getframetf_localstcopytupdatet_pytestt_codetSourcetcompiletpytbuiltintexec_t	f_globals(texpected_warningRRR3tcodetframetlocR
((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pytwarnsXs  	
"
RcB`sheZdZd�Zed��Zd�Zd�Zd�Ze	d�Z
d�Zd�Zd	�Z
RS(
s^A context manager to record raised warnings.

    Adapted from `warnings.catch_warnings`.
    cC`s/tt|�jdt�t|_g|_dS(Ntrecord(tsuperRt__init__RtFalset_enteredt_list(R((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyRK�s	cC`s|jS(sThe list of recorded warnings.(RN(R((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pytlist�scC`s|j|S(s Get a recorded warning by index.(RN(Rti((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt__getitem__�scC`s
t|j�S(s&Iterate through the recorded warnings.(titerRN(R((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt__iter__�scC`s
t|j�S(s The number of recorded warnings.(tlenRN(R((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt__len__�scC`s\x?t|j�D].\}}t|j|�r|jj|�SqWt}td|��dS(s>Pop the first recorded warning, raise exception if not exists.s%r not found in warning listN(t	enumerateRNR!RR4RR)(RtclsRPtwR((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR4�s
cC`sg|j(dS(s$Clear the list of recorded warnings.N(RN(R((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pytclear�scC`sK|jr"t}td|��ntt|�j�|_tjd�|S(NsCannot enter %r twicetalways(	RMRtRuntimeErrorRJRRRNRR(RR((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR�s	
cG`s<|js"t}td|��ntt|�j|�dS(Ns%Cannot exit %r without entering first(RMRR[RJRR.(Rtexc_infoR((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR.�s	(R/R0R1RKtpropertyRORQRSRURR4RYRR.(((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR�s						R5cB`s eZddd�Zd�ZRS(cC`s�tt|�j�d}t|t�rdxy|D].}tj|�s/t|t|���q/q/Wn@tj|�r|f}n%|dk	r�t|t|���n||_
||_dS(NsDexceptions must be old-style classes or derived from Warning, not %s(RJR5RKRttupletinspecttisclasst	TypeErrorttypeR%RDR3(RRDR3R-texc((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyRK�s
 	c`s1tt��j|�td�|D��r-�jdk	r-t�fd��D��s�t}tdj	�jg�D]}|j
^qs��q*�jdk	r*x��D]F}t|j
�j�r�tj�j�jt|j
��r�Pq�q�q�Wtdj	�j�jg�D]}|j
^q��q*q-ndS(Ncs`s|]}|dkVqdS(N(R%(R"ta((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pys	<genexpr>�sc3`s$|]}t|j�j�VqdS(N(R!RRD(R"tr(R(s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pys	<genexpr>�ssXDID NOT WARN. No warnings of type {0} was emitted. The list of emitted warnings is: {1}.siDID NOT WARN. No warnings of type {0} matching ('{1}') was emitted. The list of emitted warnings is: {2}.(RJR5R.tallRDR%R(RRtformatRR3R!RtreR?tsearchR6(RR\RteachRe((Rs3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR.�s"
	#
$	N(R/R0R%RKR.(((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyR5�s(R1t
__future__RRRR_t
_pytest._codeR<R@R7RRht_pytest.fixturesRt_pytest.outcomesRR
R%RtobjectRRHtcatch_warningsRR5(((s3/usr/lib/python2.7/site-packages/_pytest/recwarn.pyt<module>s	57