+
    DfjM                        R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIHtHtHtHt ^ RIHtHtHt ^ RIHt ^ R	IHt  ! R
 R4      t ! R R4      t ! R R]]P:                  4      t ! R R]]P>                  4      t  ! R R]4      t! ! R R]!]P:                  4      t" ! R R]!]P>                  4      t# ! R R]4      t$ ! R R]$]P:                  4      t% ! R R]$]P>                  4      t& ! R R]4      t' ! R  R!]']P:                  4      t( ! R" R#]']P>                  4      t) ! R$ R%]4      t* ! R& R']*]P:                  4      t+ ! R( R)]*]P>                  4      t, ! R* R+]4      t- ! R, R-]-]P:                  4      t. ! R. R/]-]P>                  4      t/ ! R0 R1]P:                  4      t0 ! R2 R34      t1 ! R4 R5]1]P:                  4      t2 ! R6 R7]1]P>                  4      t3 ! R8 R9]]P>                  4      t4 ! R: R;4      t5 ! R< R=]5]P:                  4      t6 ! R> R?]5]P:                  4      t7 ! R@ RA]P:                  4      t8 ! RB RC4      t9 ! RD RE]9]P:                  4      t: ! RF RG]9]P>                  4      t; ! RH RI4      t< ! RJ RK]<]P:                  4      t= ! RL RM]<]P>                  4      t> ! RN RO4      t? ! RP RQ]?]P:                  4      t@ ! RR RS]?]P>                  4      tA ! RT RU4      tB ! RV RW]B]P:                  4      tC ! RX RY]B]P>                  4      tD ! RZ R[4      tE ! R\ R]]E]P:                  4      tF ! R^ R_]E]P>                  4      tG ! R` Ra]P:                  4      tHR# )ba  
Tests for the behaviour of unit tests.

Many tests in this module follow a simple pattern.  A mixin is defined which
includes test methods for a certain feature.  The mixin is inherited from twice,
once by a class also inheriting from SynchronousTestCase and once from a class
inheriting from TestCase.  These two subclasses are named like
I{SynchronousFooTests} and I{AsynchronousFooTests}, where I{Foo} is related to
the name of the mixin.  Sometimes the mixin is defined in another module, along
with the synchronous subclass.  The mixin is imported into this module to define
the asynchronous subclass.

This pattern allows the same tests to be applied to the two base test case
classes trial provides, ensuring their behavior is the same.

Most new tests should be added in this pattern.  Tests for functionality which
is intentionally only provided by TestCase, not SynchronousTestCase, is excepted
of course.
N)StringIO)deferreactor)_PYPY)namedAny)reporterrunnerunittestutil)_clearSuite _ForceGarbageCollectionDecorator_iterateTests)	erroneous)SuppressionMixinc                   6   a  ] tR t^,t o RtR tR tR tRtV t	R# )ResultsTestMixinz?
Provide useful APIs for test cases that are about test cases.
c                    \         P                  ! 4       V n        V P                  P                  V4      V n        \
        P                  ! 4       V n        R# )z\
Load tests from the given test case class and create a new reporter to
use for running it.
N)pyunit
TestLoaderloaderloadTestsFromTestCasesuiter   
TestResultselfr   s   &&?/usr/lib/python3/dist-packages/twisted/trial/test/test_tests.py	loadSuiteResultsTestMixin.loadSuite1   s:    
 '')[[66u=
 ++-    c                <   V P                  V P                  P                  4       4       V P                  V P                  P                  . 4       V P                  V P                  P
                  . 4       V P                  V P                  P                  . 4       R# )z
test the setup
N)
assertTruer   wasSuccessfulassertEqualerrorsfailuresskipsr   s   &r   
test_setUpResultsTestMixin.test_setUp:   sk     	3356--r2//4,,b1r   c                    V P                  V P                  P                  4       V4       V P                  V P                  4       V P                  V P                  P                  V4       R# )z*
Asserts that the test count is plausible
N)r"   r   countTestCasesr   testsRun)r   numTestss   &&r   assertCountResultsTestMixin.assertCountC   sK     	224h?

4==!//:r   )r   r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r'   r-   __static_attributes____classdictcell____classdict__s   @r   r   r   ,   s     .2; ;r   r   c                   H   a  ] tR t^Lt o RtR tR tR tR tR t	R t
RtV tR	# )
SuccessMixinzT
Tests for the reporting of successful tests in L{twisted.trial.unittest.TestCase}.
c                :    \         P                  ! 4       V n        R# 
Setup our test case
N)r   r   resultr&   s   &r   setUpSuccessMixin.setUpQ   s     ))+r   c                    R# )z)
A successful test, used by other tests.
N r&   s   &r   test_successfulSuccessMixin.test_successfulW   s    r   c                V   V P                  VP                  ^4       V P                  VP                  . 4       V P                  VP                  . 4       V P                  VP                  . 4       V P                  VP
                  . 4       V P                  VP                  . 4       R# )zL
Utility function -- assert there is one success and the state is
plausible
N)r"   	successesr$   r#   expectedFailuresunexpectedSuccessesr%   r   testr=   s   &&&r   assertSuccessfulSuccessMixin.assertSuccessful\   s    
 	))1-"-+00"533R8r*r   c                    V P                  R4      pVP                  V P                  4       V P                  WP                  4       R# )zl
Test that when a successful test is run, it is reported as a success,
and not as any other kind of result.
rB   N	__class__runr=   rJ   r   rI   s   & r   test_successfulIsReported&SuccessMixin.test_successfulIsReportedh   s5    
 ~~/0dKK0r   c                    V P                  4       pVP                  V P                  4       V P                  WP                  4       R# )zb
The test case type can be instantiated with no arguments, run, and
reported as being successful.
NrM   rP   s   & r   test_defaultIsSuccessful%SuccessMixin.test_defaultIsSuccessfulq   s2    
 ~~dKK0r   c                   V P                  R4      p\        P                  ! V4      pVP                  V P                  4       V P                  WP                  4       ?\        P                  ! 4        V P                  V! 4       R4       R# )z6
Test that no reference is kept on a successful test.
rB   N)	rN   weakrefrefrO   r=   rJ   gccollectassertIdentical)r   rI   rX   s   &  r   test_noReferenceSuccessMixin.test_noReferencez   sa     ~~/0kk$dKK0


SUD)r   )r=   N)r/   r0   r1   r2   r3   r>   rB   rJ   rQ   rT   r\   r4   r5   r6   s   @r   r9   r9   L   s-     ,

+11
* 
*r   r9   c                       ] tR t^tRtRtR# )SynchronousSuccessTestsF
Tests for the reporting of successful tests in the synchronous case.
rA   Nr/   r0   r1   r2   r3   r4   rA   r   r   r_   r_          r   r_   c                       ] tR t^tRtRtR# )AsynchronousSuccessTestsr`   rA   Nra   rA   r   r   rd   rd      rb   r   rd   c                   H   a  ] tR t^t o RtR tR tR tR tR t	R t
RtV tR	# )
SkipMethodsMixinzR
Tests for the reporting of skipping tests in L{twisted.trial.unittest.TestCase}.
c                <    V P                  V P                  4       R# r;   )r   Skippingr&   s   &r   r>   SkipMethodsMixin.setUp   s     	t}}%r   c                (    V P                  ^4       R# )z$
Assert that there are three tests.
Nr-   r&   s   &r   test_countingSkipMethodsMixin.test_counting        	r   c                   V P                  V P                  4       V P                  V P                  P                  4       4       V P	                  V P                  P
                  . 4       V P	                  V P                  P                  . 4       V P	                  \        V P                  P                  4      ^4       V P	                  V P                  P                  ^ 4       R# )z
Running a suite in which all methods are individually set to skip
produces a successful result with no recorded errors or failures, all
the skipped methods recorded as skips, and no methods recorded as
successes.
N
r   r   r    r!   r"   r#   r$   lenr%   rE   r&   s   &r   test_resultsSkipMethodsMixin.test_results        	

