Ϫf ^dZddlZddlmZddlmZddlmZGddejZ y)zL Tests for async assertions provided by C{twisted.trial.unittest.TestCase}. N)defer)failure)unittestc4eZdZdZdZdZdZdZdZdZ y) AsynchronousAssertionsTestszp Tests for L{TestCase}'s asynchronous extensions to L{SynchronousTestCase}. That is, assertFailure. cZtjd}|j|tS)Nc ddz SNrr I/usr/lib/python3/dist-packages/twisted/trial/test/test_asyncassertions.pyz@AsynchronousAssertionsTests.test_assertFailure.. Ar )r maybeDeferred assertFailureZeroDivisionErrorselfds rtest_assertFailurez.AsynchronousAssertionsTests.test_assertFailures&    .!!!%677r ctjd}j|t|j fdfd|S)Nc ddz Sr r r r rrzOAsynchronousAssertionsTests.test_assertFailure_wrongException..rr c&jdSNzShould have failedfailxrs rrzOAsynchronousAssertionsTests.test_assertFailure_wrongException..dii 45r c:|jjSNtrapfailureExceptionrs rrzOAsynchronousAssertionsTests.test_assertFailure_wrongException..affT223r )rrr OverflowError addCallbacksrs` r!test_assertFailure_wrongExceptionz=AsynchronousAssertionsTests.test_assertFailure_wrongExceptions<    . 1m,  5 3 r ctjd}j|t|j fdfd|S)Nc&jdSrrrs rrzLAsynchronousAssertionsTests.test_assertFailure_noException..'r r c:|jjSr"r#rs rrzLAsynchronousAssertionsTests.test_assertFailure_noException..(r&r )rsucceedrrr(rs` rtest_assertFailure_noExceptionz:AsynchronousAssertionsTests.test_assertFailure_noException#s; MM$  1/0  5 3 r c ddz |j t }|j|j|S#t$r,tj}tj|}YhwxYw)z In the case of assertFailure failing, check that we get lots of information about the exception that was raised. r r) rrFailurerrr RuntimeError addErrback _checkInfo)rfrs rtest_assertFailure_moreInfoz7AsynchronousAssertionsTests.test_assertFailure_moreInfo,sc   E   q, / T__a( ! !A 1 A s;2A0/A0c|j|jsJ|j}|j|j||j|j |yr")checkr%getErrorMessageassertIngetBriefTraceback)rassertionFailurer4outputs rr3z&AsynchronousAssertionsTests._checkInfo:sX%%d&;&;<<<!113 a'')62 a))+V4r cGddtGfddtj}|d}tj}|j ||j dt|jy)zJ A single wrong assertFailure should fail the whole test. c eZdZy)MAsynchronousAssertionsTests.test_assertFailure_masked..ExampleFailureN)__name__ __module__ __qualname__r r rExampleFailurer?Es r rCceZdZWZdZy)AAsynchronousAssertionsTests.test_assertFailure_masked..TCctjd}|j|t|j|t|S)Nc ddz Sr r r r rrzfAsynchronousAssertionsTests.test_assertFailure_masked..TC.test_assertFailure..Ls Ar )rrrr'rrs rrzTAsynchronousAssertionsTests.test_assertFailure_masked..TC.test_assertFailureKs8'' 6""1m4""1&78r N)r@rArBr%r)rCsrTCrEHs-  r rHrr N) ExceptionrTestCasepyunit TestResultrun assertEquallenfailures)rrHtestresultrCs @rtest_assertFailure_maskedz5AsynchronousAssertionsTests.test_assertFailure_masked@sa  Y  "" &'""$  C01r N) r@rArB__doc__rr)r.r5r3rSr r rrrs% 8 5 2r r) rTrrKtwisted.internetrtwisted.pythonr twisted.trialrJrr r rrXs, """D2("3"3D2r