+
    Dfj                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHt ^ RIHtHt  ! R	 R
]4      t ! R R]4      tR# )    )annotationsN)skipIf)implementer)Failure)	IReporter	ITestCase)pyunitcases)PyUnitResultAdapterSynchronousTestCasec                  .    ] tR t^tR R ltR R ltRtR# )PyUnitTestTestsc                   V ^8  d   QhRR/#    returnNone )formats   "F/usr/lib/python3/dist-packages/twisted/trial/test/test_pyunitcompat.py__annotate__PyUnitTestTests.__annotate__   s     - -t -    c                	p    \         P                  ! R 4      V n        \        V P                  4      V n        R# )	test_passN)r	   
PyUnitTestoriginalr   testselfs   &r   setUpPyUnitTestTests.setUp   s$    #..{;dmm,	r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     P Pt Pr   c                l    V P                  \        V P                  4      V P                  : R24       R# )zG
Tests must be callable in order to be used with Python's unittest.py.
z is not callable.N)
assertTruecallabler   r   s   &r   test_callablePyUnitTestTests.test_callable   s'     	+		}<M-NOr   )r   r   N)__name__
__module____qualname____firstlineno__r    r&   __static_attributes__r   r   r   r   r      s    -P Pr   r   c                      ] tR t^tRt ! R R]4      tR R ltR R ltR R	 lt	R
 R lt
R R ltR R ltR R ltR R ltR R ltR R ltRtR# )PyUnitResultTestsz
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.
c                  *    ] tR t^'tRtRtR R ltRtR# )PyUnitResultTests.ErrorTestz
A test case which has a L{test_foo} which will raise an error.

@ivar ran: boolean indicating whether L{test_foo} has been run.
Fc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   (PyUnitResultTests.ErrorTest.__annotate__0   s     	 	d 	r   c                &    RV n         ^^ ,           R# )z:
Set C{self.ran} to True and raise a C{ZeroDivisionError}
TNranr   s   &r   test_foo$PyUnitResultTests.ErrorTest.test_foo0   s     DHEEr   r4   N)r(   r)   r*   r+   __doc__r5   r6   r,   r   r   r   	ErrorTestr0   '   s    	 	 	r   r9   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   PyUnitResultTests.__annotate__7   s     &9 &9$ &9r   c                    \        \        4       ! R R4      4       pV P                  R4      pV! 4       pVP                  V4       V P	                  VP
                  ^ ,          \        4       R# )zk
The L{PyUnitResultAdapter} is only used when the result passed to
C{run} does *not* provide L{IReporter}.
c                  J    ] tR t^=tRtR R ltR R ltR R ltR R	 ltR
t	R# )XPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporterz
A reporter which records data about calls made to it.

@ivar errors: Errors passed to L{addError}.
@ivar failures: Failures passed to L{addFailure}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   ePyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.__annotate__F   s     / /$ /r   c                	"    . V n         . V n        R # )Nerrorsfailuresr   s   &r   __init__aPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.__init__F   s    -/,.r   c                    V ^8  d   QhRRRR/# r   r   objectr   r   r   )r   s   "r   r   r@   J   s      f  r   c                    R# z
Do nothing.
Nr   r   r   s   &&r   	startTestbPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.startTestJ       r   c                    V ^8  d   QhRRRR/# rH   r   )r   s   "r   r   r@   O   s      V  r   c                    R# rK   r   rL   s   &&r   stopTestaPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.stopTestO   rO   r   c               $    V ^8  d   QhRRRRRR/# )r   r   rI   errorr   r   r   r   )r   s   "r   r   r@   T   s!     * *V *G * *r   c                <    V P                   P                  V4       R# )z
Record the error.
N)rC   append)r   r   rU   s   &&&r   addErroraPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.addErrorT   s     ""5)r   rB   N)
r(   r)   r*   r+   r8   rE   rM   rR   rX   r,   r   r   r   StubReporterr>   =   s     /