4==!3356--r2//4T]]0011500!4r   c                   V P                  V P                  4       V P                  V P                  4       V P	                  V P                  P                  4       4       V P                  V P                  P                  . 4       V P                  V P                  P                  . 4       V P                  \        V P                  P                  4      ^4       V P                  V P                  P                  ^ 4       R# )z
Running a suite in which all methods are skipped by C{setUp} raising
L{SkipTest} produces a successful result with no recorded errors or
failures, all skipped methods recorded as skips, and no methods recorded
as successes.
N)r   SkippingSetUpr   r   r    r!   r"   r#   r$   rq   r%   rE   r&   s   &r   r'   SkipMethodsMixin.test_setUp   s     	t))*

4==!3356--r2//4T]]0011500!4r   c                    V P                  V P                  4       RpV P                  P                   F:  w  r#V P                  VP	                  4       \        V4      R \        V4      4       K<  	  R# )z
Test that reasons work
test_N)r   r   r%   r"   shortDescriptionrq   str)r   prefixrI   reasons   &   r   test_reasonsSkipMethodsMixin.test_reasons   sW     	

4==! MM//LDT224S[]CS[Q 0r   c                |   V P                  V P                  4       V P                  V P                  4       V P	                  V P                  P
                  .4      pV P                  ^\        V4      4       V P                  \        V^ ,          R,          4       V P                  RV^ ,          R,          4       R# )zW
If a test method raises L{SkipTest} with no reason, a deprecation
warning is emitted.
categoryzSDo not raise unittest.SkipTest with no arguments! Give a reason for skipping tests!messageN)	r   DeprecatedReasonlessSkipr   r   flushWarningstest_1r"   rq   DeprecationWarning)r   warningss   & r    test_deprecatedSkipWithoutReason1SkipMethodsMixin.test_deprecatedSkipWithoutReason   s    
 	t445

4==!%%t'D'D'K'K&LMCM*+Xa[-DE"QK	"	
r   rA   N)r/   r0   r1   r2   r3   r>   rl   rr   r'   r~   r   r4   r5   r6   s   @r   rf   rf      s.     &55R
 
r   rf   c                   J    ] tR t^tRt]! R4      t]! R4      t]! R4      tRt	R# )SynchronousSkipMethodTestsz|
Tests for the reporting of skipping tests in the synchronous case.

See: L{twisted.trial.test.test_tests.SkipMethodsMixin}
z/twisted.trial.test.skipping.SynchronousSkippingz4twisted.trial.test.skipping.SynchronousSkippingSetUpz?twisted.trial.test.skipping.SynchronousDeprecatedReasonlessSkiprA   N
r/   r0   r1   r2   r3   r   rh   rv   r   r4   rA   r   r   r   r      s-     IJHSTM'I r   r   c                   J    ] tR t^tRt]! R4      t]! R4      t]! R4      tRt	R# )AsynchronousSkipMethodTestsz}
Tests for the reporting of skipping tests in the asynchronous case.

See: L{twisted.trial.test.test_tests.SkipMethodsMixin}
z0twisted.trial.test.skipping.AsynchronousSkippingz5twisted.trial.test.skipping.AsynchronousSkippingSetUpz@twisted.trial.test.skipping.AsynchronousDeprecatedReasonlessSkiprA   Nr   rA   r   r   r   r      s-     JKHTUM'J r   r   c                   B   a  ] tR t^t o RtR tR tR tR tR t	Rt
V tR# )	SkipClassesMixinzI
Test the class skipping features of L{twisted.trial.unittest.TestCase}.
c                ^    V P                  V P                  4       RV P                  n        R# )r<   FN)r   SkippedClass	_setUpRanr&   s   &r   r>   SkipClassesMixin.setUp   s$     	t(()&+#r   c                (    V P                  ^4       R# )z@
Skipped test methods still contribute to the total test count.
Nrk   r&   s   &r   rl   SkipClassesMixin.test_counting  rn   r   c                    V P                  V P                  4       V P                  V P                  P                  4       R# )z@
The C{setUp} method is not called if the class is set to skip.
N)r   r   assertFalser   r   r&   s   &r   test_setUpRanSkipClassesMixin.test_setUpRan
  s.     	

4==!**445r   c                   V P                  V P                  4       V P                  V P                  P                  4       4       V P	                  V P                  P
                  . 4       V P	                  V P                  P                  . 4       V P	                  \        V P                  P                  4      ^4       V P	                  V P                  P                  ^ 4       R# )z
Skipped test methods don't cause C{wasSuccessful} to return C{False},
nor do they contribute to the C{errors} or C{failures} of the reporter,
or to the count of successes.  They do, however, add elements to the
reporter's C{skips} list.
Nrp   r&   s   &r   rr   SkipClassesMixin.test_results  rt   r   c                    V P                  V P                  4       . ROpV P                  P                   UUu. uF  w  r#VNK	  	  pppV P                  W4       R# u uppi )zm
Test methods which raise L{unittest.SkipTest} or have their C{skip}
attribute set to something are skipped.
N)classskip2r   r   )r   r   r%   r"   )r   expectedReasonsrI   r}   reasonsGivens   &    r   r~   SkipClassesMixin.test_reasons  sO    
 	

4==!>37==3F3FG3F<43FG7 Hs   ArA   N)r/   r0   r1   r2   r3   r>   rl   r   rr   r~   r4   r5   r6   s   @r   r   r      s(     ,65	8 	8r   r   c                   *    ] tR tRtRt]! R4      tRtR# )SynchronousSkipClassTestsi+  zs
Test the class skipping features in the synchronous case.

See: L{twisted.trial.test.test_tests.SkipClassesMixin}
z3twisted.trial.test.skipping.SynchronousSkippedClassrA   Nr/   r0   r1   r2   r3   r   r   r4   rA   r   r   r   r   +  s     QRLr   r   c                   *    ] tR tRtRt]! R4      tRtR# )AsynchronousSkipClassTestsi5  zt
Test the class skipping features in the asynchronous case.

See: L{twisted.trial.test.test_tests.SkipClassesMixin}
z4twisted.trial.test.skipping.AsynchronousSkippedClassrA   Nr   rA   r   r   r   r   5  s     RSLr   r   c                   N   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
tV tR# )	TodoMixini?  zj
Tests for the individual test method I{expected failure} features of
L{twisted.trial.unittest.TestCase}.
c                <    V P                  V P                  4       R# r;   )r   Todor&   s   &r   r>   TodoMixin.setUpE  s     	tyy!r   c                (    V P                  ^4       R# )z)
Ensure that we've got three test cases.
Nrk   r&   s   &r   rl   TodoMixin.test_countingK  rn   r   c                z   V P                  V P                  4       V P                  V P                  P                  4       4       V P	                  V P                  P
                  . 4       V P	                  V P                  P                  . 4       V P	                  V P                  P                  . 4       V P	                  \        V P                  P                  4      ^4       V P	                  \        V P                  P                  4      ^4       V P	                  V P                  P                  ^ 4       R# )a  
Running a suite in which all methods are individually marked as expected
to fail produces a successful result with no recorded errors, failures,
or skips, all methods which fail and were expected to fail recorded as
C{expectedFailures}, and all methods which pass but which were expected
to fail recorded as C{unexpectedSuccesses}.  Additionally, no tests are
recorded as successes.
Nr   r   r    r!   r"   r#   r$   r%   rq   rF   rG   rE   r&   s   &r   rr   TodoMixin.test_resultsQ       	

4==!3356--r2//4,,b1T]];;<a@T]]>>?C00!4r   c                    V P                  V P                  4       RR.pV P                  P                   UUUu. uF  w  r#qDP                  NK  	  ppppV P	                  W4       R# u upppi )5
Ensure that expected failures are handled properly.
todo1todo2Nr   r   rF   r}   r"   r   r   terr   s   &     r   test_expectedFailuresTodoMixin.test_expectedFailuresc  sX     	

