Ϫfe dZddlZddlmZddlmZGddej ZGddZGd d ej Z y) z Sample test cases defined using the standard library L{unittest.TestCase} class which are used as data by test cases which are actually part of the trial test suite to verify handling of handling of such cases. N)exc_info)FailurecNeZdZdZdZdZejddZy) PyUnitTestcy)z! A passing test. Nselfs @/usr/lib/python3/dist-packages/twisted/trial/test/pyunitcases.py test_passzPyUnitTest.test_passctd)zE A test which raises an exception to cause an error. z pyunit error) Exceptionr s r test_errorzPyUnitTest.test_errors''rc&|jdy)zQ A test which uses L{unittest.TestCase.fail} to cause a failure. zpyunit failureN)failr s r test_failzPyUnitTest.test_fails "#rz pyunit skipcy)zS A test which uses the L{unittest.skip} decorator to cause a skip. Nrr s r test_skipzPyUnitTest.test_skip"r rN) __name__ __module__ __qualname__r rrunittestskiprrrr rrs0 ( $ X]]=! " rrceZdZdZdefdZy) _NonStringIdz A class that looks a little like a TestCase, but not enough so to actually be used as one. This helps L{BrokenRunInfrastructure} use some interfaces incorrectly to provoke certain failure conditions. returnctS)N)objectr s r idz_NonStringId.id0s xrN)rrr__doc__r r!rrr rr)s Frrc:eZdZdZdZdZdZdZdZdZ dZ y ) BrokenRunInfrastructurezu A test suite that is broken at the level of integration between L{TestCase.run} and the results object. c:t||j|S)z Override the normal C{run} behavior to pass the result object along to the test method. Each test method needs the result object so that it can implement its particular kind of brokenness. )getattr_testMethodNamer results r runzBrokenRunInfrastructure.run:s 3wtT1126::rc6|jty)zA Violate the L{TestResult.addSuccess} interface. N) addSuccessrr(s r test_addSuccessz'BrokenRunInfrastructure.test_addSuccessBs ,.)rc td#t$r t}YnwxYw|jt |y)z? Violate the L{TestResult.addError} interface. test_addErrorN)r BaseExceptionraddErrorrr r)errs r r/z%BrokenRunInfrastructure.test_addErrorIs: O, , *C   , ##c td#t$r t}YnwxYw|jt |y)zA Violate the L{TestResult.addFailure} interface. test_addFailureN)rr0r addFailurerr2s r r6z'BrokenRunInfrastructure.test_addFailureTs= -. . *C  ,.#.r4c8|jtdy)z> Violate the L{TestResult.addSkip} interface. test_addSkipN)addSkiprr(s r r9z$BrokenRunInfrastructure.test_addSkip_s |~~6rc td#t$r t}YnwxYw|jt |y)zI Violate the L{TestResult.addExpectedFailure} interface. test_addExpectedFailureN)rr0raddExpectedFailurerr2s r r<z/BrokenRunInfrastructure.test_addExpectedFailurees; 56 6 )C !!,.#6r4c6|jty)zK Violate the L{TestResult.addUnexpectedSuccess} interface. N)addUnexpectedSuccessrr(s r test_addUnexpectedSuccessz1BrokenRunInfrastructure.test_addUnexpectedSuccessos ##LN3rN) rrrr"r*r-r/r6r9r<r@rrr r$r$4s* ;* - /7 74rr$) r"rsysrtwisted.python.failurerTestCaserrr$rrr rDsC * "" 2?4h//?4r