Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/future/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/future/tests/base.pyc
�
,�]c@@s8ddlmZmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZmZddlmZmZmZer�ddlZnd�Zd�Zdefd	��YZd
efd��YZdefd
��YZdejfd��YZejed�Zd�Z d�Z!d�Z"d�Z#e$ejd�r�ejj%ej_&ne'd�Z(e$ejd�r�e
ejde(�nde)fd��YZ*de*fd��YZ+e'd�Z,e$ejd�r4e
ejde,�ndS(i(tprint_functiontabsolute_importN(tdedent(tbind_methodtPY26tPY3tPY2tPY27(tcheck_outputtSTDOUTtCalledProcessErrorcC@s&|jd�r|d}nt|�S(s,
    Removes any leading 
 and dedents.
    s
i(t
startswithR(tcode((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt
reformat_codes
cC@sW|jd�}gt|�D]!\}}|jd�r|^q}gt|�D]0\}}|jd�sz|jd�rP|^qP}gt|�D]!\}}|jd�r�|^q�}|j�|ks�td��d�}d�}||�||�kstd	��tg|D]}||^q�}	tt||	��}
tg|D]}||^qP�}tt||��}tg|D]}||^q��}
tt||
��}g}x�tt	|��D]w}||kr�|j
|
|�q�||kr|j
||�q�||kr5|j
||�q�|j
||�q�Wdj|�S(
s
    Returns the code block with any ``__future__`` import lines sorted, and
    then any ``future`` import lines sorted, then any ``builtins`` import lines
    sorted.

    This only sorts the lines within the expected blocks.

    See test_order_future_lines() for an example.
    s
sfrom __future__ import sfrom futures	from pasts
from builtinssIinternal usage error: dedent the code before calling order_future_lines()cS@s t|�dkrt|�SdS(Ni(tlentmax(tnumbers((s5/usr/lib/python2.7/site-packages/future/tests/base.pytmymax7scS@s&t|�dkrt|�Std�S(Nitinf(Rtmintfloat(R((s5/usr/lib/python2.7/site-packages/future/tests/base.pytmymin:ss2the __future__ and future imports are out of order(tsplitt	enumerateRtlstriptAssertionErrortsortedtdicttziptrangeRtappendtjoin(Rtlinestitlinetuufuture_line_numberstfuture_line_numberstbuiltins_line_numbersRRtuultsorted_uufuture_linestfltsorted_future_linestbltsorted_builtins_linest	new_lines((s5/usr/lib/python2.7/site-packages/future/tests/base.pytorder_future_liness:
			###tVerboseCalledProcessErrorcB@s#eZdZdd�Zd�ZRS(s�
    Like CalledProcessError, but it displays more information (message and
    script output) for diagnosing test failures etc.
    cC@s(||_||_||_||_dS(N(tmsgt
returncodetcmdtoutput(tselfR/R0R1R2((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt__init__`s			cC@s d|j|j|j|jfS(Ns>Command '%s' failed with exit status %d
Message: %s
Output: %s(R1R0R/R2(R3((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt__str__fsN(t__name__t
__module__t__doc__tNoneR4R5(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR.[st
FuturizeErrorcB@seZRS((R6R7(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR:jstPasteurizeErrorcB@seZRS((R6R7(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR;mstCodeHandlercB@s�eZdZd�Zdeeeeed�Zed�Zd�Zdeeeeed�Z	d�Z
d	d
�Zd	d�Zd	deeed�Z
d	ejd
�ZRS(st
    Handy mixin for test classes for writing / reading / futurizing /
    running .py files in the test suite.
    cC@s�td�|_td�|_tjg|_tj�tj	j
|_tjd�}|ritj
�tj|d6|_nitj
�d6|_dS(si
        The outputs from the various futurize stages should have the
        following headers:
        s�
        from __future__ import absolute_import
        from __future__ import division
        from __future__ import print_function
        s4
        from __future__ import absolute_import
        from __future__ import division
        from __future__ import print_function
        from __future__ import unicode_literals
        from future import standard_library
        standard_library.install_aliases()
        from builtins import *
        t
PYTHONPATHN(R
theaders1theaders2tsyst
executabletinterpretersttempfiletmkdtemptostpathtsepttempdirtgetenvtgetcwdtpathseptenv(R3tpypath((s5/usr/lib/python2.7/site-packages/future/tests/base.pytsetUpvs$iic	C@s�|rt|�}n|j|�|jd|d|d|d|�|j�}|rx&|jD]}	|jd|	�}
q`Wn|S(s�
        Converts the code block using ``futurize`` and returns the
        resulting code.

        Passing stages=[1] or stages=[2] passes the flag ``--stage1`` or
        ``stage2`` to ``futurize``. Passing both stages runs ``futurize``
        with both stages by default.

        If from3 is False, runs ``futurize``, converting from Python 2 to
        both 2 and 3. If from3 is True, runs ``pasteurize`` to convert
        from Python 3 to both 2 and 3.

        Optionally reformats the code block first using the reformat() function.

        If run is True, runs the resulting code under all Python
        interpreters in self.interpreters.
        tstagestall_importstfrom3tconservativetinterpreter(R
t_write_test_scriptt_futurize_test_scriptt_read_test_scriptRBt_run_test_script(R3RRORPRQtreformattrunRRR2RSt_((s5/usr/lib/python2.7/site-packages/future/tests/base.pytconvert�s

cC@s�|r'|j|�}|j|�}nt|t�rXt|t�rX|jd�}nt|t�r�t|t�r�|jd�}n|jt|j��|j��dS(s�
        Compares whether the code blocks are equal. If not, raises an
        exception so the test fails. Ignores any trailing whitespace like
        blank lines.

        If ignore_imports is True, passes the code blocks into the
        strip_future_imports method.

        If one code block is a unicode string and the other a
        byte-string, it assumes the byte-string is encoded as utf-8.
        sutf-8N(tstrip_future_importst
isinstancetbytestdecodetassertEqualR-trstrip(R3R2texpectedtignore_imports((s5/usr/lib/python2.7/site-packages/future/tests/base.pytcompare�scC@s�g}x{|jd�D]j}|jd�pm|jd�pm|jd�pmd|kpmd|kpm|jd�s|j|�qqWdj|�S(s
        Strips any of these import lines:

            from __future__ import <anything>
            from future <anything>
            from future.<anything>
            from builtins <anything>

        or any line containing:
            install_hooks()
        or:
            install_aliases()

        Limitation: doesn't handle imports split across multiple lines like
        this:

            from __future__ import (absolute_import, division, print_function,
                                    unicode_literals)
        s
sfrom __future__ import sfrom future sfrom builtins sinstall_hooks()sinstall_aliases()sfrom future.(RRRR(R3RR2R"((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR\�sc	C@s�|j|d|d|d|d|d|�}	|rTd|krH|jn|j}
nd}
t|�}|
|kr{d}
n|j|	|
|d|�d	S(
s<
        Convenience method that calls convert() and compare().

        Reformats the code blocks automatically using the reformat_code()
        function.

        If all_imports is passed, we add the appropriate import headers
        for the stage(s) selected to the ``expected`` code-block, so they
        needn't appear repeatedly in the test code.

        If ignore_imports is True, ignores the presence of any lines
        beginning:

            from __future__ import ...
            from future import ...

        for the purpose of the comparison.
        RORPRQRYRRitRcN(R[R?R>R
Rd(R3tbeforeRbRORPRcRQRYRRR2theaderstreformatted((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt
convert_check�s!	cK@s|j|||�dS(se
        Convenience method to ensure the code is unchanged by the
        futurize process.
        N(Ri(R3Rtkwargs((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt	unchangedssmytestscript.pycC@s`t|t�r!|jd�}ntj|j|ddd��}|jt|��WdQXdS(s�
        Dedents the given code (a multiline string) and writes it out to
        a file in a temporary folder like /tmp/tmpUDCn7x/mytestscript.py.
        sutf-8twttencodingN(R]R^R_tiotopenRHtwriteR(R3Rtfilenametf((s5/usr/lib/python2.7/site-packages/future/tests/base.pyRT!s"cC@s8tj|j|ddd��}|j�}WdQX|S(NtrtRmsutf-8(RnRoRHtread(R3RqRrt	newsource((s5/usr/lib/python2.7/site-packages/future/tests/base.pyRV,s"c
C@s�g}t|�}|r(|jd�n|r7d}nrd}|dgkr\|jd�n7|dgkr{|jd�n|ddgks�t�|r�|jd�n|j|}tj|g|d	|g}	yt|	d
td|j�}
Wn�t	k
r�}t
|��7}dd
j|	�d|j|d|j�f}
WdQXd|kr[t
nt}t|d�s|d|_n||
|j|jd|j��nX|
S(Ns
--all-importss
pasteurize.pysfuturize.pyis--stage1is--stage2s--conservatives-wtstderrRLs8Error running the command %s
%s
Contents of file %s:

%st senv=%ss----
%s
----tfuturizeR2(tlistRRRHR@RARR	RLR
RoRRtR:R;thasattrR9R2R0R1(R3RqRORPRQRRtparamstscripttfnt	call_argsR2teRrR/t
ErrorClass((s5/usr/lib/python2.7/site-packages/future/tests/base.pyRU1s<	

%c
C@s�|j|}y%t||gd|jdt�}Wn�tk
r�}t|��=}ddj||g�d|j|d|j�f}WdQXt|d�s�d|_
nt||j|j
d|j
��nX|S(NRLRvs8Error running the command %s
%s
Contents of file %s:

%sRwsenv=%ss----
%s
----R2(RHRRLR	R
RoRRtRzR9R2R.R0R1(R3RqRSR}R2RRrR/((s5/usr/lib/python2.7/site-packages/future/tests/base.pyRW`s

%(ii(ii(ii(R6R7R8RNtFalsetTrueR[RdR\RiRkRTRVRUR@RARW(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR<qs"	+		"	!	-s#this test is known to fail on Py2.6cC@sts
|Stj|�S(N(RtunittesttexpectedFailure(tfunc((s5/usr/lib/python2.7/site-packages/future/tests/base.pytexpectedFailurePY3scC@sts
|Stj|�S(N(RR�R�(R�((s5/usr/lib/python2.7/site-packages/future/tests/base.pytexpectedFailurePY26�scC@sts
|Stj|�S(N(RR�R�(R�((s5/usr/lib/python2.7/site-packages/future/tests/base.pytexpectedFailurePY27�scC@sts
|Stj|�S(N(RR�R�(R�((s5/usr/lib/python2.7/site-packages/future/tests/base.pytexpectedFailurePY2�stassertRaisesRegexcC@s�t|ttf�r9|s'td��tj|�}n|j|�s||pQd}d||j|f}|j|��ndS(s=Fail the test unless the text matches the regular expression.s!expected_regex must not be empty.sRegex didn't matchs%s: %r not found in %rN(	R]tstrtunicodeRtretcompiletsearchtpatterntfailureException(R3ttexttexpected_regexR/((s5/usr/lib/python2.7/site-packages/future/tests/base.pytassertRegex�sR�t_AssertRaisesBaseContextcB@s)eZddd�Zd�Zd�ZRS(cC@s�||_||_|dk	rTy|j|_Wq]tk
rPt|�|_q]Xn	d|_t|ttf�r�t	j
|�}n||_d|_dS(N(
Rbt	test_caseR9R6tobj_nametAttributeErrorR�R]R^R�R�R�R/(R3RbR�tcallable_objR�((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR4�s		
		cC@s.|jj|j|�}|jj|��dS(N(R�t_formatMessageR/R�(R3tstandardMsgR/((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt
_raiseFailure�scC@sC|dkr%|jdd�|_|S|�|||�WdQXdS(s�
        If callable_obj is None, assertRaises/Warns is being used as a
        context manager, so check for a 'msg' kwarg and return self.
        If callable_obj is not None, call it passing args and kwargs.
        R/N(R9tpopR/(R3tnameR�targsRj((s5/usr/lib/python2.7/site-packages/future/tests/base.pythandle�s
N(R6R7R9R4R�R�(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR��s	t_AssertWarnsContextcB@s eZdZd�Zd�ZRS(sBA context manager used to implement TestCase.assertWarns* methods.cC@svx5tjj�D]$}t|dd�ri|_qqWtjdt�|_	|j	j
�|_tjd|j�|S(Nt__warningregistry__trecordtalways(
R@tmodulestvaluestgetattrR9R�twarningstcatch_warningsR�twarnings_managert	__enter__tsimplefilterRb(R3tv((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR��scC@so|jj|||�|dk	r&dSy|jj}Wn tk
rXt|j�}nXd}x�|jD]�}|j}t	||j�s�qin|dkr�|}n|j
dk	r�|j
jt|��r�qin||_|j
|_
|j|_dSW|dk	r-|jdj|j
jt|���n|jrU|jdj||j��n|jdj|��dS(Ns"{}" does not match "{}"s{} not triggered by {}s{} not triggered(R�t__exit__R9RbR6R�R�R�tmessageR]R�R�twarningRqtlinenoR�tformatR�R�(R3texc_typet	exc_valuettbtexc_nametfirst_matchingtmtw((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR��s8
				(R6R7R8R�R�(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR��s	cO@s(t|||�}|jd|||�S(s�Fail unless a warning of class warnClass is triggered
       by callable_obj when invoked with arguments args and keyword
       arguments kwargs.  If a different type of warning is
       triggered, it will not be handled: depending on the other
       warning filtering rules in effect, it might be silenced, printed
       out, or raised as an exception.

       If called with callable_obj omitted or None, will return a
       context object used like this::

            with self.assertWarns(SomeWarning):
                do_something()

       An optional keyword argument 'msg' can be provided when assertWarns
       is used as a context object.

       The context manager keeps a reference to the first matching
       warning as the 'warning' attribute; similarly, the 'filename'
       and 'lineno' attributes give you information about the line
       of Python code from which the warning was triggered.
       This allows you to inspect the warning after the assertion::

           with self.assertWarns(SomeWarning) as cm:
               do_something()
           the_warning = cm.warning
           self.assertEqual(the_warning.some_attribute, 147)
    tassertWarns(R�R�(R3texpected_warningR�R�Rjtcontext((s5/usr/lib/python2.7/site-packages/future/tests/base.pyR��sR�(-t
__future__RRRERCR�R@R�R�RnttextwrapRtfuture.utilsRRRRRtfuture.moves.subprocessRR	R
t	unittest2R
R-R.R:R;tTestCaseR<tskipIftskip26R�R�R�R�RztassertRaisesRegexpR�R9R�tobjectR�R�R�(((s5/usr/lib/python2.7/site-packages/future/tests/base.pyt<module>sD(			@�				
"1

Spamworldpro Mini