4==!"G,040N0NO0NWQ10NO7 P   A(c                    V P                  V P                  4       R.pV P                  P                   UUu. uF  w  r#VP                  NK  	  pppV P	                  W4       R# u uppi ).
Ensure that unexpected successes are caught.
todo3Nr   r   rG   r}   r"   r   r   r   r   r   s   &    r   test_unexpectedSuccesses"TodoMixin.test_unexpectedSuccessesl  sU     	

4==!")-1]]-N-NO-NTQ-NO7 Ps   A%c                   V P                  V P                  4       V P                  V P                  4       V P	                  V P                  P                  4       4       V P                  \        V P                  P                  4      ^4       V P                  V P                  P                  . 4       V P                  V P                  P                  . 4       V P                  \        V P                  P                  4      ^ 4       V P                  \        V P                  P                  4      ^ 4       V P                  V P                  P                  ^ 4       R# )zd
C{setUp} is excluded from the failure expectation defined by a C{todo}
attribute on a test method.
N)r   	SetUpTodor   r   r   r!   r"   rq   r#   r$   r%   rF   rG   rE   r&   s   &r   test_expectedSetUpFailure#TodoMixin.test_expectedSetUpFailureu  s    
 	t~~&

4==!4467T]]112A6//4,,b1T]];;<a@T]]>>?C00!4r   c                   V P                  V P                  4       V P                  V P                  4       V P	                  V P                  P                  4       4       V P                  \        V P                  P                  4      ^4       V P                  V P                  P                  . 4       V P                  V P                  P                  . 4       V P                  \        V P                  P                  4      ^ 4       V P                  \        V P                  P                  4      ^4       V P                  V P                  P                  ^ 4       R# )zg
C{tearDown} is excluded from the failure expectation defined by a C{todo}
attribute on a test method.
N)r   TearDownTodor   r   r   r!   r"   rq   r#   r$   r%   rF   rG   rE   r&   s   &r   test_expectedTearDownFailure&TodoMixin.test_expectedTearDownFailure  s    
 	t(()

4==!4467T]]112A6//4,,b1T]];;<a@ 	T]]>>?C00!4r   rA   N)r/   r0   r1   r2   r3   r>   rl   rr   r   r   r   r   r4   r5   r6   s   @r   r   r   ?  s2     
"5$8855 5r   r   c                   J    ] tR tRtRt]! R4      t]! R4      t]! R4      tRt	R# )SynchronousTodoTestsi  zl
Test the class skipping features in the synchronous case.

See: L{twisted.trial.test.test_tests.TodoMixin}
z+twisted.trial.test.skipping.SynchronousTodoz0twisted.trial.test.skipping.SynchronousSetUpTodoz3twisted.trial.test.skipping.SynchronousTearDownTodorA   N
r/   r0   r1   r2   r3   r   r   r   r   r4   rA   r   r   r   r     s*     ABDKLIQRLr   r   c                   J    ] tR tRtRt]! R4      t]! R4      t]! R4      tRt	R# )AsynchronousTodoTestsi  zm
Test the class skipping features in the asynchronous case.

See: L{twisted.trial.test.test_tests.TodoMixin}
z,twisted.trial.test.skipping.AsynchronousTodoz1twisted.trial.test.skipping.AsynchronousSetUpTodoz4twisted.trial.test.skipping.AsynchronousTearDownTodorA   Nr   rA   r   r   r   r     s*     BCDLMIRSLr   r   c                   B   a  ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
ClassTodoMixini  z^
Tests for the class-wide I{expected failure} features of
L{twisted.trial.unittest.TestCase}.
c                <    V P                  V P                  4       R# r;   )r   	TodoClassr&   s   &r   r>   ClassTodoMixin.setUp  s     	t~~&r   c                (    V P                  ^4       R# )z(
Ensure that we've got four test cases.
Nrk   r&   s   &r   rl   ClassTodoMixin.test_counting  rn   r   c                z   V P                  V P                  4       V P                  V P                  P                  4       4       V P	                  V P                  P
                  . 4       V P	                  V P                  P                  . 4       V P	                  V P                  P                  . 4       V P	                  \        V P                  P                  4      ^4       V P	                  \        V P                  P                  4      ^4       V P	                  V P                  P                  ^ 4       R# )av  
Running a suite in which an entire class is marked as expected to fail
produces a successful result with no recorded errors, failures, or
skips, all methods which fail and were expected to fail recorded as
C{expectedFailures}, and all methods which pass but which were expected
to fail recorded as C{unexpectedSuccesses}.  Additionally, no tests are
recorded as successes.
Nr   r&   s   &r   rr   ClassTodoMixin.test_results  r   r   c                    V P                  V P                  4       RR.pV P                  P                   UUUu. uF  w  r#qDP                  NK  	  ppppV P	                  W4       R# u upppi )r   methodr   Nr   r   s   &     r   r   $ClassTodoMixin.test_expectedFailures  sX     	

4==!#W-040N0NO0NWQ10NO7 Pr   c                    V P                  V P                  4       RR.pV P                  P                   UUu. uF  w  r#VP                  NK  	  pppV P	                  W4       R# u uppi )r   r   r   Nr   r   s   &    r   r   'ClassTodoMixin.test_unexpectedSuccesses  sX     	

4==!#W--1]]-N-NO-NTQ-NO7 Ps   A&rA   Nr/   r0   r1   r2   r3   r>   rl   rr   r   r   r4   r5   r6   s   @r   r   r     s(     
'5$88 8r   r   c                   *    ] tR tRtRt]! R4      tRtR# )SynchronousClassTodoTestsi  z
Tests for the class-wide I{expected failure} features in the synchronous case.

See: L{twisted.trial.test.test_tests.ClassTodoMixin}
z0twisted.trial.test.skipping.SynchronousTodoClassrA   Nr/   r0   r1   r2   r3   r   r   r4   rA   r   r   r   r     s     KLIr   r   c                   *    ] tR tRtRt]! R4      tRtR# )AsynchronousClassTodoTestsi  z
Tests for the class-wide I{expected failure} features in the asynchronous case.

See: L{twisted.trial.test.test_tests.ClassTodoMixin}
z1twisted.trial.test.skipping.AsynchronousTodoClassrA   Nr   rA   r   r   r   r     s     LMIr   r   c                   B   a  ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
StrictTodoMixini  z
Tests for the I{expected failure} features of
L{twisted.trial.unittest.TestCase} in which the exact failure which is
expected is indicated.
c                <    V P                  V P                  4       R# r;   )r   
StrictTodor&   s   &r   r>   StrictTodoMixin.setUp  s     	t'r   c                (    V P                  ^4       R# )z#
Assert there are seven test cases
Nrk   r&   s   &r   rl   StrictTodoMixin.test_counting  rn   r   c                   V P                  V P                  4       V P                  V P                  P                  4       4       V P	                  \        V P                  P                  4      ^4       V P	                  \        V P                  P                  4      ^4       V P	                  \        V P                  P                  4      ^4       V P	                  \        V P                  P                  4      ^4       V P	                  V P                  P                  ^ 4       V P	                  V P                  P                  . 4       R# )z
A test method which is marked as expected to fail with a particular
exception is only counted as an expected failure if it does fail with
that exception, not if it fails with some other exception.
N)r   r   r   r!   r"   rq   r#   r$   rF   rG   rE   r%   r&   s   &r   rr   StrictTodoMixin.test_results  s     	

4==!4467T]]112A6T]]334a8T]];;<a@T]]>>?C00!4,,b1r   c                    V P                  V P                  4       . ROpV P                  P                   UUUu. uF  w  r#qDP                  NK  	  ppppV P	                  W4       R# u upppi )r   N)r   r   todo5r   )r   r   r   r   r   reasonsGottens   &     r   r   %StrictTodoMixin.test_expectedFailures  sS     	

4==!5151O1OP1OgaA1OP8 Qr   c                    V P                  V P                  4       \        .R3.pV P                  P                   UUu. uF  w  r#VP                  VP
                  3NK  	  pppV P                  W4       R# u uppi )r   todo7N)r   r   RuntimeErrorrG   r#   r}   r"   )r   r   r   r   r   s   &    r   r   (StrictTodoMixin.test_unexpectedSuccesses%  sn     	