* *r   rZ   r6   N)r   r   r9   runassertIsInstancerC   r   )r   rZ   r   results   &   r   0test_dontUseAdapterWhenReporterProvidesIReporterBPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter7   s\     
Y		* 	* 
 	*8 ~~j)fmmA.8r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;   _   s     0 0d 0r   c                	,    ! R  R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  4       V P                  ^VP                  4       V P	                  VP                  4       4       R# )c                  &    ] tR t^`tRtR R ltRtR# )3PyUnitResultTests.test_success.<locals>.SuccessTestFc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   @PyUnitResultTests.test_success.<locals>.SuccessTest.__annotate__c         t r   c                	    R V n         R# TNr4   ss   &r   r6   <PyUnitResultTests.test_success.<locals>.SuccessTest.test_fooc   	    r   r   Nr(   r)   r*   r+   r5   r6   r,   r   r   r   SuccessTestrc   `   s    C r   rn   r6   N)	r   pyunit
TestResultr[   r$   r5   assertEqualtestsRunwasSuccessful)r   rn   r   r]   s   &   r   test_successPyUnitResultTests.test_success_   sn    	- 	 :&""$!FOO,,,./r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;   n   s     1 1d 1r   c                	v    ! R  R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  4       V P                  ^VP                  4       V P                  ^\        VP                  4      4       V P                  VP                  4       4       R# )c                  &    ] tR t^otRtR R ltRtR# )3PyUnitResultTests.test_failure.<locals>.FailureTestFc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   @PyUnitResultTests.test_failure.<locals>.FailureTest.__annotate__r   s        t  r   c                	6    R V n         V P                  R4       R# )Tzboom!N)r5   failri   s   &r   r6   <PyUnitResultTests.test_failure.<locals>.FailureTest.test_foor   s    wr   r   Nrm   r   r   r   FailureTestry   o   s    C   r   r   r6   N)r   ro   rp   r[   r$   r5   rq   rr   lenrD   assertFalsers   )r   r   r   r]   s   &   r   test_failurePyUnitResultTests.test_failuren   s    	 - 	  :&""$!FOO,C01--/0r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     1 1D 1r   c                	j   V P                  R 4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  4       V P                  ^VP                  4       V P                  ^\        VP                  4      4       V P                  VP                  4       4       R# )r6   N)r9   ro   rp   r[   r$   r5   rq   rr   r   rC   r   rs   )r   r   r]   s   &  r   
test_errorPyUnitResultTests.test_error   s~    ~~j)""$!FOO,C./--/0r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     1 1 1r   c                	v    ! R  R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  4       V P                  ^VP                  4       V P                  ^\        VP                  4      4       V P	                  VP                  4       4       R# )c                  2    ] tR t^tRtR R ltR R ltRtR# )4PyUnitResultTests.test_setUpError.<locals>.ErrorTestFc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   APyUnitResultTests.test_setUpError.<locals>.ErrorTest.__annotate__   s      t r   c                	    ^^ ,           R#    Nr   r   s   &r   r    :PyUnitResultTests.test_setUpError.<locals>.ErrorTest.setUp   s    Ar   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      rf   r   c                	    R V n         R# rh   r4   ri   s   &r   r6   =PyUnitResultTests.test_setUpError.<locals>.ErrorTest.test_foo   rl   r   r   N)r(   r)   r*   r+   r5   r    r6   r,   r   r   r   r9   r      s    C r   r9   r6   N)r   ro   rp   r[   r   r5   rq   rr   r   rC   rs   )r   r9   r   r]   s   &   r   test_setUpError!PyUnitResultTests.test_setUpError   s    	+ 	 $""$"FOO,C./--/0r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     
 
4 
r   c           	     t    ^^ ,           \        P
                  ! 4       p\        V4      pVP                  V X4       V P                  VP                  ^ ,          ^,          RP                  \        P                  ! X!  4      4       R#   \          d#    \        P                  ! 4       p\        4       p Li ; i)zy
Errors added through the L{PyUnitResultAdapter} have the same traceback
information as if there were no adapter at all.
 N)ZeroDivisionErrorsysexc_infor   ro   rp   r
   rX   rq   rC   join	tracebackformat_exception)r   r   fpyresultr]   s   &    r   test_tracebackFromFailure+PyUnitResultTests.test_tracebackFromFailure   s    
	E $$&$X.a OOAq!2779+E+Ex+P#Q	
 ! 	||~H	A	s   	B
 
