Your IP : 172.28.240.42


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


|Nc@s%dZddlZddlmZddlmZmZddlmZm	Z	ddl
mZddlm
Z
ddlmZmZmZd	efd
YZdejfdYZd
ejfdYZdejfdYZeejdZeejdddZdS(sF
Tests for assertions provided by L{twisted.trial.unittest.TestCase}.
iN(tpformat(treflecttfailure(t
deprecatedtgetVersionString(tVersion(tdefer(tunittesttrunnertreportertMockEqualitycBs#eZdZdZdZRS(cCs
||_dS(N(tname(tselfR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt__init__scCsd|jfS(NsMockEquality(%s)(R(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt__repr__scCs@t|ds(td||fn|jd|jdkS(NRs%r not comparable to %ri(thasattrt
ValueErrorR(Rtother((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt__eq__s(t__name__t
__module__R
RR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR
s		tTestAssertionscBs+eZdZdejfdYZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:e;ejd8d:d:kr)d9e:_=nRS(;sc
    Tests for TestCase's assertion methods.  That is, failUnless*,
    failIf*, assert*.

    Note: As of 11.2, assertEqual is preferred over the failUnlessEqual(s)
    variants.  Tests have been modified to reflect this preference.

    This is pretty paranoid.  Still, a certain paranoia is healthy if you
    are testing a unit testing framework.
    tFailingTestcBseZdZRS(cCs|jdS(N(tfailureException(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt
test_fails+s(RRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR*scCsny|jdWnG|jk
rZ}t|dksj|jdt|dqjnX|jddS(Ntfaileds"Exception had msg %s instead of %ss$Call to self.fail() didn't fail test(tfailRtstr(Rte((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttestFail.s	cCsttjjtj}tj}|j||j|j	|j
|jg|j
t|j
ddS(Ni(Rt
TestLoadert	loadClassRRR	t
TestResulttruntfailIft
wasSuccessfultassertEqualterrorstlentfailures(Rttesttresult((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failingException_fails8s
cCsx7ddtdd
ggD]}|j|d|fqWxdtdddgdgD]k}y|j|d|fWn3|jk
r}|jt|d|fqVX|jd	|fqVWdS(Nigsfailed on %ritcatiiisCall to failIf(%r) didn't fail((ii(tFalsetNoneR"tTrueRR$RR(RtnotTruettrueR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIf@s"!cCsxddtdd
ggD]k}y|j|d|fWn3|jk
ro}|jt|d|fqX|jd|fqWx:dtdddgdgD]}|j|d|fqWdS(Nigsfailed on %rs"Call to failUnless(%r) didn't failiR+iii((ii(R,R-t
failUnlessRR$RRR.(RR/RR0((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessKs!"cCs2|j||}||kr.|jdndS(Ns)assertEqual should return first parameter(R$R(Rtfirsttsecondtx((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt_testEqualPairWscCsy|j||Wnd|jk
rz}dt|t|f}t||kr|jd|t|fqnX|jd||fdS(Nsnot equal:
a = %s
b = %s
sExpected: %r; Got: %ss'Call to assertEqual(%r, %r) didn't fail(R$RRRR(RR4R5Rtexpected((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt_testUnequalPair]s$	cCsM|jdd|jdd|jdgdg|jdgddS(NR+tdogitorange(R7R9(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertEqual_basicjscCshtd}td}td}|j|||j|||j|||j||dS(NR4R5tfecund(R
R7R9(RR6tytz((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertEqual_customqscCs;|j|j|jddd}|jt|ddS(sj
        When a message is passed to L{assertEqual}, it is included in the
        error message.
        tfootbartmessages'message
not equal:
a = 'foo'
b = 'bar'
N(tassertRaisesRR$R(Rt	exception((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertEqualMessage{s	cCs;|j|j|jddd}|jt|ddS(sz
        If a message is specified as C{None}, it is not included in the error
        message of L{assertEqual}.
        RARBsnot equal:
a = 'foo'
b = 'bar'
N(RDRR$R-R(RRE((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertEqualNoneMessagescCsxtd}dg}y|j||Wn1|jk
rL|jdn(tk
r\nX|jd||fdS(NtappleR;s6Fail raised when ValueError ought to have been raised.s3Comparing %r and %r should have raised an exception(R
R$RRR(RRHR;((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertEqual_incomparables	
	cCs
|dS(N((Rterror((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt_raiseErrorscCs5|jt|jt}|jt|tddS(Ns?Expect failUnlessRaises to return instance of raised exception.(tfailUnlessRaisesRRKR2t
isinstance(RR6((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessRaises_expectedscCs_y|jt|jtWn1tk
r:|jdn!|jk
rMnX|jddS(Ns9failUnlessRaises shouldn't re-raise unexpected exceptionss4Expected exception wasn't raised. Should have failed(RLRRKt	TypeErrorRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt test_failUnlessRaises_unexpecteds
cCsWy|jtdWn,|jk
rE}|jt|dnX|jddS(NcSsdS(N(R-(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt<lambda>ss%ValueError not raised (None returned)s(Exception not raised. Should have failed(RLRRR$RR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt!test_failUnlessRaises_noExceptionscCs|j|j|j|j}|jt||jd|jfy|j|j|jt}Wn|jk
rynX|jddS(Ns#Expected %r instance to be returnedsShould have raised exception(RLRRKR2RMRR(RR6((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt&test_failUnlessRaises_failureExceptions
cCs~dgdgdg}}}|j||}|j||d|j|j|j|||j|j|j||dS(Niis)failIfEqual should return first parameter(tfailIfEqualR$RLR(RR6R>R?tret((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIfEqual_basicscCs|td}td}td}|j||}|j||d|j|j|j|||j||ddS(NR4R5R=s)failIfEqual should return first parameters __ne__ not defined, so not equal(R
RTR$RLR(RR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIfEqual_customEqscCs~dgdgdg}}}|j||}|j||d|j|j|j|||j|j|j||dS(Niis1failUnlessIdentical should return first parameter(tfailUnlessIdenticalR$RLR(RR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessIdenticalscCsd\}}}|j||d|j||d}|j||d|j|j|j||d|j|j|j||ddS(Ng?g?g333333?g?s4failUnlessApproximates should return first parameterg?(g?g?g333333?(tfailUnlessApproximatesR$RLR(RR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessApproximatesscCsd}d}d}d}|j||||j|||}|j||d||f|j|j|j|||dS(NigA! @gXO @gC @s<failUnlessAlmostEqual should return first parameter (%r, %r)(tfailUnlessAlmostEqualR$RLR(Rt	precisionR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessAlmostEqualscCsd}d}d}d}|j|||}|j||d||f|j|j|j||||j|j|j|||dS(NigA! @gXO @gC @s8failIfAlmostEqual should return first parameter (%r, %r)(tfailIfAlmostEqualR$RLR(RR]R6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIfAlmostEqualscCsd}d}d}|j|||j||}|j||d|j|j|j|||j|j|j||dS(NR+sthe dog satsthe cat satsshould return first parameter(tfailUnlessSubstringR$RLR(RR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessSubstringscCsd}d}d}|j|||j||}|j||d|j|j|j|||j|j|j||dS(NR+sthe dog satsthe cat satsshould return first parameter(tfailIfSubstringR$RLR(RR6R>R?RU((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIfSubstringscCs"tjd}|j|tS(NcSsddS(Nii((((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ,s(Rt
maybeDeferredt
assertFailuretZeroDivisionError(Rtd((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertFailure+scsHtjd}j|t|jfdfd|S(NcSsddS(Nii((((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ0scs
jdS(NsShould have failed(R(R6(R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ2scs|jjS(N(ttrapR(R6(R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ3s(RReRft
OverflowErrortaddCallbacks(RRh((RsF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt!test_assertFailure_wrongException/s
csEtjd}j|t|jfdfd|S(Ncs
jdS(NsShould have failed(R(R6(R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ9scs|jjS(N(RjR(R6(R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ:s(RtsucceedR-RfRgRl(RRh((RsF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertFailure_noException6s
cCsdyddWn,tk
r:tj}tj|}nX|j|t}|j|j||S(s
        In the case of assertFailure failing, check that we get lots of
        information about the exception that was raised.
        ii(	RgRtFailureRRRftRuntimeErrort
addErrbackt
_checkInfo(RtfRh((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertFailure_moreInfo=s
cCsT|j|jst|j}|j|j||j|j|dS(N(tcheckRtAssertionErrortgetErrorMessagetassertIntgetBriefTraceback(RtassertionFailureRttoutput((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRsKscswdtfdYdtjffdY}|d}tj}|j||jdt|jdS(sJ
        A single wrong assertFailure should fail the whole test.
        tExampleFailurecBseZRS((RR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR}UstTCcseZZdZRS(cSs6tjd}|j|t|j|t|S(NcSsddS(Nii((((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRQ[s(RReRfRkRg(RRh((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRiZs(RRRRi((R}(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR~XsRiiN(	t	ExceptionRtTestCaseR	R R!R$R&R'(RR~R(R)((R}sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertFailure_maskedQs
cCs8d}|jtdt|d}|j|ddS(s0
        Test basic assertWarns report.
        cSstjddt|S(NsWoo deprecatedtcategory(twarningstwarntDeprecationWarning(ta((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRjssWoo deprecatedi{N(tassertWarnsRt__file__R$(RRtr((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsfs	cCscd}|jtdt|d}|j|d|jtdt|d}|j|ddS(s}
        Test that assertWarns cleans the warning registry, so the warning is
        not swallowed the second time.
        cSstjddt|S(NsWoo deprecatedR(RRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRwssWoo deprecatedi{iAN(RRRR$(RRtr1tr2((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsRegistryCleanrs	cCs2d}|j|j|jtdt|ddS(sH
        Test assertWarns failure when no warning is generated.
        cSs|S(N((R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pytnormalssWoo deprecatedi{N(RDRRRR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsErrors	cCs2d}|j|j|jtdt|ddS(sF
        Test assertWarns failure when the category is wrong.
        cSstjddt|S(NsFoo deprecatedR(RRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssFoo deprecatedi{N(RDRRtUserWarningR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsWrongCategorys	cCs2d}|j|j|jtdt|ddS(sE
        Test assertWarns failure when the message is wrong.
        cSstjddt|S(NsFoo deprecatedR(RRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssBar deprecatedi{N(RDRRRR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsWrongMessages	cCs2d}|j|j|jtdt|ddS(s
        If the warning emitted by a function refers to a different file than is
        passed to C{assertWarns}, C{failureException} is raised.
        cSstjddtdddS(NsFoo deprecatedRt
stackleveli(RRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRs
sFoo deprecatedi{N(RDRRRR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsWrongFiles
	cCssdddY}|jtdt|}|jt|||jtdt|}|jt||dS(sH
        Test assertWarns works when creating a class instance.
        tWarncBseZdZRS(cSstjddtdS(NsDo not call meR(RRtRuntimeWarning(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR
s(RRR
(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssDo not call meN((RRRt
assertTrueRM(RRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsOnClasss		cCs|dddY}|}|jtdt|jd}|j|d|jtdt|jd}|j|ddS(sI
        Test assertWarns works when used on an instance method.
        RcBseZdZRS(cSstjddt|S(NsBar deprecatedR(RRR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRs(RRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssBar deprecatediAN((RRRRR$(RRtwR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsOnMethods	cCsvdddY}|}|jtdt|d}|j|d|jtdt|d}|j|ddS(sM
        Test assertWarns works on instance with C{__call__} method.
        RcBseZdZRS(cSstjddt|S(NsEgg deprecatedR(RRR(RR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt__call__s(RRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssEgg deprecatediAN((RRRR$(RRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsOnCalls	cCs8d}|jtdt|d}|j|ddS(sC
        Test assertWarns on a warning filterd by default.
        cSstjddt|S(NsWoo deprecatedR(RRtPendingDeprecationWarning(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssWoo deprecatedi{N(RRRR$(RRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertWarnsFilters	cs2dfd}|jtdt|dS(s
        C{assertWarns} does not raise an exception if the function it is passed
        triggers the same warning more than once.
        cSstjddtdS(NsWoo deprecatedR(RRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRscsdS(N(((R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRtssWoo deprecatedN(RRR(RRt((RsF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt test_assertWarnsMultipleWarningss	cCsJd}|j|j|jtdt|d}|jt|ddS(s
        For now, assertWarns is unable to handle multiple different warnings,
        so it should raise an exception if it's the case.
        cSs*tjddttjddtdS(NsWoo deprecatedRsAnother one(RRRR(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRssWoo deprecatedi{sCan't handle different warningsN(RDRRRRR$R(RRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt!test_assertWarnsDifferentWarnings
s
	csudtfdYfd}|d|jdt|d|j|g\}|j|dddS(s
        Warnings emitted before L{TestCase.assertWarns} is called do not get
        flushed and do not alter the behavior of L{TestCase.assertWarns}.
        t
TheWarningcBseZRS((RR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRscstj|ddS(NR(RR(RC(R(sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRt sRARBRCN(tWarningRRt
flushWarningsR$(RRttwarning((RsF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt&test_assertWarnsAfterUnassertedWarnings
cCs2tdtfi}|}|j||dS(s<
        Test a true condition of assertIsInstance.
        tAN(ttypetobjecttassertIsInstance(RRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertIsInstance(s	cCsMtdtfi}tdtfi}|}|j|||fdS(sR
        Test a true condition of assertIsInstance with multiple classes.
        RtBN(RRR(RRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt$test_assertIsInstanceMultipleClasses0s	cCsStdtfi}tdtfi}|}|j|j|j||dS(s6
        Test an error with assertIsInstance.
        RRN(RRRDRR(RRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertIsInstanceError9s	cCsntdtfi}tdtfi}tdtfi}|}|j|j|j|||fdS(sK
        Test an error with assertIsInstance and multiple classes.
        RRtCN(RRRDRR(RRRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt)test_assertIsInstanceErrorMultipleClassesBs
	cCs;|j|j|jdtd}|jdt|dS(s
        If L{TestCase.assertIsInstance} is passed a custom message as its 3rd
        argument, the message is included in the failure exception raised when
        the assertion fails.
        isSilly assertionN(RDRRRRy(Rtexc((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt"test_assertIsInstanceCustomMessageMscCsGtdtfi}tdtfi}|}|j||dS(s?
        Test a true condition of assertNotIsInstance.
        RRN(RRtassertNotIsInstance(RRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertNotIsInstanceYs	cCsbtdtfi}tdtfi}tdtfi}|}|j|||fdS(sT
        Test a true condition of assertNotIsInstance and multiple classes.
        RRRN(RRR(RRRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt'test_assertNotIsInstanceMultipleClassesbs
	cCs`tdtfi}|}|j|j|j||}|jt|d||fdS(s9
        Test an error with assertNotIsInstance.
        Rs%r is an instance of %sN(RRRDRRR$R(RRRRJ((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertNotIsInstanceErrorls
	cCsYtdtfi}tdtfi}|}|j|j|j|||fdS(sN
        Test an error with assertNotIsInstance and multiple classes.
        RRN(RRRDRR(RRRR((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt,test_assertNotIsInstanceErrorMultipleClassesws	cCs"|jidd6idd6dS(s
        L{twisted.trial.unittest.TestCase} supports the C{assertDictEqual}
        method inherited from the standard library in Python 2.7.
        iRN(tassertDictEqual(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_assertDictEqualsRs:assertDictEqual is not available on this version of PythonN(>RRt__doc__RRRRR*R1R3R7R9R<R@RFRGRIRKRNRPRRRSRVRWRYR[R^R`RbRdRiRmRoRuRsRRRRRRRRRRRRRRRRRRRRRRRRtgetattrR-tskip(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRsr
	
					
		
	
	
								
					
																															
		
	tTestAssertionNamescBs;eZdZdZdZdZdZdZRS(sK
    Tests for consistency of naming within TestCase assertion methods
    cCsPi}tj||dg|D],}|jdr |dkr ||^q S(NtasserttNott_(RtaccumulateMethodst
startswith(Rtdcttk((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt_getAssertsscCs|jS(N(R(RR6((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt_namescCsGt|j}ttj|d}|j||j|dS(s
        The C{failUnless*} test methods are a subset of the C{assert*} test
        methods.  This is intended to ensure that methods using the
        I{failUnless} naming scheme are not added without corresponding methods
        using the I{assert} naming scheme.  The I{assert} naming scheme is
        preferred, and new I{assert}-prefixed methods may be added without
        corresponding I{failUnless}-prefixed methods.
        R2N(tsetRRtprefixedMethodsR$tintersection(RtassertstfailUnlesses((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failUnlessMatchesAsserts	cCs\tjtjd}tjtjd}|jt|d|jt|d|jdS(Nt	assertNotR"tkey(RRRRR$tsortedR(RRtfailIfs((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failIf_matches_assertNotscCsxt|jD]\}}t|s1qn|jdr|jt||dd||f|j|t||dn|jdr|jt||d d||d f|j|t||d qqWdS(NtEqualtss
%s but no %sstEqualsis%s but no %s(tvarstitemstcallabletendswithR2RR$R(RRtvalue((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_equalSpellings (RRRRRRRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRs				tTestCallDeprecatedcBsbeZdZeddddZdZdZdZdZdZ	d	Z
d
ZRS(sQ
    Test use of the L{TestCase.callDeprecated} method with version objects.
    tTwistediicCs3|j|jtd|j|jgddS(sj
        callDeprecated calls a deprecated callable, suppressing the
        deprecation warning.
        RAsNo warnings should be shownN(tcallDeprecatedtversiont	oldMethodR$R(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt$test_callDeprecatedSuppressesWarningscCs,|j|jtd}|jd|dS(sn
        L{callDeprecated} actually calls the callable passed to it, and
        forwards the result.
        RAN(RRRR$(RR)((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt test_callDeprecatedCallsFunctionscCsHd}|j|j|j|j|}|jd|t|dS(sd
        L{callDeprecated} raises a test failure if the callable is not
        deprecated.
        cSsdS(N((((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt
notDeprecatedss%r is not deprecated.N(RDRRRR$R(RRRE((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_failsWithoutDeprecations	cCsutdddd}|j|j|j|td}|jt|jt||jt|t|dS(s
        callDeprecated raises a test failure if the callable was deprecated
        at a different version to the one expected.
        tFooiiiRAN(	RRDRRRRyRRR(RtdifferentVersionRE((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt"test_failsWithIncorrectDeprecationscCsitdddd}d}t||}|j||d|j}|jt|ddS(s:
        L{callDeprecated} ignores all deprecations apart from the first.

        Multiple warnings are generated when a deprecated function calls
        another deprecated function. The first warning is the one generated by
        the explicitly called function. That's the warning that we care about.
        RiiicWs
t|S(N(R(targs((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pytnestedDeprecationsiN(RRRRR$R&(RRRt
warningsShown((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_nestedDeprecations	cCs |j|jdftddS(sj
        L{callDeprecated} can take a message argument used to check the warning
        emitted.
        t	newMethodiN(RRtoldMethodReplaced(R((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyttest_callDeprecationWithMessage
scCsc|j|j|j|jdftd}|jt|jt||jdt|dS(s|
        If the message passed to L{callDeprecated} doesn't match,
        L{callDeprecated} raises a test failure.
        ssomething.wrongisplease use newMethod insteadN(RDRRRRRyRR(RRE((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt$test_callDeprecationWithWrongMessages(RRRRRRRRRRRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyRs	
							cCs|S(s(
    Deprecated method for testing.
    ((R6((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR#streplacementRcCsd|S(sh
    Another deprecated method, which has been deprecated in favor of the
    mythical 'newMethod'.
    i((R6((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyR+s(RRtpprintRttwisted.pythonRRttwisted.python.deprecateRRttwisted.python.versionsRttwisted.internetRt
twisted.trialRRR	RR
RRRRRRR(((sF/usr/lib/python2.7/dist-packages/twisted/trial/test/test_assertions.pyt<module>s
q0f