4==!)NG45-1]]-N-N
-NTQQXXqxx -N 	 
 	8
s   #A8rA   Nr   r6   s   @r   r   r     s(     (29	9 	9r   r   c                   *    ] tR tRtRt]! R4      tRtR# )SynchronousStrictTodoTestsi1  z
Tests for the expected failure case when the exact failure that is expected
is indicated in the synchronous case

See: L{twisted.trial.test.test_tests.StrictTodoMixin}
z1twisted.trial.test.skipping.SynchronousStrictTodorA   Nr/   r0   r1   r2   r3   r   r   r4   rA   r   r   r   r   1  s     MNJr   r   c                   *    ] tR tRtRt]! R4      tRtR# )AsynchronousStrictTodoTestsi<  z
Tests for the expected failure case when the exact failure that is expected
is indicated in the asynchronous case

See: L{twisted.trial.test.test_tests.StrictTodoMixin}
z2twisted.trial.test.skipping.AsynchronousStrictTodorA   Nr   rA   r   r   r   r   <  s     NOJr   r   c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )ReactorCleanupTestsiG  zW
Tests for cleanup and reporting of reactor event sources left behind by test
methods.
c                    \         P                  ! \        4       4      V n        \        P
                  ! 4       V n        R# r;   )r   Reporterr   r=   r   r   r   r&   s   &r   r>   ReactorCleanupTests.setUpM  s(     ''
3'')r   c                   V P                   P                  R4      pVP                  V P                  4       V P	                  V P                  P                  4       4       V P                  V P                  P                  ^4       V P                  P                  ^ ,          ^,          pV P                  VP                  \        P                  4      4       R# )zU
Trial reports a L{util.DirtyReactorAggregateError} if a test leaves
sockets behind.
z@twisted.trial.test.erroneous.SocketOpenTest.test_socketsLeftOpenN)r   
loadByNamerO   r=   r   r!   r"   rE   r#   r    checkr
   DirtyReactorAggregateErrorr   r   failures   &  r   test_leftoverSockets(ReactorCleanupTests.test_leftoverSocketsT  s    
 &&N
 			$++2245 	..2++$$Q'*d&E&EFGr   c                   \         P                  ! R4      pVP                  V P                  4       V P	                  V P                  P                  4       4       V P                  P                  ^ ,          ^,          pV P                  V P                  P                  ^ 4       V P                  VP                  \        P                  4      4       R# )zr
Trial reports a L{util.DirtyReactorAggregateError} and fails the test
if a test leaves a L{DelayedCall} hanging.
test_leftoverPendingCallsN)r   r   rO   r=   r   r!   r#   r"   rE   r    r  r
   r  r  s   &  r   r  -ReactorCleanupTests.test_leftoverPendingCallse  s    
 --.IJ		$++2245++$$Q'*..2d&E&EFGr   )r   r=   N)
r/   r0   r1   r2   r3   r>   r  r  r4   r5   r6   s   @r   r   r   G  s!     
*H"
H 
Hr   r   c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	FixtureMixinir  z:
Tests for fixture helper methods (e.g. setUp, tearDown).
c                n    \         P                  ! 4       V n         \        P                  ! 4       V n        R# r;   )r   r   r   r   r   r&   s   &r   r>   FixtureMixin.setUpw  s$     !))+'')r   c                   V P                   P                  V P                  4      pVP                  V P                  4       V P                  \        V P                  P                  4      ^ 8  4       V P                  V P                  P                  ^ ,          ^,          P                  \        P                  4       V P                  ^ V P                  P                  4       R# )z?
When setUp fails, the error is recorded in the result object.
N)r   r   TestFailureInSetUprO   r   r    rq   r#   assertIsInstancevaluer   FoolishErrorr"   rE   r   s   & r   test_brokenSetUpFixtureMixin.test_brokenSetUp~  s     11$2I2IJ		$-- DMM001A56dmm2215a8>>	@V@VWDMM334r   c                   V P                   P                  V P                  4      pVP                  V P                  4       V P                  P
                  pV P                  \        V4      ^ 8  4       V P                  V^ ,          ^,          P                  \        P                  4       V P                  ^ V P                  P                  4       R# )zB
When tearDown fails, the error is recorded in the result object.
N)r   r   TestFailureInTearDownrO   r   r#   r    rq   r  r  r   r  r"   rE   )r   r   r#   s   &  r   test_brokenTearDown FixtureMixin.test_brokenTearDown  s     11$2L2LM		$-- %%Fa(fQil00)2H2HIDMM334r   c                8   V P                   P                  V P                  4      p\        V4      ^ ,          pV P	                  VP
                  4       VP                  V P                  4       V P                  P                  pV P                  \        V4      ^ 8  4       V P                  V^ ,          ^,          P                  \        P                  4       V P                  ^ V P                  P                   4       V P                  VP
                  4       R# )z@
L{SynchronousTestCase.tearDown} runs when a test method fails.
N)r   r   TestFailureButTearDownRunslistr   tornDownrO   r   r#   r    rq   r  r  r   r  r"   rE   )r   r   caser#   s   &   r   test_tearDownRunsOnTestFailure+FixtureMixin.test_tearDownRunsOnTestFailure  s     11$2Q2QRE{1~'		$-- %%Fa(fQil00)2H2HIDMM334&r   )r   r   N)r/   r0   r1   r2   r3   r>   r  r  r!  r4   r5   r6   s   @r   r  r  r  s#     *5	5' 'r   r  c                   J    ] tR tRtRt]! R4      t]! R4      t]! R4      tRt	R# )SynchronousFixtureTestsi  zu
Tests for broken fixture helper methods in the synchronous case

See: L{twisted.trial.test.test_tests.FixtureMixin}
z:twisted.trial.test.erroneous.SynchronousTestFailureInSetUpz=twisted.trial.test.erroneous.SynchronousTestFailureInTearDownzBtwisted.trial.test.erroneous.SynchronousTestFailureButTearDownRunsrA   N
r/   r0   r1   r2   r3   r   r  r  r  r4   rA   r   r   r$  r$    s7     "D %G "*L"r   r$  c                   J    ] tR tRtRt]! R4      t]! R4      t]! R4      tRt	R# )AsynchronousFixtureTestsi  zv
Tests for broken fixture helper methods in the asynchronous case

See: L{twisted.trial.test.test_tests.FixtureMixin}
z;twisted.trial.test.erroneous.AsynchronousTestFailureInSetUpz>twisted.trial.test.erroneous.AsynchronousTestFailureInTearDownzCtwisted.trial.test.erroneous.AsynchronousTestFailureButTearDownRunsrA   Nr%  rA   r   r   r'  r'    s7     "E %H "*M"r   r'  c                   Z    ] tR tRtRt]! R4      t]! R4      t]! R4      t]! R4      t	Rt
R# )	AsynchronousSuppressionTestsi  z
Tests for the warning suppression features of
L{twisted.trial.unittest.TestCase}

