Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyc

ó
ê=Nc@sLdZddlmZddlmZmZmZdefd„ƒYZdS(sw
Tests for L{twisted.internet.defer.inlineCallbacks}.

These tests are defined in a non-C{test_*} module because they are
syntactically invalid on python < 2.5.  test_inlinecb will conditionally import
these tests on python 2.5 and greater.

Some tests for inlineCallbacks are defined in L{twisted.test.test_defgen} as
well: see U{http://twistedmatrix.com/trac/ticket/4182}.
iÿÿÿÿ(tTestCase(tDeferredtreturnValuetinlineCallbackstNonLocalExitTestscBs2eZdZd„Zd„Zd„Zd„ZRS(s¢
    It's possible for L{returnValue} to be (accidentally) invoked at a stack
    level below the L{inlineCallbacks}-decorated function which it is exiting.
    If this happens, L{returnValue} should report useful errors.

    If L{returnValue} is invoked from a function not decorated by
    L{inlineCallbacks}, it will emit a warning if it causes an
    L{inlineCallbacks} function further up the stack to exit.
    cCstdƒdS(s‹
        This method mistakenly invokes L{returnValue}, despite the fact that it
        is not decorated with L{inlineCallbacks}.
        iN(R(tself((sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pytmistakenMethodscCsu|j|dgƒ|jd|jgƒ}|jt|ƒdƒ|j|ddtƒ|j|dddƒdS(sc
        Flush the current warnings and assert that we have been told that
        C{mistakenMethod} was invoked, and that the result from the Deferred
        that was fired (appended to the given list) is C{mistakenMethod}'s
        result.  The warning should indicate that an inlineCallbacks function
        called 'inline' was made to exit.
        itoffendingFunctionsitcategorytmessagesŠreturnValue() in 'mistakenMethod' causing 'inline' to exit: returnValue should only be invoked by functions decorated with inlineCallbacksN(tassertEqualt
flushWarningsRtlentDeprecationWarning(Rt
resultListtwarnings((sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pytassertMistakenMethodWarning&scsEt‡fd†ƒ}|ƒ}g}|j|jƒˆj|ƒdS(s–
        L{returnValue} will emit a non-local exit warning in the simplest case,
        where the offending function is invoked immediately.
        c3sˆjƒtdƒdVdS(Nii(RR((R(sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pytinline>s

N(RtaddCallbacktappendR(RRtdtresults((RsH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyttest_returnValueNonLocalWarning9s
	csntƒ‰t‡‡fd†ƒ}|ƒ}g}|j|jƒˆj|gƒˆjdƒˆj|ƒdS(sÛ
        L{returnValue} will emit a non-local warning in the case where the
        L{inlineCallbacks}-decorated function has already yielded a Deferred
        and therefore moved its generator function along.
        c3sˆVˆjƒtdƒdS(Ni(RR((Rtcause(sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyRPs
iN(RRRRR
tcallbackR(RRteffectR((RRsH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyt test_returnValueNonLocalDeferredIs		
(t__name__t
__module__t__doc__RRRR(((sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyRs
				N(Rttwisted.trial.unittestRttwisted.internet.deferRRRR(((sH/usr/lib/python2.7/dist-packages/twisted/internet/test/inlinecb_tests.pyt<module>s