*B76B7c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     
 
 
r   c                    ! R R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       VP                  f   Q hRP                  \        P                  ! VP                  ^,          4      4      pRP                  VP                  ^ ,          ^,          P                  4       RR 4      pV P                  VP                  4       V\        V4      ) R P                  4       4       R# )z7
As test_tracebackFromFailure, but covering more code.
c                  &    ] tR t^tRtR R ltRtR# )3PyUnitResultTests.test_traceback.<locals>.ErrorTestNc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   @PyUnitResultTests.test_traceback.<locals>.ErrorTest.__annotate__   s      $ r   c                	n     ^^ ,           R#   \          d    \        P                  ! 4       T n        h i ; ir   )r   r   r   r   s   &r   r6   <PyUnitResultTests.test_traceback.<locals>.ErrorTest.test_foo   s/    EE( $'LLNDMs   	 '4)r   )r(   r)   r*   r+   r   r6   r,   r   r   r   r9   r      s    H r   r9   r6   Nr   
)r   ro   rp   r[   r   r   r   	format_tbrC   
splitlinesrq   stripr   )r   r9   r   r]   expected_stackobserved_stacks   &     r   test_traceback PyUnitResultTests.test_traceback   s    
	+ 	 $""$ }}(((!4!4T]]15E!FG6==#3A#6#A#A#CCR#HI  "NC4G3G3I$J$P$P$R	
r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     
 
 
r   c                    ^^ ,           XP	                  4        \
        P                  ! 4       p\        V4      pVP                  W4       RP                  \        P                  ! X!  4      pV P                  VP                  ^ ,          ^,          P                  R4      VP                  R4      4       R#   \          d#    \        P                  ! 4       p\        4       p Li ; i)z
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.
r   z$ZeroDivisionError: division by zero
N)r   r   r   r   cleanFailurero   rp   r
   rX   r   r   r   rq   rC   endswith)r   r   r   r   r]   tbacks   &     r   test_tracebackFromCleanFailure0PyUnitResultTests.test_tracebackFromCleanFailure   s    	E 	
$$&$X. 	22H=>OOAq!**+RSNNBC	
 ! 	||~H	A	s   	B9 9*C&%C&c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     B B Br   c                     ! R R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  VR3.4       R# )z_
Skips using trial's skipping functionality are reported as skips in
the L{pyunit.TestResult}.
c                  :    ] tR t^t]! RR4      R R l4       tRtR# )2PyUnitResultTests.test_trialSkip.<locals>.SkipTestTLet's skip!c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   ?PyUnitResultTests.test_trialSkip.<locals>.SkipTest.__annotate__         4 r   c                	    ^^ ,           R# r   r   r   s   &r   	test_skip<PyUnitResultTests.test_trialSkip.<locals>.SkipTest.test_skip       Ar   r   N)r(   r)   r*   r+   r   r   r,   r   r   r   SkipTestr      s    D-( )r   r   r   r   Nr   ro   rp   r[   rq   skippedr   r   r   r]   s   &   r   test_trialSkip PyUnitResultTests.test_trialSkip   sQ    	* 	
 $""$4*?)@Ar   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r;      s     = = =r   c                     ! R R\         4      pV! R4      p\        P                  ! 4       pVP                  V4       V P	                  VP
                  VR3.4       R# )z`
Skips using pyunit's skipping functionality are reported as skips in
the L{pyunit.TestResult}.
c                  L    ] tR t^t]P
                  ! R4      R R l4       tRtR# )3PyUnitResultTests.test_pyunitSkip.<locals>.SkipTestskippyc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   @PyUnitResultTests.test_pyunitSkip.<locals>.SkipTest.__annotate__   r   r   c                	    ^^ ,           R# r   r   r   s   &r   r   =PyUnitResultTests.test_pyunitSkip.<locals>.SkipTest.test_skip   r   r   r   N)r(   r)   r*   r+   ro   skipr   r,   r   r   r   r   r      s    [[" #r   r   r   r   Nr   r   s   &   r   test_pyunitSkip!PyUnitResultTests.test_pyunitSkip   sQ    	* 	
 $""$4*:);<r   r   N)r(   r)   r*   r+   r8   r   r9   r^   rt   r   r   r   r   r   r   r   r   r,   r   r   r   r.   r.      sN    '  &9P01"11&
"
B
*B = =r   r.   )
__future__r   r   r   unittestro   r   zope.interfacer   twisted.python.failurer   twisted.trial.itrialr   r   twisted.trial.testr	   twisted.trial.unittestr
   r   r   r.   r   r   r   <module>r      sC    # 
    & * 5 * K	P) 	Pc=+ c=r   