See L{twisted.trial.test.test_suppression.SuppressionMixin}
z?twisted.trial.test.suppression.AsynchronousTestSetUpSuppressionzBtwisted.trial.test.suppression.AsynchronousTestTearDownSuppressionz:twisted.trial.test.suppression.AsynchronousTestSuppressionz;twisted.trial.test.suppression.AsynchronousTestSuppression2rA   N)r/   r0   r1   r2   r3   r   TestSetUpSuppressionTestTearDownSuppressionTestSuppressionTestSuppression2r4   rA   r   r   r)  r)    sF     $I 'L DO  Er   r)  c                   f   a  ] tR tRt o Rt ! R R]P                  4      tR tR t	R t
R tR	tV tR
# )GCMixini  z
I provide a few mock tests that log setUp, tearDown, test execution and
garbage collection. I'm used to test whether gc.collect gets called.
c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )GCMixin.BasicTesti  z
Mock test to run.
c                (    V P                  R4       R# )z
Mock setUp
r>   N_logr&   s   &r   r>   GCMixin.BasicTest.setUp  s     IIgr   c                (    V P                  R4       R# )z
Mock test case
rI   Nr3  r&   s   &r   test_fooGCMixin.BasicTest.test_foo  s     IIfr   c                (    V P                  R4       R# )z
Mock tear tearDown
tearDownNr3  r&   s   &r   r:  GCMixin.BasicTest.tearDown  s     IIj!r   rA   N)
r/   r0   r1   r2   r3   r>   r7  r:  r4   r5   r6   s   @r   	BasicTestr1    s     				" 	"r   r<  c                <    V P                   P                  V4       R# )z
Log function
N)_collectCalledappend)r   msgs   &&r   r4  GCMixin._log  s     	""3'r   c                (    V P                  R4       R# )zFake gc.collectrZ   Nr3  r&   s   &r   rZ   GCMixin.collect  s    		)r   c                    . V n         V P                  V P                  n        \        P                  V n        V P                  \        n        R# r;   )r>  r4  r<  rY   rZ   _oldCollectr&   s   &r   r>   GCMixin.setUp  s3     !"ii::\\
r   c                0    V P                   \        n        R# z
Tear down the test
N)rE  rY   rZ   r&   s   &r   r:  GCMixin.tearDown  s     %%
r   )r>  rE  N)r/   r0   r1   r2   r3   r	   SynchronousTestCaser<  r4  rZ   r>   r:  r4   r5   r6   s   @r   r/  r/    s5     
"H00 ".("& &r   r/  c                   *   a  ] tR tRt o RtR tRtV tR# )GarbageCollectionDefaultTestsi  8
By default, tests should not force garbage collection.
c                    V P                  R4      p\        P                  ! 4       pVP                  V4       V P	                  V P
                  . RO4       R# )rM  r7  N)r>   rI   r:  )r<  r   r   rO   r"   r>  rH   s   &  r   test_collectNotDefault4GarbageCollectionDefaultTests.test_collectNotDefault  sC     ~~j)$$&,,.KLr   rA   N)r/   r0   r1   r2   r3   rO  r4   r5   r6   s   @r   rL  rL    s     M Mr   rL  c                   *   a  ] tR tRt o RtR tRtV tR# )GarbageCollectionTestsi%  z%
Test that, when force GC, it works.
c                    \         P                  R4      p\        V4      p\        P                  ! 4       pVP                  V4       V P                  V P                  . RO4       R# )z7
test gc.collect is called before and after each test.
r7  N)rZ   r>   rI   r:  rZ   )rR  r<  r   r   r   rO   r"   r>  rH   s   &  r   test_collectCalled)GarbageCollectionTests.test_collectCalled*  sR     &//
;/5$$&!T	
r   rA   N)r/   r0   r1   r2   r3   rT  r4   r5   r6   s   @r   rR  rR  %  s     

 

r   rR  c                   h   a  ] tR tRt o RtR tR t]P                  ! ]	R4      R 4       t
R tRtV tR	# )
UnhandledDeferredTestsi7  zP
Test what happens when we have an unhandled deferred left around after
a test.
c                z    ^ RI Hp \        P                  ! 4        \	        VP                  R4      4      V n        R# )r<   )weirdtest_unhandledDeferredN)twisted.trial.testrY  rY   disabler   TestBleedingtest1)r   rY  s   & r   r>   UnhandledDeferredTests.setUp=  s-     	- 	

578

r   c                    \         P                  ! 4       pV P                  V4       V P                  \	        VP
                  4      ^R4       R# )zW
Forcing garbage collection should cause unhandled Deferreds to be
reported as errors.
z(Unhandled deferred passed without noticeN)r   r   r^  r"   rq   r#   )r   r=   s   & r   test_isReported&UnhandledDeferredTests.test_isReportedI  s=    
 $$&

6#M	
r   zGC works differently on PyPy.c                "   \         P                  ! 4       pV P                  V4       V P                  4        \	        \
        P                  4      pV P                  V^ R4       V P                  4       pV P                  \	        V4      ^ R4       R# )z
Forcing garbage collection in the test should mean that there are
no unreachable cycles immediately after the test completes.
zunreachable cycle still existedzErrors logged after gc.collectN)r   r   r^  flushLoggedErrorsrq   rY   garbager"   )r   r=   nxs   &   r   test_doesntBleed'UnhandledDeferredTests.test_doesntBleedT  sq     $$&

6  

OA@A""$Q$DEr   c                z    \         P                  ! 4        \         P                  ! 4        V P                  4        R# rH  )rY   rZ   enablerd  r&   s   &r   r:  UnhandledDeferredTests.tearDowne  s"     	


		 r   )r^  N)r/   r0   r1   r2   r3   r>   ra  r   skipIfr   rh  r:  r4   r5   r6   s   @r   rW  rW  7  s@     


	
 ]]59:F ;F ! !r   rW  c                   `   a a ] tR tRt oRtV 3R ltR tR tR tR t	R t
R	 tR
 tRtVtV ;t# )AddCleanupMixinin  z)
Test the addCleanup method of TestCase.
c                   < \         SV `  4        \        P                  ! 4       V n        V P                  4       V n        R# r;   )superr>   r   r   r=   
AddCleanuprI   )r   rN   s   &r   r>   AddCleanupMixin.setUps  s,     	))+OO%	r   c                J   V P                   P                  V P                   n        V P                   P                  V P                   P                  R4       V P                   P                  V P                  4       V P                  RR.V P                   P                  4       R# )zA
Callables added with C{addCleanup} are run even if setUp fails.
foor>   N)	rI   brokenSetUpr>   
addCleanupr?  rO   r=   r"   logr&   s   &r   !test_addCleanupCalledIfSetUpFails1AddCleanupMixin.test_addCleanupCalledIfSetUpFails{  sh     ))//				TYY--u5		dkk"'5)499==9r   c                J   V P                   P                  V P                   n        V P                   P                  V P                   P                  R4       V P                   P                  V P                  4       V P                  RR.V P                   P                  4       R# )z
Callables added with C{addCleanup} are run even if setUp raises
L{SkipTest}. This allows test authors to reliably provide clean up
code using C{addCleanup}.
ru  r>   N)	rI   skippingSetUpr>   rw  r?  rO   r=   r"   rx  r&   s   &r   !test_addCleanupCalledIfSetUpSkips1AddCleanupMixin.test_addCleanupCalledIfSetUpSkips  sh     ))11				TYY--u5		dkk"'5)499==9r   c                `   V P                   P                  V P                   P                  R4       V P                   P                  V P                   P                  R4       V P                   P                  V P                  4       V P                  . ROV P                   P                  4       R# )zf
Callables added with C{addCleanup} should be called before C{tearDown}
in reverse order of addition.
ru  barNr>   runTestr  ru  r:  rI   rw  r?  rO   r=   r"   rx  r&   s   &r   #test_addCleanupCalledInReverseOrder3AddCleanupMixin.test_addCleanupCalledInReverseOrder  sm    
 			TYY--u5		TYY--u5		dkk"GWr   c                
   V P                   P                  V P                   P                  R4       V P                   P                  V P                  4       V P                  V P                  P                  4       4       V P                  ^\        V P                  P                  4      4       V P                  P                  w  w  rV P                  WP                   4       V P                  VP                  4       R4       R# )z
Errors raised in cleanup functions should be treated like errors in
C{tearDown}. They should be added as errors and fail the test. Skips,
todos and failures are all treated as errors.
ru  N)rI   rw  failrO   r=   r   r!   r"   rq   r#   getErrorMessager   rI   errors   &  r   test_errorInCleanupIsCaptured-AddCleanupMixin.test_errorInCleanupIsCaptured  s     			TYY^^U3		dkk"2245C 2 234++,,$yy)..0%8r   c                h   V P                   P                  V P                   P                  R4       V P                   P                  V P                   P                  R4       V P                   P	                  V P
                  4       V P                  . ROV P                   P                  4       V P                  ^\        V P
                  P                  4      4       V P
                  P                  w  w  rV P                  WP                   4       V P                  VP                  4       R4       R# )zY
