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_pyunitcompat.pyc


[XMc@sddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZddl
mZmZddlmZed	Zd
efdYZdefd
YZdS(iN(t
implements(treflect(tFailure(tutil(tTestCasetPyUnitResultAdapter(t	IReportert	ITestCase(t	erroneoustunittesttTestPyUnitTestCasecBsZeZdejfdYZdZdZejde	ddge_dZ
RS(t
PyUnitTestcBseZdZRS(cCsdS(N((tself((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt	test_passs(t__name__t
__module__R
(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyRscCs(|jd|_t|j|_dS(NR
(RtoriginalRttest(R((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pytsetUpscs?gfd}|jj||j|jgdS(sB
        Trial assumes that test cases implement visit().
        csj|dS(N(tappend(R(tlog(sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pytvisitor(sN(RtvisittassertEqual(RR((RsH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt
test_visit#stcategorytmessages'Test visitors deprecated in Twisted 8.0cCs'|jt|jd|jfdS(sW
        Tests must be callable in order to be used with Python's unittest.py.
        s%r is not callable.N(t
assertTruetcallableR(R((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt
test_callable1s(RRtpyunitRRRRRtsuppresstDeprecationWarningR(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR
s		
tTestPyUnitResultcBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	s
    Tests to show that PyUnitResultAdapter wraps TestResult objects from the
    standard library 'unittest' module in such a way as to make them usable and
    useful from Trial.
    cCsVdtfdY}tjd}|}|j||j|jdtdS(s
        The L{PyUnitResultAdapter} is only used when the result passed to
        C{run} does *not* provide L{IReporter}.
        tStubReportercBs<eZdZeedZdZdZdZRS(s
            A reporter which records data about calls made to it.

            @ivar errors: Errors passed to L{addError}.
            @ivar failures: Failures passed to L{addFailure}.
            cSsg|_g|_dS(N(terrorstfailures(R((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt__init__Os	cSsdS(s-
                Do nothing.
                N((RR((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt	startTestSscSsdS(s-
                Do nothing.
                N((RR((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pytstopTestXscSs|jj|dS(s3
                Record the error.
                N(R#R(RRterror((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pytaddError]s(	RRt__doc__RRR%R&R'R)(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR"Es
			ttest_fooiN(tobjectRt	ErrorTesttruntassertIsInstanceR#R(RR"Rtresult((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt0test_dontUseAdapterWhenReporterProvidesIReporter@s
	
cCsudtfdY}|d}tj}|j||j|j|jd|j|j|jdS(NtSuccessTestcBseZeZdZRS(cSs
t|_dS(N(tTruetran(ts((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR+ls(RRtFalseR4R+(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR2jsR+i(	RRt
TestResultR.t
failUnlessR4RttestsRunt
wasSuccessful(RR2RR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_successis
cCsdtfdY}|d}tj}|j||j|j|jd|j|jdt|j	|j
|jdS(NtFailureTestcBseZeZdZRS(cSst|_|jddS(Nsboom!(R3R4tfail(R5((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR+ys	(RRR6R4R+(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR<wsR+i(RRR7R.R8R4RR9tlenR$tfailIfR:(RR<RR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_failurevs
cCs{tjd}tj}|j||j|j|jd|j|jdt	|j
|j|jdS(NR+i(
RR-RR7R.R8R4RR9R>R#R?R:(RRR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt
test_errors
cCsdtfdY}|d}tj}|j||j|j|jd|j|jdt|j	|j|j
dS(NR-cBs eZeZdZdZRS(cSsdddS(Nii((R((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyRscSs
t|_dS(N(R3R4(R5((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR+s(RRR6R4RR+(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR-s	R+i(RRR7R.R?R4RR9R>R#R:(RR-RR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_setUpErrors
cCsyddWn&tk
r4tj}t}nXtj}t|}|j|||j|j	dddj
tj|dS(s
        Errors added through the L{PyUnitResultAdapter} have the same traceback
        information as if there were no adapter at all.
        iitN(
tZeroDivisionErrortsystexc_infoRRR7RR)RR#tjoint	tracebacktformat_exception(RRFtftpyresultR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_tracebackFromFailures

cCsdtfdY}|d}tj}|j|djtj|jd}dj|jddj	d	 }|j
|j|t|jd
S(sG
        As test_tracebackFromFailure, but covering more code.
        R-cBseZdZdZRS(cSs6yddWn#tk
r1tj|_nXdS(Nii(RDRERF(R((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR+s

N(RRtNoneRFR+(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR-sR+RCis
iiiN(
RRR7R.RGRHt	format_tbRFR#t
splitlinesRtstripR>(RR-RR0texpected_stacktobserved_stack((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_tracebacks
	$cCsyddWn&tk
r4tj}t}nX|jtj}t|}|j|||j	|j
dddjtj
|dS(s
        Errors added through the L{PyUnitResultAdapter} have the same
        traceback information as if there were no adapter at all, even
        if the Failure that held the information has been cleaned.
        iiRCN(RDRERFRtcleanFailureRR7RR)RR#RGRHRI(RRFRJRKR0((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyttest_tracebackFromCleanFailures


(RRR*R1R;R@RARBRLRSRU(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyR!9s	)	
		
			(RERHtzope.interfaceRttwisted.pythonRttwisted.python.failureRt
twisted.trialRttwisted.trial.unittestRRttwisted.trial.itrialRRttwisted.trial.testRt
__import__RR
R!(((sH/usr/lib/python2.7/dist-packages/twisted/trial/test/test_pyunitcompat.pyt<module>s#