403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/twisted/trial/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyc
ó
ĶōMc@sĘdZddlZddlZddlmZddlmZddlmZmZm	Z	ddl
mZdefd„ƒYZ
d	efd
„ƒYZdefd„ƒYZd
efd„ƒYZdS(s?
Tests for Trial's interaction with the Python warning system.
i’’’’N(tStringIO(tFilePath(tTestCaset_collectWarningst_setWarningRegistryToNone(t
TestResulttMaskcBs$eZdZdefd„ƒYZRS(sS
    Hide a L{TestCase} definition from trial's automatic discovery mechanism.
    t	MockTestscBs,eZdZdZeZd„Zd„ZRS(s
        A test case which is used by L{FlushWarningsTests} to verify behavior
        which cannot be verified by code inside a single test method.
        ssome warning textcCstj|j|jƒdS(s@
            Generate a warning and don't flush it.
            N(twarningstwarntmessagetcategory(tself((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_unflushedscCs6tj|j|jƒ|jt|jƒƒdƒdS(s:
            Generate a warning and flush it.
            iN(RR	R
RtassertEqualtlent
flushWarnings(R((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_flushed#s(t__name__t
__module__t__doc__R
tUserWarningRR
R(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRs
	(RRRRR(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRstFlushWarningsTestscBsžeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„ZRS(sn
    Tests for L{TestCase.flushWarnings}, an API for examining the warnings
    emitted so far in a test.
    cCs5x.|jƒD] \}}|j|||ƒq
WdS(s
        Assert that all the keys present in C{subset} are also present in
        C{set} and that the corresponding values are equal.
        N(t	iteritemsR(Rtsettsubsettktv((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pytassertDictSubset2scCsP|jt|ƒt|ƒƒx-t||ƒD]\}}|j||ƒq,WdS(sµ
        For each pair of corresponding elements in C{sets} and C{subsets},
        assert that the element from C{subsets} is a subset of the element from
        C{sets}.
        N(RRtzipR(Rtsetstsubsetstatb((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pytassertDictSubsets;scCs|j|jƒgƒdS(sp
        If no warnings are emitted by a test, L{TestCase.flushWarnings} returns
        an empty list.
        N(RR(R((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt	test_noneFscCs€d}t}tjd|d|ƒd}t}tjd|d|ƒ|j|jƒi|d6|d6i|d6|d6gƒdS(s…
        If several warnings are emitted by a test, L{TestCase.flushWarnings}
        returns a list containing all of them.
        sfirst warning messageR
Rssecond warning messageN(RRR	tRuntimeWarningR"R(RtfirstMessaget
firstCategoryt
secondMessagetsecondCategory((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_severalNs	cCshd}t}x*tdƒD]}tjd|d|ƒqW|j|jƒi|d6|d6gdƒdS(s“
        The same warning triggered twice from the same place is included twice
        in the list returned by L{TestCase.flushWarnings}.
        sthe messageiR
RN(R$trangeRR	R"R(RR
Rti((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt
test_repeatedas	cCscd}t}tjd|d|ƒ|j|jƒi|d6|d6gƒ|j|jƒgƒdS(s’
        After a particular warning event has been returned by
        L{TestCase.flushWarnings}, it is not returned by subsequent calls.
        sthe messageR
RN(R$RR	R"RR(RR
R((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_clearedps	cCsÜtƒ}tjdƒ}|j|ƒ|jtjjgƒ}|j|dddƒ|j|ddtƒ|jj	j
}|j}|jd}|j|dd|ƒ|j|dd|ƒ|jt
|ƒd	ƒd
S(sx
        Any warnings emitted by a test which are not flushed are emitted to the
        Python warning system.
        R
iR
ssome warning textRitfilenametlinenoiN(RRRtrunRR
RtassertIdenticalRtim_funct	func_codetco_filenametco_firstlinenoR(Rtresulttcaset
warningsShowntwhereR.R/((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR
~s	
	
cCsgtƒ}tjdƒ}tƒ}|jtd|ƒ}|j|ƒ|jƒ|j|j	ƒdƒdS(sx
        Any warnings emitted by a test which are flushed are not emitted to the
        Python warning system.
        RtstdouttN(
RRRRtpatchtsysR0trestoreRtgetvalue(RR6R7toutputtmonkey((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR–s		

cCs½dtfd„ƒY}tƒ}tjdƒ}||_tj}zjtjdƒ|j|ƒ|j	t
|jƒdƒ|j|jdd|ƒ|jddj
|ƒWd|tj(XdS(s¾
        If a warnings filter has been installed which turns warnings into
        exceptions, tests have an error added to the reporter for them for each
        unflushed warning.
        t
CustomWarningcBseZRS((RR(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRBŖsR
terroriiN(tWarningRRRRRtfilterstsimplefilterR0RRterrorsR1ttrap(RRBR6R7toriginalWarnings((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_warningsConfiguredAsErrors¤s		


cCs„dtfd„ƒY}tƒ}tjdƒ}||_tj}z1tjdƒ|j|ƒ|j	|j
gƒWd|tj(XdS(sŹ
        If a warnings filter has been installed which turns warnings into
        exceptions, tests which emit those warnings but flush them do not have
        an error added to the reporter.
        RBcBseZRS((RR(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRBĀsRRCN(RDRRRRRRERFR0RRG(RRBR6R7RI((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt&test_flushedWarningsConfiguredAsErrors¼s		


cCsVtjdƒ|jt|jƒƒdƒtjdƒ|jt|jƒƒdƒdS(s•
        Any warnings emitted after a call to L{TestCase.flushWarnings} can be
        flushed by another call to L{TestCase.flushWarnings}.
        s
first messageissecond messageN(RR	RRR(R((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_multipleFlushesŅs

cs®d‰t‰‡‡fd†}d‰t‰‡‡fd†}|ƒ|ƒ|j|jd|gƒiˆd6ˆd6gƒ|j|jd|gƒiˆd6ˆd6gƒdS(	sī
        The list returned by L{TestCase.flushWarnings} includes only those
        warnings which refer to the source of the function passed as the value
        for C{offendingFunction}, if a value is passed for that parameter.
        sfirst warning textcstjˆˆddƒdS(Nt
stackleveli(RR	((R%R&(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pytoneåss	some textcstjˆˆddƒdS(NRMi(RR	((R(R'(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttwoźstoffendingFunctionsRR
N(RR$R"R(RRNRO((R%R'R(R&sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_filterOnOffendingFunctionŻscCs9d„}|ƒ|jt|jd|gƒƒdƒdS(s
        Verify that warnings emitted at the very edges of a function are still
        determined to be emitted from that function.
        cSs+tjdƒtjdƒtjdƒdS(Nsfirst line warningsinternal line warningslast line warning(RR	(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pytwarnerżs

RPiN(RRR(RRR((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_functionBoundariesųs	cCsFtjdƒ|jt|jdgƒ|jt|jƒƒdƒdS(sŲ
        If an object which is neither a function nor a method is included in
        the C{offendingFunctions} list, L{TestCase.flushWarnings} raises
        L{ValueError}.  Such a call flushes no warnings.
        soh noiN(RR	tassertRaisest
ValueErrorRtNoneRR(R((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_invalidFilters
cCst|jƒƒjdƒ}|jƒ|jdƒjdƒ|jdƒjdƒtjjd|jƒjƒ|j	tjj
|jƒjƒddlm}|j	tj
jdƒ|j	tj
j|jƒ|jdƒj
ƒ|jƒ|jt|j|jgƒƒd	ƒd
S(sx
        Warnings emitted by a function the source code of which is not
        available can still be flushed.
        ttwisted_private_helpers__init__.pyR;smissingsourcefile.pys7
import warnings
def foo():
    warnings.warn("oh no")
ii’’’’(tmissingsourcefileiN(Rtmktemptchildtmakedirst
setContentR=tpathtinserttparentt
addCleanuptremoveRXRYtmodulestpopRtfooRRR(RtpackageRY((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_missingSources

cCs;t|jƒƒjdƒ}|jƒ|jdƒjdƒ|jdƒjdƒtjjd|jƒjƒ|j	tjj
|jƒjƒddlm}tj
d=tj
|j=|j|jd	ƒƒddlm}|j	tj
jd	ƒ|j	tj
j|jƒ|jƒ|jt|j|jgƒƒd
ƒdS(s

        Warnings emitted by a function defined in a file which has been renamed
        since it was initially compiled can still be flushed.

        This is testing the code which specifically supports working around the
        unfortunate behavior of CPython to write a .py source file name into
        the .pyc files it generates and then trust that it is correct in
        various places.  If source files are renamed, .pyc files may not be
        regenerated, but they will contain incorrect filenames.
        RXs__init__.pyR;s	module.pys7
import warnings
def foo():
    warnings.warn("oh no")
ii’’’’(tmodulettwisted_renamed_helperiN(RRZR[R\R]R=R^R_R`RaRbRXRhRcRtmoveTotsiblingRiRdReRRR(RRfRh((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_renamedSource*s 



(RRRRR"R#R)R,R-R
RRJRKRLRQRSRWRgRl(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR,s"																tFakeWarningcBseZRS((RR(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRmXstCollectWarningsTestscBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(s(
    Tests for L{_collectWarnings}.
    cs“d‰ˆddd…‰g‰‡‡‡fd†}tˆj|ƒ|jˆddƒ|jˆdjˆƒ|jˆdjˆƒ|jˆd	d
ƒ|jtˆƒdƒdS(sS
        L{_collectWarnings} calls the observer with each emitted warning.
        sdummy calls observer warningNi’’’’cs8ˆjdƒtjˆƒtjˆƒˆjdƒdS(Ntcallt	returning(tappendRR	((R%R'tevents(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pytfhs


iRoiiiRpi(RRqRR
R(RRs((R%R'RrsC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_callsObserverascCsLtƒ}|jtd|ƒtd„tjdƒ|j|jƒdƒdS(s”
        Any warnings emitted by a call to a function passed to
        L{_collectWarnings} are not actually emitted to the warning system.
        R:cSsdS(N(RV(tx((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt<lambda>~sttextR;N(RR<R=RRR	RR?(RR@((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_suppressesws	c	s€g‰tƒ‰‡‡fd†}td„|ddddddƒ}|jˆd
idd6dd6fgƒ|j|ˆƒd	S(s€
        L{_collectWarnings} returns the result of calling the callable passed to
        it with the parameters given.
        csˆj||fƒˆS(N(Rq(targstkwargs(t	argumentstvalue(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRsŠscSsdS(N(RV(Ru((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRvŽsiR R!itctdN(iR (tobjectRRR1(RRsR6((R|R{sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_callsFunction‚s	$'cCsƒbd„}tjdƒ|ƒg}t|j|ƒ|jt|ƒdƒ|j|djdƒ|jt|jƒƒdƒdS(sģ
        Subsequent emissions of a warning from a particular source site can be
        collected by L{_collectWarnings}.  In particular, the per-module
        emitted-warning cache should be bypassed (I{__warningregistry__}).
        cSstjdƒdS(NRe(RR	(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRs”stdefaultiiReN(	t__warningregistry__RRFRRqRRR
R(RRsRr((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_duplicateWarningCollected“s	
cCs:tƒ}|tj|<|jtjj|ƒ|jƒdS(s±
        L{_collectWarnings}'s behavior is not altered by the presence of an
        object which cannot have attributes set on it as a value in
        C{sys.modules}.
        N(RR=RcRaRdRƒ(Rtkey((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyttest_immutableObject¬s	
cs¢i‰dtf‡fd†ƒY}tƒ}tƒ}||ƒˆ|<tƒ}tƒ}||ƒˆ|<tˆƒ|jt||||gƒtˆjƒƒƒdS(sŁ
        If the dictionary passed to L{_setWarningRegistryToNone} changes size
        partway through the process, C{_setWarningRegistryToNone} continues to
        set C{__warningregistry__} to C{None} on the rest of the values anyway.


        This might be caused by C{sys.modules} containing something that's not
        really a module and imports things on setattr.  py.test does this, as
        does L{twisted.python.deprecate.deprecatedModuleAttribute}.
        tAcs eZd„Z‡fd†ZRS(cSs||jd<dS(Nt_key(t__dict__(RR„((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt__init__Ęscsdˆ|j<dS(N(RVR‡(RR|titem(R~(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt__setattr__És(RRR‰R‹((R~(sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR†Ås	N(RRRRtkeys(RR†tkey1tkey2tkey3tkey4((R~sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt+test_setWarningRegistryChangeWhileIteratingøs				
(	RRRRtRxR€RƒR…R‘(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyRn]s					(RR=RRttwisted.python.filepathRttwisted.trial.unittestRRRttwisted.trial.reporterRRRRRDRmRn(((sC/usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt<module>s’-

Youez - 2016 - github.com/yon3zu
LinuXploit