If a cleanup raises an error then that does not stop the other
cleanups from being run.
ru  r  N)r>   r  ru  r:  )rI   rw  r?  r  rO   r=   r"   rx  rq   r#   r  r  s   &  r   &test_cleanupsContinueRunningAfterError6AddCleanupMixin.test_cleanupsContinueRunningAfterError  s    
 			TYY--u5		TYY^^U3		dkk"@$))--PC 2 234++,,$yy)..0%8r   c                   V P                   P                  V P                   P                  R4       V P                   P                  V P                   P                  R4       V P                   P                  V P                  4       V P                  . ROV P                   P                  4       V P                  ^\        V P                  P                  4      4       V P                  P                  w  w  rw  r4V P                  WP                   4       V P                  W0P                   4       V P                  VP                  4       R4       V P                  VP                  4       R4       R# )zU
If more than one cleanup fails, then the test should fail with more
than one error.
ru  r  N)r>   r  r:  )
rI   rw  r  rO   r=   r"   rx  rq   r#   r  )r   r^  error1test2error2s   &    r   test_multipleErrorsReported+AddCleanupMixin.test_multipleErrorsReported  s    
 			TYY^^U3		TYY^^U3		dkk"9499==IC 2 234-1[[-?-?*%/5		*		*//159//159r   c                  aa . oV P                   P                  VV3R l4       RoV P                   P                  V P                  4       RoV P                   P                  V P                  4       V P	                  SR.4       R# )z1
A function registered as a cleanup is run once.
c                  &   < S P                  S4      # )N)r?  )cleanupsstages   r   <lambda>6AddCleanupMixin.test_cleanupRunsOnce.<locals>.<lambda>  s    X__U%;r   firstsecondN)rI   rw  rO   r=   r"   )r   r  r  s   &@@r   test_cleanupRunsOnce$AddCleanupMixin.test_cleanupRunsOnce  sc     		;<		dkk" 		dkk"G9-r   )r=   rI   )r/   r0   r1   r2   r3   r>   ry  r}  r  r  r  r  r  r4   r5   __classcell__)rN   r7   s   @@r   ro  ro  n  s8     &:	:X99: . .r   ro  c                   *    ] tR tRtRt]! R4      tRtR# )SynchronousAddCleanupTestsi  zw
Test the addCleanup method of TestCase in the synchronous case

See: L{twisted.trial.test.test_tests.AddCleanupMixin}
z1twisted.trial.test.skipping.SynchronousAddCleanuprA   N)r/   r0   r1   r2   r3   r   rr  r4   rA   r   r   r  r    s     MNJr   r  c                   :   a  ] tR tRt o Rt]! R4      tR tRtV t	R# )AsynchronousAddCleanupTestsi  zx
Test the addCleanup method of TestCase in the asynchronous case

See: L{twisted.trial.test.test_tests.AddCleanupMixin}
z2twisted.trial.test.skipping.AsynchronousAddCleanupc                F  a  V 3R lpS P                   P                  S P                   P                  R4       S P                   P                  VR4       S P                   P                  S P                  4       S P                  . ROS P                   P                  4       R# )z
If an added callable returns a L{Deferred}, then the test should wait
until that L{Deferred} has fired before running the next cleanup
method.
c                    < \         P                  ! 4       p\        P                  ! ^ VP                  V 4       VP                  SP                  P                  4      # )    )r   Deferredr   	callLatercallbackaddCallbackrI   r?  )r   dr   s   & r   cleanupMAsynchronousAddCleanupTests.test_addCleanupWaitsForDeferreds.<locals>.cleanup  s>     AaW5==!1!122r   ru  r  Nr  r  )r   r  s   f r    test_addCleanupWaitsForDeferreds<AsynchronousAddCleanupTests.test_addCleanupWaitsForDeferreds  si    	3
 			TYY--u5		We,		dkk"GWr   rA   N)
r/   r0   r1   r2   r3   r   rr  r  r4   r5   r6   s   @r   r  r    s#      NOJX Xr   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )SuiteClearingMixini  zE
Tests for our extension that allows us to clear out a L{TestSuite}.
c                   \         P                  ! 4       pVP                  V P                  4       4       V P	                  ^VP                  4       4       \        V4       V P	                  ^ VP                  4       4       R# )zG
Calling L{_clearSuite} on a populated L{TestSuite} removes
all tests.
N)r	   	TestSuiteaddTestTestCaser"   r*   r   r   s   & r   test_clearSuite"SuiteClearingMixin.test_clearSuite  s^    
 ""$dmmo&E0023EE0023r   c                   \         P                  ! 4       pVP                  V P                  4       4       V P	                  ^VP                  4       4       \        V4       V P	                  ^ VP                  4       4       R# )z
Calling L{_clearSuite} on a populated standard library
L{TestSuite} removes all tests.

This test is important since C{_clearSuite} operates by mutating
internal variables.
N)r   r  r  r  r"   r*   r   r   s   & r   test_clearPyunitSuite(SuiteClearingMixin.test_clearPyunitSuite  s^       "dmmo&E0023EE0023r   rA   N)	r/   r0   r1   r2   r3   r  r  r4   r5   r6   s   @r   r  r    s     
44 4r   r  c                   2    ] tR tRtRt]P                  tRtR# )SynchronousSuiteClearingTestsi  z
Tests for our extension that allows us to clear out a L{TestSuite} in the
synchronous case.

See L{twisted.trial.test.test_tests.SuiteClearingMixin}
rA   N	r/   r0   r1   r2   r3   r	   rJ  r  r4   rA   r   r   r  r         ++Hr   r  c                   2    ] tR tRtRt]P                  tRtR# )AsynchronousSuiteClearingTestsi&  z
Tests for our extension that allows us to clear out a L{TestSuite} in the
asynchronous case.

See L{twisted.trial.test.test_tests.SuiteClearingMixin}
rA   Nr/   r0   r1   r2   r3   r	   r  r4   rA   r   r   r  r  &         Hr   r  c                   f   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tRtV tR# )TestDecoratorMixini1  z)
Tests for our test decoration features.
c                    V P                  VP                  VP                  R4       \        VRR4      p\        VRR4      pV P                  W44       Y4u;J d   f   M R# V P                  W4       R# R# )z2
Assert that the given decorated tests are equal.
Different class_originalTestN)r"   rN   getattrr[   )r   observedexpectedobservedOriginalexpectedOriginals   &&&  r   assertTestsEqual#TestDecoratorMixin.assertTestsEqual6  sl     	++X-?-?ARS"8_dC"8_dC-@77  4 8r   c                ~   V P                  VP                  VP                  R4       V P                  \        VP                  4      \        VP                  4      R4       \	        VP                  VP                  4       F8  w  r4\        VRR4      e   V P                  W44       K'  V P                  W44       K:  	  R# )zC
Assert that the given test suites with decorated tests are equal.
r  zDifferent number of tests._testsN)r"   rN   rq   r  zipr  assertSuitesEqualr  )r   r  r  observedTestexpectedTests   &&&  r   r  $TestDecoratorMixin.assertSuitesEqualA  s     	++X-?-?ARS #hoo"68T	
 +.hoox*O&L|Xt4@&&|B%%lA	 +Pr   c                    V P                  4       p\        P                  ! V4      p^ RIHp V! 4       pVP                  V4       V P                  VP                  V4       R# )z
For decorated tests, C{run} uses a result adapter that preserves the
test decoration for calls to C{addError}, C{startTest} and the like.

See L{reporter._AdaptedReporter}.
LoggingReporterN)r  r	   TestDecorator twisted.trial.test.test_reporterr  rO   r  rI   r   rI   decoratedTestr  r=   s   &    r   test_usesAdaptedReporterWithRun2TestDecoratorMixin.test_usesAdaptedReporterWithRunO  sL     }} ..t4D "&!fkk=9r   c                    V P                  4       p\        P                  ! V4      p^ RIHp V! 4       pV! V4       V P                  VP                  V4       R# )z
For decorated tests, C{__call__} uses a result adapter that preserves
the test decoration for calls to C{addError}, C{startTest} and the
like.

See L{reporter._AdaptedReporter}.
r  N)r  r	   r  r  r  r  rI   r  s   &    r    test_usesAdaptedReporterWithCall3TestDecoratorMixin.test_usesAdaptedReporterWithCall_  sF     }} ..t4D "ffkk=9r   c                    V P                  4       p\        P                  ! V\        P                  4      pV P	                  \        P                  ! V4      V4       R# )zh
Calling L{decorate} on a single test case returns the test case
decorated with the provided decorator.
Nr  r	   decorater  r  )r   rI   r  s   &  r   test_decorateSingleTest*TestDecoratorMixin.test_decorateSingleTestp  sB    
 }} ))$0F0FGh44T:MJr   c                   V P                  4       p\        P                  ! V.4      p\        P                  ! V\        P                  4      pV P                  V\        P                  ! \        P                  ! V4      .4      4       R# )zt
Calling L{decorate} on a test suite will return a test suite with
each test decorated with the provided decorator.
Nr  r	   r  r  r  r  r   rI   r   r  s   &   r   test_decorateTestSuite)TestDecoratorMixin.test_decorateTestSuitey  se    
 }}""D6* ))%1G1GH8--x/E/Ed/K.LM	
r   c                   V P                  4       p\        P                  ! V.4      p\        P                  ! V\        P                  4      pV P                  V\        P                  ! \        P                  ! V4      .4      4       V P                  V\        P                  ! \        P                  ! V4      .4      4       R# )zE
Calling L{decorate} on a test suite will mutate the original suite.
Nr  r  s   &   r   #test_decorateInPlaceMutatesOriginal6TestDecoratorMixin.test_decorateInPlaceMutatesOriginal  s     }}""D6* ))%1G1GH8--x/E/Ed/K.LM	
 	8%%x'='=d'C&DE	
r   c                6   \        \        RR4      pVf   \        P                  ! R4      hV P	                  4       p\        P
                  ! V.4      pV! V4      p\        P                  ! V\        P                  4       V! V4      pV P                  WE4       R# )a3  
When decorating a test suite in-place, the number of references to the
test objects in that test suite should stay the same.

Previously, L{unittest.decorate} recreated a test suite, so the
original suite kept references to the test objects. This test is here
to ensure the problem doesn't reappear again.
getrefcountNz*getrefcount not supported on this platform)	r  sysr	   SkipTestr  r  r  r  r"   )r   r  rI   r   count1count2s   &     r    test_decorateTestSuiteReferences3TestDecoratorMixin.test_decorateTestSuiteReferences  s     c=$7##$PQQ}}""D6*T"%!7!78T"(r   c                j   V P                  4       p\        P                  ! \        P                  ! V.4      .4      p\        P                  ! V\        P                  4      p\        P                  ! \        P                  ! \        P                  ! V4      .4      .4      pV P                  W44       R# )z
Calling L{decorate} on a test suite with nested suites will return a
test suite that maintains the same structure, but with all tests
decorated.
Nr  )r   rI   r   r  r  s   &    r   test_decorateNestedTestSuite/TestDecoratorMixin.test_decorateNestedTestSuite  s     }}""H$6$6v$>#?@ ))%1G1GH%%!7!7!= >?@
 	}7r   c                   V P                  4       p\        P                  ! V\        P                  4      p\        P                  ! V\        P                  4      pV P	                  V\        P                  ! V4      4       R# )zq
Calling L{decorate} on a test suite with already-decorated tests
decorates all of the tests in the suite again.
Nr  )r   rI   r  redecoratedTests   &   r   test_decorateDecoratedSuite.TestDecoratorMixin.test_decorateDecoratedSuite  sZ    
 }} ))$0F0FG"++M8;Q;QRox/E/Em/TUr   c                   V P                  4       p\        P                  ! V.4      p\        P                  ! V\        P
                  4      pV P                  V\        P                  ! \        P
                  ! V4      .4      4       R# )zq
Tests can be in non-standard suites. L{decorate} preserves the
non-standard suites when it decorates the tests.
N)r  r   DestructiveTestSuiter	   r  r  r  )r   rI   r   	decorateds   &   r   test_decoratePreservesSuite.TestDecoratorMixin.test_decoratePreservesSuite  se    
 }}++TF3%%eX-C-CD	v22H4J4J44P3QR	
r   rA   N)r/   r0   r1   r2   r3   r  r  r  r  r  r  r  r  r  r  r  r4   r5   r6   s   @r   r  r  1  sI     	5B: :"K


)(8V

 

r   r  c                   2    ] tR tRtRt]P                  tRtR# )SynchronousTestDecoratorTestsi  zz
Tests for our test decoration features in the synchronous case.

See L{twisted.trial.test.test_tests.TestDecoratorMixin}
rA   Nr  rA   r   r   r  r         ++Hr   r  c                   2    ] tR tRtRt]P                  tRtR# )AsynchronousTestDecoratorTestsi  z{
Tests for our test decoration features in the asynchronous case.

See L{twisted.trial.test.test_tests.TestDecoratorMixin}
rA   Nr  rA   r   r   r  r           Hr   r  c                   H   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )MonkeyPatchMixini  z>
Tests for the patch() helper method in L{unittest.TestCase}.
c                n    RV n         RV n        V P                   V n        V P                  4       V n        R# )r<   originalpatchedN)originalValuepatchedValueobjectToPatchr  rI   r&   s   &r   r>   MonkeyPatchMixin.setUp  s/     (%!//MMO	r   c                    V P                   P                  V RV P                  4       V P                  V P                  V P                  4       R# )zQ
Calling C{patch()} on a test monkey patches the specified object and
attribute.
r  N)rI   patchr  r"   r  r&   s   &r   
test_patchMonkeyPatchMixin.test_patch  s:    
 			ot/@/@A++T->->?r   c                    V P                   P                  V RV P                  4       V P                   P                  \        P
                  ! 4       4       V P                  V P                  V P                  4       R# )z_
Any monkey patches introduced by a test using C{patch()} are reverted
after the test has run.
r  N)	rI   r  r  rO   r   r   r"   r  r  r&   s   &r   test_patchRestoredAfterRun+MonkeyPatchMixin.test_patchRestoredAfterRun  sS    
 			ot/@/@A		h'')*++T-?-?@r   c                    V P                   P                  V RV P                  4      pVP                  4        V P	                  V P
                  V P                  4       R# )z
C{patch()} return a L{monkey.MonkeyPatcher} object that can be used to
restore the original values before the end of the test.
r  N)rI   r  r  restorer"   r  r  r   r  s   & r   test_revertDuringTest&MonkeyPatchMixin.test_revertDuringTest  sE    
 		ot7H7HI++T-?-?@r   c                    V P                   P                  V RV P                  4      pVP                  4        VP                  4        V P	                  V P
                  V P                  4       R# )zY
The returned L{monkey.MonkeyPatcher} object can re-apply the patch
during the test run.
r  N)rI   r  r  r  r"   r  r  s   & r   test_revertAndRepatch&MonkeyPatchMixin.test_revertAndRepatch  sN    
 		ot7H7HI++T->->?r   c                   V P                   P                  V RV P                  4       V P                  V P                  V P                  4       V P                   P                  V RR4       V P                  V P                  R4       V P                   P                  \        P                  ! 4       4       V P                  V P                  V P                  4       R# )zG
Successive patches are applied and reverted just like a single patch.
r  zsecond valueN)	rI   r  r  r"   r  rO   r   r   r  r&   s   &r   test_successivePatches'MonkeyPatchMixin.test_successivePatches  s     			ot/@/@A++T->->?		o~>++^<		h'')*++T-?-?@r   )r  r  r  rI   N)r/   r0   r1   r2   r3   r>   r  r  r  r   r#  r4   r5   r6   s   @r   r  r    s3     $@AA@	A 	Ar   r  c                   2    ] tR tRtRt]P                  tRtR# )SynchronousMonkeyPatchTestsi  zu
Tests for the patch() helper method in the synchronous case.

See L{twisted.trial.test.test_tests.MonkeyPatchMixin}
rA   Nr  rA   r   r   r&  r&    r  r   r&  c                   2    ] tR tRtRt]P                  tRtR# )AsynchronousMonkeyPatchTestsi(  zv
Tests for the patch() helper method in the asynchronous case.

See L{twisted.trial.test.test_tests.MonkeyPatchMixin}
rA   Nr  rA   r   r   r(  r(  (  r	  r   r(  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	IterateTestsMixini2  zQ
L{_iterateTests} returns a list of all test cases in a test suite or test
case.
c                p    V P                  4       pV P                  V.\        \        V4      4      4       R# )zR
L{_iterateTests} on a single test case returns a list containing that
test case.
N)r  r"   r  r   rP   s   & r   test_iterateTestCase&IterateTestsMixin.test_iterateTestCase8  s+    
 }}$mD&9!:;r   c                    V P                  4       p\        P                  ! V.4      pV P                  V.\	        \        V4      4      4       R# )zm
L{_iterateTests} on a test suite that contains a single test case
returns a list containing that test case.
Nr  r   r  r"   r  r   r   rI   r   s   &  r   test_iterateSingletonTestSuite0IterateTestsMixin.test_iterateSingletonTestSuite@  s=    
 }}  $($mE&:!;<r   c                    V P                  4       p\        P                  ! \        P                  ! V.4      .4      pV P                  V.\	        \        V4      4      4       R# )z@
L{_iterateTests} returns tests that are in nested test suites.
Nr/  r0  s   &  r   test_iterateNestedTestSuite-IterateTestsMixin.test_iterateNestedTestSuiteI  sK     }}  &"2"2D6":!;<$mE&:!;<r   c                    V P                  4       p\        P                  ! \        P                  ! V.4      V .4      pV P                  W.\	        \        V4      4      4       R# )zE
L{_iterateTests} returns tests in left-to-right, depth-first order.
Nr/  r0  s   &  r   #test_iterateIsLeftToRightDepthFirst5IterateTestsMixin.test_iterateIsLeftToRightDepthFirstQ  sM     }}  &"2"2D6":D!AB$tM%,@'ABr   rA   N)r/   r0   r1   r2   r3   r,  r1  r4  r7  r4   r5   r6   s   @r   r*  r*  2  s%     
<==C Cr   r*  c                   2    ] tR tRtRt]P                  tRtR# )SynchronousIterateTestsTestsiZ  z
Check that L{_iterateTests} returns a list of all test cases in a test suite
or test case for synchronous tests.

See L{twisted.trial.test.test_tests.IterateTestsMixin}
rA   Nr  rA   r   r   r:  r:  Z  r  r   r:  c                   2    ] tR tRtRt]P                  tRtR# )AsynchronousIterateTestsTestsie  z
Check that L{_iterateTests} returns a list of all test cases in a test suite
or test case for asynchronous tests.

See L{twisted.trial.test.test_tests.IterateTestsMixin}
rA   Nr  rA   r   r   r<  r<  e  r  r   r<  c                   0   a  ] tR tRt o RtR tR tRtV tR# )TrialGeneratorFunctionTestsip  z5
Tests for generator function methods in test cases.
c                    ! R R\         P                  4      pV! R4      p\        P                  ! 4       pVP	                  V4       V P                  \        VP                  4      ^ 4       V P                  \        VP                  4      ^4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       R# )z
In a TestCase, a test method which is a generator function is reported
as an error, as such a method will never run assertions.
c                   *   a  ] tR tRt o RtR tRtV tR# )TTrialGeneratorFunctionTests.test_errorOnGeneratorFunction.<locals>.GeneratorTestCasei{  z'
A fake TestCase for testing purposes.
c              3  8   "   V P                  R4       Rx  R# 5izD
A method which is also a generator function, for testing
purposes.
zthis should never be reachedNr  r&   s   &r   test_generatorcTrialGeneratorFunctionTests.test_errorOnGeneratorFunction.<locals>.GeneratorTestCase.test_generator       
 		89   rA   Nr/   r0   r1   r2   r3   rE  r4   r5   r6   s   @r   GeneratorTestCaserA  {        r   rJ  rE  z GeneratorTestCase.test_generatorz+GeneratorTestCase testMethod=test_generator4is a generator function and therefore will never runN)r	   r  r   r   rO   r"   rq   r$   r#   assertInr  args)r   rJ  testCaser=   s   &   r   test_errorOnGeneratorFunction9TrialGeneratorFunctionTests.test_errorOnGeneratorFunctionu  s   	 1 1 	 %%56$$&VV__-q1V]]+Q/.a0@0C0I0I0N0Nq0Q	
 	9MM!Q%%**1-	
 	BMM!Q%%**1-	
r   c                    ! R R\         P                  4      pV! R4      p\        P                  ! 4       pVP	                  V4       V P                  \        VP                  4      ^ 4       V P                  \        VP                  4      ^4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       V P                  RVP                  ^ ,          ^,          P                  P                  ^ ,          4       R# )z
In a SynchronousTestCase, a test method which is a generator function
is reported as an error, as such a method will never run assertions.
c                   *   a  ] tR tRt o RtR tRtV tR# )rTrialGeneratorFunctionTests.test_synchronousTestCaseErrorOnGeneratorFunction.<locals>.GeneratorSynchronousTestCasei  z2
A fake SynchronousTestCase for testing purposes.
c              3  8   "   V P                  R4       Rx  R# 5irC  rD  r&   s   &r   rE  ځTrialGeneratorFunctionTests.test_synchronousTestCaseErrorOnGeneratorFunction.<locals>.GeneratorSynchronousTestCase.test_generator  rG  rH  rA   NrI  r6   s   @r   GeneratorSynchronousTestCaserT    rK  r   rW  rE  z+GeneratorSynchronousTestCase.test_generatorz6GeneratorSynchronousTestCase testMethod=test_generatorrL  N)r	   rJ  r   r   rO   r"   rq   r$   r#   rM  r  rN  )r   rW  rO  r=   s   &   r   0test_synchronousTestCaseErrorOnGeneratorFunctionLTrialGeneratorFunctionTests.test_synchronousTestCaseErrorOnGeneratorFunction  s   	8+G+G 	 00@A$$&VV__-q1V]]+Q/9MM!Q%%**1-	
 	DMM!Q%%**1-	
 	BMM!Q%%**1-	
r   rA   N)	r/   r0   r1   r2   r3   rP  rX  r4   r5   r6   s   @r   r>  r>  p  s     "
H#
 #
r   r>  )Ir3   rY   r  r	   r   rW   ior   twisted.internetr   r   twisted.python.compatr   twisted.python.reflectr   twisted.trialr   r   r
   twisted.trial._asyncrunnerr   r   r   r[  r   #twisted.trial.test.test_suppressionr   r   r9   rJ  r_   r  rd   rf   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r$  r'  r)  r/  rL  rR  rW  ro  r  r  r  r  r  r  r  r  r  r&  r(  r*  r:  r<  r>  rA   r   r   <module>ra     sl  * 
 
    + ' + : : 
 ) @; ;@8* 8*vlH,H,H |X->-> F
' F
R!183O3O "2H4E4E 08' 08fS 0(2N2N ST!183D3D TU5  U5p	S9h&B&B 	S	TIx'8'8 	T48% 48nM0L0L MN1B1B N49& 49nO(2N2N OP/83D3D P(H(66 (HV0' 0'flH,H,H $|X->-> $#3X5F5F ,4& 4&nMGX-I-I M
Wh&B&B 
$4!X99 4!nd. d.NO(2N2N OX/83D3D X64 4B,$68T8T ,!%79J9J !X
 X
v,$68T8T ,!%79J9J !;A ;A|,"2H4P4P ,!#3X5F5F !%C %CP,#4h6R6R ,!$5x7H7H !L
(">"> L
r   