
    Yf                        d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	 ddl
mZ ddlmZmZmZ ddlmZmZmZmZ ddlmZ dd	lmZ dd
lmZmZmZmZmZ ddl m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,m-Z- ddl.m/Z/  G d d          Z0 G d dej1                  Z2 G d dej1                  Z3 G d de3          Z4 G d de2          Z5 G d de5          Z6 G d dej1                  Z7 G d  d!e2          Z8 G d" d#ej1                  Z9 G d$ d%ej1                  Z: G d& d'ej1                  Z; G d( d)ej1                  Z< G d* d+e<          Z= G d, d-ej1                  Z> G d. d/e>          Z? G d0 d1          Z@ G d2 d3ej1                  ZA G d4 d5ej1                  ZB G d6 d7eB          ZC G d8 d9ej1                  ZD G d: d;eB          ZE G d< d=ej1                  ZF G d> d?eC          ZG G d@ dAejH                  ZI G dB dCej1                  ZJ G dD dE          ZK G dF dGej1                  ZL G dH dIej1                  ZMdS )Jz&
Tests for L{twisted.trial.reporter}.
    N)getmro)BytesIOStringIO)Type)TestCase	TestSuiteexpectedFailure)assert_thatequal_tohas_item
has_lengthlog)Failure)itrialreporterrunnerunittestutil)UncleanWarningsReporterWrapper_ExitWrapper)	erroneoussample)SkipTestTodomakeTodo   )	isFailurematches_resultsimilarFrame   )afterc                   ,    e Zd ZdZdZdZd Zd Zd ZdS )BrokenStreamz
    Stream-ish object that raises a signal interrupt error. We use this to make
    sure that Trial still manages to write what it needs to write.
    Fc                     || _         d S N)fObj)selfr'   s     R/var/www/html/env/lib/python3.11/site-packages/twisted/trial/test/test_reporter.py__init__zBrokenStream.__init__,       			    c                     | j         r| j                            |          S d| _         t          t          j        d          )NTzInterrupted write)writtenr'   writeOSErrorerrnoEINTR)r(   ss     r)   r/   zBrokenStream.write/   s:    < 	&9??1%%%ek#6777r,   c                     | j         r| j                                        S d| _         t          t          j        d          )NTzInterrupted flush)flushedr'   flushr0   r1   r2   r(   s    r)   r6   zBrokenStream.flush5   s8    < 	%9??$$$ek#6777r,   N)	__name__
__module____qualname____doc__r.   r5   r*   r/   r6    r,   r)   r$   r$   #   sW         
 GG  8 8 88 8 8 8 8r,   r$   c                       e Zd Zd ZdS )
StringTestc           	         t          t          d |                    }|                     t          |          t          |          k    dt          |          t          |          fz             t	          t          j        d                    }t          t          ||                    D ]\  }\  }}|t          |t                    r|                     ||d|||fz             >t          ||          r5|                     |                    |          d||j        |fz             t          d|          d S )Nz2Must have more observed than expectedlines %d < %d zLine %d: %r not in %rz#Line %d: %r did not match string %rz"don't know what to do with object )listfilter
assertTruelentyperecompile	enumeratezip
isinstancestrassertSubstringmatchpattern	TypeError)r(   expectoutputREGEX_PATTERN_TYPEline_numberexpouts          r)   stringComparisonzStringTest.stringComparison=   sh   fT6**++KK3v;;&"6{{CKK89	
 	
 	

 ""*R..11'0VV1D1D'E'E 	N 	N#K#s{C%% N$$5c38OO    C!344 NIIcNN9"CK56      LS L LMMM	N 	Nr,   N)r8   r9   r:   rV   r<   r,   r)   r>   r>   <   s(        N N N N Nr,   r>   c                   &    e Zd Zd Zd Zd Zd ZdS )TestResultTestsc                 6    t          j                    | _        d S r&   )r   
TestResultresultr7   s    r)   setUpzTestResultTests.setUpW   s    )++r,   c                 V   	 t          d          # t           $ r8}|}| j                            | t          j                               Y d }~nd }~ww xY w| j        j        d         d         }|                     ||j                   |                     t           |j                   d S Nfoor   r!   )	RuntimeErrorr[   addErrorsysexc_infoerrorsassertEqualvaluerE   r(   eexcValuefailures       r)   test_pyunitAddErrorz#TestResultTests.test_pyunitAddErrorZ   s    	7u%%% 	7 	7 	7HK  s|~~66666666	7 +$Q'*7=111w|44444s    
A.AAc                 b   	 |                      d          # | j         $ r8}|}| j                            | t          j                               Y d }~nd }~ww xY w| j        j        d         d         }|                     ||j                   |                     | j         |j                   d S r^   )	failureExceptionr[   
addFailurerb   rc   failuresre   rf   rE   rg   s       r)   test_pyunitAddFailurez%TestResultTests.test_pyunitAddFailuree   s    	9''...$ 	9 	9 	9HK""488888888	9 +&q)!,7=111.=====s    
A.AAc                    |                      t                    5  | j                            | d           ddd           n# 1 swxY w Y   |                      t                    5  | j                            | t	          d                     ddd           n# 1 swxY w Y   |                      t                    5  | j                            | t          t	          d          ddf           ddd           n# 1 swxY w Y   |                      t                    5  | j                            | t          t	          d          f           ddd           dS # 1 swxY w Y   dS )z
        L{reporter.TestResult.addError} raises L{TypeError} if it is called with
        an error that is neither a L{sys.exc_info}-like three-tuple nor a
        L{Failure}.
        zan errorNextra)assertRaisesrO   r[   ra   	Exceptionr7   s    r)   test_somethingElsez"TestResultTests.test_somethingElsep   sZ    y)) 	3 	3K  z222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3y)) 	> 	>K  y'<'<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>y)) 	 	K  y)J"7"7wG  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 y)) 	K 	KK  	9Z3H3H'IJJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	KsG   AA
A()BB!$B!2D  DD%0E""E&)E&N)r8   r9   r:   r\   rk   rp   ru   r<   r,   r)   rX   rX   V   sU        , , ,	5 	5 	5	> 	> 	>K K K K Kr,   rX   c                       e Zd Zd ZdS )ReporterRealtimeTestsc                 X    t                      }t          j        |d          | _        d S )NT)realtime)r   r   Reporterr[   r(   rQ   s     r)   r\   zReporterRealtimeTests.setUp   s&    '>>>r,   N)r8   r9   r:   r\   r<   r,   r)   rw   rw      s#        ? ? ? ? ?r,   rw   c                   p    e Zd Z ej        d          ZddZd Zdede	j
        fdZd Zd	 Zd
 ZddZdS )ErrorReportingTestsz^=+$returnNc                     t          j                    | _        t                      | _        t          j        | j                  | _        d S r&   )r   
TestLoaderloaderr   rQ   r   rz   r[   r7   s    r)   r\   zErrorReportingTests.setUp   s5    '))jj)1):4;)G)Gr,   c                     |                      |          }|                                 | j                                        S r&   )	getResultdonerQ   getvalue)r(   suiter[   s      r)   	getOutputzErrorReportingTests.getOutput   s4    &&{##%%%r,   r   c                 D    |                     | j                   | j        S r&   )runr[   r(   r   s     r)   r   zErrorReportingTests.getResult   s    		$+{r,   c           
      P   t           j        }| j                            |          }|                     |                                          }| j        ddt          j        d          t          j        d          d|j	         d|j
         dg}|                     ||           dS )	z
        A test method which runs and has an error recorded against it is
        reported in the output stream with the I{ERROR} tag along with a
        summary of what error was reported and the ID of the test.
        z[ERROR]"Traceback (most recent call last):z.^\s+File .*erroneous\.py., line \d+, in setUp$z5^\s+raise FoolishError..I am a broken setUp method..$zEtwisted.trial.test.erroneous.FoolishError: I am a broken setUp method.z
.test_noopN)r   SynchronousTestFailureInSetUpr   	loadClassr   
splitlinesdoubleSeparatorrF   rG   r9   r8   rV   )r(   clsr   rQ   rM   s        r)   test_formatErroredMethodz,ErrorReportingTests.test_formatErroredMethod   s     5%%c**&&1133 0JHIIJSTT- ~88888
 	eV,,,,,r,   c                    | j                             d          }|                     |                                          }| j        ddt          j        d          t          j        d          ddg}|                     ||           dS )z
        A test method which runs and has a failure recorded against it is
        reported in the output stream with the I{FAIL} tag along with a summary
        of what failure was reported and the ID of the test.
        z6twisted.trial.test.erroneous.TestRegularFail.test_failz[FAIL]r   z2^\s+File .*erroneous\.py., line \d+, in test_fail$z^\s+self\.fail\("I fail"\)$z'twisted.trial.unittest.FailTest: I failN)r   
loadByNamer   r   r   rF   rG   rV   )r(   r   rQ   rM   s       r)   test_formatFailedMethodz+ErrorReportingTests.test_formatFailedMethod   s     &&D
 
 &&1133 0JLMMJ5665D
 	eV,,,,,r,   c                    ddl m} t          j        | j                            |          t          j                  }|                     |          }d}ddd|fD ]}| 	                    ||           | 
                    t          j        d|          d           | j        t          j        d	          g}|                     ||                                           d
S )z
        A problem encountered while running a doctest is reported in the output
        stream with a I{FAIL} or I{ERROR} tag along with a summary of what
        problem was encountered and the ID of the test.
        r   )r   z0twisted.trial.test.erroneous.unexpectedExceptionz1/0ZeroDivisionErrorzException raised:zFail(ed|ure in) example:z;Couldn't match 'Failure in example: ' or 'Failed example: 'z\[(ERROR|FAIL)\]N)twisted.trial.testr   r   decorater   loadDoctestsr   	ITestCaser   rL   rC   rF   searchr   rG   rV   r   )r(   r   r   rQ   path	substringrP   s          r)   test_doctestErrorz%ErrorReportingTests.test_doctestError   s     	100000!$+":":9"E"EvGWXX&&A!46I4P 	4 	4I  F3333I0&99L	
 	
 	
 &
3F(G(GHff&7&7&9&9:::::r,   c                 >   t          j        d          }|                     t          |g                    }t	          |t          t          d          t          d                               |j        \  \  }}t	          |t          |                     t	          |t          t          t                    t          t          t          d                    t          t          dd                                         |j        \  \  }}t	          |t          |                     t	          |t          t          |j                  t          t          t          d                    t          t          dd                                         d	S )
a  
        When a function scheduled using L{IReactorTime.callLater} in a
        test method raises an exception that exception is added to the test
        result as an error.

        This happens even if the test also fails and the test failure is also
        added to the test result as a failure.

        Only really necessary for testing the deprecated style of tests that
        use iterate() directly. See
        L{erroneous.DelayedCall.testHiddenException} for more details.
        testHiddenExceptionr!   )rd   ro   zsomething blew upgozerroneous.py)rE   rf   framesz/Deliberate failure to mask the hidden exceptionN)r   DelayedCallr   PyUnitTestSuiter
   r   r   rd   r   r   r`   r"   rK   r   r    ro   rm   )r(   testr[   
actualCaseerrorrj   s         r)   test_hiddenExceptionz(ErrorReportingTests.test_hiddenException   s    $%:;; 7 788N*Q--*Q--PPP	
 	
 	
 !'	*eD(:..///l++C*=!>!>??T> B BCC  	
 	
 	
 #)/	*gD(:..///d344"STT   -BN S STT  		
 		
 		
 		
 		
r,   r~   N)r8   r9   r:   rF   rG   r   r\   r   r   r   rz   r   r   r   r   r   r<   r,   r)   r}   r}      s         bj))OH H H H
& & &
 83D    - - -.- - -*; ; ;()
 )
 )
 )
 )
 )
r,   r}   c                   4    e Zd ZdZddZdedej        fdZdS )(UncleanWarningWrapperErrorReportingTestsz
    Tests that the L{UncleanWarningsReporterWrapper} can sufficiently proxy
    IReporter failure and error reporting methods to a L{reporter.Reporter}.
    r~   Nc                     t          j                    | _        t                      | _        t          j        | j                  | _        t          | j                  | _        d S r&   )	r   r   r   r   rQ   r   rz   r   r[   r7   s    r)   r\   z.UncleanWarningWrapperErrorReportingTests.setUp  sF    '))jj+3+<T[+I+I4T]CCr,   r   c                 D    |                     | j                   | j        S r&   )r   r[   r   r   s     r)   r   z2UncleanWarningWrapperErrorReportingTests.getResult  s    		$+}r,   r   )	r8   r9   r:   r;   r\   r   r   rz   r   r<   r,   r)   r   r     s[         
D D D D 83D      r,   r   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
TracebackHandlingTestsc                 d   t                      }t          j        |          }|                    |           |j        |j        z   }|                     t          |          d           |                     |d         d         |           |                    |d         d         j	                  S )z
        Run the given C{test}, make sure it fails and return the trimmed
        frames.

        @param test: The test case to run.

        @return: The C{list} of frames trimmed.
        r!   r   )
r   r   rz   r   ro   rd   re   rD   _trimFramesr   )r(   r   streamr[   badss        r)   getErrorFramesz%TracebackHandlingTests.getErrorFrames  s     "6**.TA&&&aT***!!$q'!*"3444r,   c                    t          ||          D ]\  }}|                     |d         |d                    t          j                            |d                   d                             t          j                  }|d                             d          }|                     |t          |           d          |           |                     t          |          t          |                     d S )Nr   r!   /)rI   re   osr   splitextsplitseprD   )r(   observedFramesexpectedFramesobservedexpectedobservedSegsexpectedSegss          r)   checkFramesz"TracebackHandlingTests.checkFrames(  s    "%nn"E"E 	O 	OHhXa[(1+6667++HQK88;AA"&IIL#A;,,S11L\3|+<+<*<*>*>?NNNN^,,c..A.ABBBBBr,   c                     t          j        d          }|                     |          }|                     |dg           d S )N	test_fail)r   twisted/trial/test/erroneousr   TestRegularFailr   r   r(   r   r   s      r)   
test_basicz!TracebackHandlingTests.test_basic0  sE    (55$$T**"O!PQQQQQr,   c                     t          j        d          }|                     |          }|                     |ddg           d S )Ntest_subfail)r   r   )
subroutiner   r   r   s      r)   test_subroutinez&TracebackHandlingTests.test_subroutine5  sU    (88$$T**@>	
 	
 	
 	
 	
r,   c                     t          j        d          }|                     |          }|                     |dg           dS )z
        C{_trimFrames} removes traces of C{_runCallbacks} when getting an error
        in a callback returned by a C{TestCase} based test.
        r   )cbztwisted/internet/taskNr   TestAsynchronousFailr   r   r   s      r)   test_deferredz$TracebackHandlingTests.test_deferred@  sV    
 -k::$$T** 0	
 	
 	
 	
 	
r,   c                     t          j        d           }|                     g |                    g                      d S r&   r   rz   re   r   r(   r[   s     r)   test_noFramesz$TracebackHandlingTests.test_noFramesP  s<    "4((V//3344444r,   c                     t          j        d           }|                     dg|                    dg                     d S )Nz
fake framer   r   s     r)   test_oneFramez$TracebackHandlingTests.test_oneFrameT  s@    "4((,););\N)K)KLLLLLr,   c                     t          j        d          }|                     |          }|                     |dg           dS )z
        C{_trimFrames} removes traces of C{runWithWarningsSuppressed} from
        C{utils} when a synchronous exception happens in a C{TestCase}
        based test.
        test_exception)r   r   Nr   r   s      r)   r   z%TracebackHandlingTests.test_exceptionX  sH     -.>??$$T**"T!UVVVVVr,   N)r8   r9   r:   r   r   r   r   r   r   r   r   r<   r,   r)   r   r     s        5 5 5"C C CR R R
	
 	
 	

 
 
 5 5 5M M MW W W W Wr,   r   c                   &    e Zd Zd Zd Zd Zd ZdS )FormatFailuresTestsc                    	 t          d          # t           $ r t                      | _        Y nw xY wddddgdggddddgd	ggg| j        _        t	                      | _        t          j        | j                  | _        d S )
Nr_   z
foo/bar.py   )xr   )yorangequx
   )atwo)bMCMXCIX)	r`   r   fr   r   r   r   rz   r[   r7   s    r)   r\   zFormatFailuresTests.setUpd  s    	u%%% 	 	 	YYDFFF	 L!hZ/1BCL"|n7G6HI
 jj'44s    11c           	          | j                             | j                  }|                     ddt	          j        d          dt	          j        d          dg|                                           d S )Nr   z#  File "foo/bar.py", line 5, in fooz^\s*$z$  File "foo/bar.py", line 10, in quxzRuntimeError: foo)r[   _formatFailureTracebackr   rV   rF   rG   r   )r(   tbs     r)   test_formatDefaultz&FormatFailuresTests.test_formatDefaultp  ss    [008845
8$$6
8$$# MMOO
	
 
	
 
	
 
	
 
	
r,   c                 n    d}d}| j                             |          }|                     ||           d S )Nz
  File "twisted/trial/unittest.py", line 256, in failUnlessSubstring
    return self.failUnlessIn(substring, astring, msg)
exceptions.TypeError: iterable argument required

z
  File "twisted/trial/unittest.py", line 256, in failUnlessSubstring
    return self.failUnlessIn(substring, astring, msg)
exceptions.TypeError: iterable argument required
)r[   r   re   )r(   r   r   	formatteds       r)   test_formatStringz%FormatFailuresTests.test_formatString~  sC    
 K77;;	9-----r,   c                     | j         j        d d          }| j                            | j                    |                     | j         j        |           d S r&   )r   r   r[   r   re   )r(   r   s     r)   test_mutationz!FormatFailuresTests.test_mutation  sL    qqq!++DF333/////r,   N)r8   r9   r:   r\   r   r   r   r<   r,   r)   r   r   c  sP        
5 
5 
5
 
 
. . .0 0 0 0 0r,   r   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	PyunitNamesTestsc                 ^    t                      | _        t          j        d          | _        d S Ntest_foo)r   r   r   
PyunitTestr   r7   s    r)   r\   zPyunitNamesTests.setUp  s#    jj%j11			r,   c                     t          j        | j                  }|                    | j                   | j                                        }|                     |d           d S )Nz2twisted.trial.test.sample.PyunitTest.test_foo ... )r   VerboseTextReporterr   	startTestr   r   re   r(   r[   rQ   s      r)   test_verboseReporterz%PyunitNamesTests.test_verboseReporter  sZ    -dk::###%%''!UVVVVVr,   c                 X   t          j        | j                  }|                    | j                   | j                                        }|                                d                                         }|                     ||	                    | j                  dz              d S Nz ...
r   TreeReporterr   r   r   r   r   stripre   getDescriptionr   s      r)   test_treeReporterz"PyunitNamesTests.test_treeReporter      &t{33###%%''""$$R(..00!6!6ty!A!AF!JKKKKKr,   c                     t          j        | j                  }|                    | j                  }|                     |d           d S r   r   r  r   r  r   re   r   s      r)   test_getDescriptionz$PyunitNamesTests.test_getDescription  E    &t{33&&ty11,,,,,r,   c                 P   t          j        | j                  }| j                            |           |                                 | j                                                                                            d          }| 	                    |dd         g d           dS )a  
        The summary of L{reporter.MinimalReporter} is a simple list of numbers,
        indicating how many tests ran, how many failed etc.

        The numbers represents:
         * the run time of the tests
         * the number of tests run, printed 2 times for legacy reasons
         * the number of errors
         * the number of failures
         * the number of skips
         r!   N)1r  0r  r  )
r   MinimalReporterr   r   r   _printSummaryr   r  r   re   r   s      r)   test_minimalReporterz%PyunitNamesTests.test_minimalReporter  s     )$+66	f%%''--//55c::%>%>%>?????r,   c                 j   g dt          j        | j                  }fd|_        | j                            |           |                                 | j                                                                        	                    d          }|d         }| 
                    |d           dS )zt
        L{reporter.MinimalReporter} reports the time to run the tests as first
        data in its output.
        )g      ?g333333?g      ?gffffff?c                  .                          d          S Nr   )pop)timess   r)   <lambda>z;PyunitNamesTests.test_minimalReporterTime.<locals>.<lambda>  s    %))A,, r,   r  r   z0.7N)r   r  r   _getTimer   r   r  r   r  r   re   )r(   r[   rQ   timerr  s       @r)   test_minimalReporterTimez)PyunitNamesTests.test_minimalReporterTime  s    
 %$$)$+66....	f%%''--//55c::q	&&&&&r,   c                    t          j        | j                  }|                                 | j                                                                                            d          }|                     |g d           dS )zv
        The summary of L{reporter.MinimalReporter} is a list of zeroes when no
        test is actually run.
        r  )r  r  r  r  r  r  N)r   r  r   r  r   r  r   re   r   s      r)   test_emptyMinimalReporterz*PyunitNamesTests.test_emptyMinimalReporter  sx    
 )$+66%%''--//55c::!?!?!?@@@@@r,   N)
r8   r9   r:   r\   r   r  r	  r  r  r  r<   r,   r)   r   r     s        2 2 2W W WL L L- - -
@ @ @$' ' 'A A A A Ar,   r   c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )DirtyReactorTestsz
    The trial script has an option to treat L{DirtyReactorAggregateError}s as
    warnings, as a migration tool for test authors. It causes a wrapper to be
    placed around reporters that replaces L{DirtyReactorAggregatErrors} with
    warnings.
    c                     t          t          j        dgdg                    | _        t	                      | _        t          d          | _        d S )Nr_   bartest_errorByDefault)r   r   DirtyReactorAggregateError
dirtyErrorr   rQ   r  r   r7   s    r)   r\   zDirtyReactorTests.setUp  sA    !$"A5'E7"S"STTjj%&;<<			r,   c                 "   t          j        | j                  }|                    | j        | j                   |                     t          |j                  d           |                     |j        d         d         | j                   dS )zj
        L{DirtyReactorAggregateError}s are reported as errors with the default
        Reporter.
        r   r!   r   N)	r   rz   rQ   ra   r   r#  re   rD   rd   r   s     r)   r!  z%DirtyReactorTests.test_errorByDefault  s{    
 "$+666	4?333V]++Q///q)!,do>>>>>r,   c                     t          t          j        | j                            }|                     t
          | j                                        t          j        |j	        | j
        | j                   dS )z
        L{DirtyReactorAggregateError}s are reported as warnings when using
        the L{UncleanWarningsReporterWrapper}.
        r%  N)r   r   rz   rQ   assertWarnsUserWarningr#  getErrorMessage__file__ra   r   r   s     r)   test_warningsEnabledz&DirtyReactorTests.test_warningsEnabled  sl    
 00A0U0U0UVVO++--OIO	
 	
 	
 	
 	
r,   c                 2   t          t          j        | j                            }|                     t
          | j                                        t          j        |j	        | j
        | j                   |                     |j        j        g            dS )z
        L{DirtyReactorAggregateError}s are I{not} reported as errors if the
        L{UncleanWarningsReporterWrapper} is used.
        r%  N)r   r   rz   rQ   r'  r(  r#  r)  r*  ra   r   re   _originalReporterrd   r   s     r)   test_warningsMaskErrorsz)DirtyReactorTests.test_warningsMaskErrors  s    
 00A0U0U0UVVO++--OIO	
 	
 	
 	18"=====r,   c                    t          t          j        | j                            }|                    | j        | j        j        | j        j        df           | 	                    t          |j        j                  d           | 	                    |j        j        d         d         j        | j        j                   | 	                    |j        j        d         d         j        | j        j                   dS )a  
        Some annoying stuff can pass three-tuples to addError instead of
        Failures (like PyUnit). The wrapper, of course, handles this case,
        since it is a part of L{twisted.trial.itrial.IReporter}! But it does
        not convert L{DirtyReactorAggregateError} to warnings in this case,
        because nobody should be passing those in the form of three-tuples.
        r%  Nr!   r   )r   r   rz   rQ   ra   r   r#  rE   rf   re   rD   r-  rd   r   s     r)   test_dealsWithThreeTuplesz+DirtyReactorTests.test_dealsWithThreeTuples  s     00A0U0U0UVV	DO$8$/:OQU#VWWWV5<==qAAA$+A.q168L	
 	
 	
 	$+A.q179N	
 	
 	
 	
 	
r,   N)	r8   r9   r:   r;   r\   r!  r+  r.  r0  r<   r,   r)   r  r    si         = = =
? ? ?
 
 
> > > 
 
 
 
 
r,   r  c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )TrialNamesTestsc                 ^    t                      | _        t          j        d          | _        d S r   )r   r   r   FooTestr   r7   s    r)   r\   zTrialNamesTests.setUp   s"    jjN:..			r,   c                     t          j        | j                  }|                    | j                   | j                                        }|                     || j                                        dz              d S )Nz ... )r   r   r   r   r   r   re   idr   s      r)   r   z$TrialNamesTests.test_verboseReporter$  sh    -dk::###%%'''!9:::::r,   c                 X   t          j        | j                  }|                    | j                   | j                                        }|                                d                                         }|                     ||	                    | j                  dz              d S r   r  r   s      r)   r  z!TrialNamesTests.test_treeReporter*  r  r,   c                     t          j        | j                  }|                     |                    |           d           dS )zA docstringtest_treeReporterWithDocstringsN)r   r  r   re   r  r   s     r)   r9  z/TrialNamesTests.test_treeReporterWithDocstrings1  s?    &t{33..t446WXXXXXr,   c                     t          j        | j                  }|                    | j                  }|                     |d           d S r   r  r   s      r)   r	  z#TrialNamesTests.test_getDescription6  r
  r,   N)r8   r9   r:   r\   r   r  r9  r	  r<   r,   r)   r2  r2    se        / / /; ; ;L L LY Y Y
- - - - -r,   r2  c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )	SkipTestsz=
    Tests for L{reporter.Reporter}'s handling of skips.
    c                     t                      | _        t          j        | j                  | _        t          j        d          | _        d S r   r   r   r   rz   r[   r   r4  r   r7   s    r)   r\   zSkipTests.setUpA  6    jj'44N:..			r,   c                 *    t          |j                  S )zF
        Get the number of skips that happened to a reporter.
        )rD   skipsr   s     r)   	_getSkipszSkipTests._getSkipsF  s     6<   r,   c                     | j                             | j        d           |                     |                     | j                   d           d S )Nsome reasonr!   )r[   addSkipr   re   rB  r7   s    r)   test_accumulationzSkipTests.test_accumulationL  sF    DI}55544a88888r,   c                     | j                             | j        d           |                     d| j                                                    d S )NrD  T)r[   rE  r   re   wasSuccessfulr7   s    r)   test_successzSkipTests.test_successP  sF    DI}555t{88::;;;;;r,   c                    | j                             | j        d           | j                                          | j                                                                        d         }d}|                     |                    |                     | 	                    |t          |          d                                         d           dS )z
        The summary of a successful run with skips indicates that the test
        suite passed and includes the number of skips.
        rD  r   PASSED Nz	(skips=1))r[   rE  r   r   r   r   r   rC   
startswithre   rD   r  r(   rQ   prefixs      r)   test_summaryzSkipTests.test_summaryT  s    
 	DI}555%%''2244R8))&11222F.4466DDDDDr,   c                 *   | j                             | j        d           | j                                          | j                                                                        d         }|                     |                                d           dS )zw
        The output at the end of a test run with skips includes the reasons
        for skipping those tests.
        rD     N)	r[   rE  r   r   r   r   r   re   r  r{   s     r)   test_basicErrorszSkipTests.test_basicErrors`  sz    
 	DI}555%%''2244Q777777r,   c                    | j                             | j        d           | j                                          | j                                                                        d         }|                     |d           dS )z
        Tests can be skipped without specifying a reason by setting the 'skip'
        attribute to True. When this happens, the test output includes 'True'
        as the reason.
        TrQ  TrueN)r[   rE  r   r   r   r   r   re   r{   s     r)   test_booleanSkipzSkipTests.test_booleanSkipj  sr     	DIt,,,%%''2244Q7(((((r,   c                    	 ddz   n# t           $ r}|}Y d}~nd}~ww xY w| j                            | j        |           | j                                         d                    | j                                                                        dd                   	                                }| 
                    |t          |                     dS )z
        Skips can be raised as errors. When this happens, the error is
        included in the summary at the end of the test suite.
        r!   r   N
rQ  r   )rt   r[   rE  r   r   joinr   r   r   r  re   rK   r(   rh   r   rQ   s       r)   test_exceptionSkipzSkipTests.test_exceptionSkipu  s    
	EEE 	 	 	EEEEEE	DIu---4;//11<<>>qsCDDJJLLU,,,,,    
N)r8   r9   r:   r;   r\   rB  rF  rI  rO  rR  rU  rZ  r<   r,   r)   r<  r<  <  s         / / /
! ! !9 9 9< < <
E 
E 
E8 8 8	) 	) 	)- - - - -r,   r<  c                       e Zd ZdZd Zd ZdS )UncleanWarningSkipTestszh
    Tests for skips on a L{reporter.Reporter} wrapped by an
    L{UncleanWarningsReporterWrapper}.
    c                 l    t                               |            t          | j                  | _        d S r&   )r<  r\   r   r[   r7   s    r)   r\   zUncleanWarningSkipTests.setUp  )    4T[AAr,   c                 4    t          |j        j                  S )z}
        Get the number of skips that happened to a reporter inside of an
        unclean warnings reporter wrapper.
        )rD   r-  rA  r   s     r)   rB  z!UncleanWarningSkipTests._getSkips  s    
 6+1222r,   N)r8   r9   r:   r;   r\   rB  r<   r,   r)   r]  r]    s?         
B B B3 3 3 3 3r,   r]  c                   f    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd ZdS )	TodoTestsz=
    Tests for L{reporter.Reporter}'s handling of todos.
    c                     t                      | _        t          j        | j                  | _        t          j        d          | _        d S r   r>  r7   s    r)   r\   zTodoTests.setUp  r?  r,   c                     |j         S )zH
        Get the expected failures that happened to a reporter.
        )expectedFailuresr   s     r)   	_getTodoszTodoTests._getTodos  s     &&r,   c                     |j         S )zK
        Get the unexpected successes that happened to a reporter.
        )unexpectedSuccessesr   s     r)   _getUnexpectedSuccessesz!TodoTests._getUnexpectedSuccesses  s     ))r,   c                 
   | j                             | j        t          t	                                t          d                     |                     t          |                     | j                             d           dS )zh
        L{reporter.Reporter} accumulates the expected failures that it
        is notified of.
        todo!r!   N)	r[   addExpectedFailurer   r   rt   r   re   rD   rf  r7   s    r)   rF  zTodoTests.test_accumulation  so    
 	&&Iwy{{++Xg->->	
 	
 	
 	T^^DK88991=====r,   c                    t          t                                }| j                            | j        |           |                     | j                  \  \  }}}|                     || j                   |                     ||           |                     t          |          t          t          d                               dS )z
        If no C{Todo} is provided to C{addExpectedFailure}, then
        L{reporter.Reporter} makes up a sensible default.

        This allows standard Python unittests to use Twisted reporters.
        Test expected to failN)	r   rt   r[   rl  r   rf  re   reprr   )r(   rj   r   r   todos        r)   test_noTodoProvidedzTodoTests.test_noTodoProvided  s     )++&&&&ty'::: $t{ ; ;	$tty)))(((dT(3J*K*K%L%LMMMMMr,   c                     | j                             | j        t          t	                                t          d                     |                     d| j                                                    dS )zU
        A test run is still successful even if there are expected failures.
        rk  TN)r[   rl  r   r   rt   r   re   rH  r7   s    r)   rI  zTodoTests.test_success  sg     	&&Iwy{{++Xg->->	
 	
 	
 	t{88::;;;;;r,   c                 0   | j                             | j        t          d                     |                     d| j                                                    |                     t          |                     | j                             d           dS )z
        A test which is marked as todo but succeeds will have an unexpected
        success reported to its result. A test run is still successful even
        when this happens.
        zHeya!Tr!   N)r[   addUnexpectedSuccessr   r   re   rH  rD   ri  r7   s    r)   test_unexpectedSuccessz TodoTests.test_unexpectedSuccess  s~     	((HW4E4EFFFt{88::;;;T99$+FFGGKKKKKr,   c                 2   | j                             | j                   |                     | j                   \  \  }}|                     || j                   |                     t          |          t          t          d                               dS )aL  
        A test which is marked as todo but succeeds will have an unexpected
        success reported to its result. A test run is still successful even
        when this happens.

        If no C{Todo} is provided, then we make up a sensible default. This
        allows standard Python unittests to use Twisted reporters.
        rn  N)r[   rt  r   ri  re   ro  r   r(   r   rp  s      r)   test_unexpectedSuccessNoTodoz&TodoTests.test_unexpectedSuccessNoTodo  s     	((33355dkBB$ty)))dT(3J*K*K%L%LMMMMMr,   c                    | j                             | j        t          t	                                t          d                     | j                                          | j                                        	                                d         }d}| 
                    |                    |                     |                     |t          |          d                                         d           dS )z{
        The reporter's C{printSummary} method should print the number of
        expected failures that occurred.
        rD  r   rK  Nz(expectedFailures=1))r[   rl  r   r   rt   r   r   r   r   r   rC   rL  re   rD   r  rM  s      r)   rO  zTodoTests.test_summary  s    
 	&&Iwy{{++Xm-D-D	
 	
 	
 	%%''2244R8))&11222F.44668NOOOOOr,   c                 x   | j                             | j        t          t	                                t          d                     | j                                          | j                                        	                                d         
                                }|                     |d           dS )zd
        The reporter's L{printErrors} method should include the value of the
        Todo.
        rD  rQ  zReason: 'some reason'N)r[   rl  r   r   rt   r   r   r   r   r   r  re   r{   s     r)   rR  zTodoTests.test_basicErrors  s    
 	&&Iwy{{++Xm-D-D	
 	
 	
 	%%''2244Q7==??!899999r,   c                     | j                             | j        t          t	                                d           |                     t          | j         j                   dS )z
        Booleans CAN'T be used as the value of a todo. Maybe this sucks. This
        is a test for current behavior, not a requirement.
        TN)r[   rl  r   r   rt   rs   r   r7   s    r)   test_booleanTodozTodoTests.test_booleanTodo  sM    
 	&&ty')++2F2FMMM)T[%566666r,   c                    	 ddz   n# t           $ r}|}Y d}~nd}~ww xY w| j                            | j        t	          |          t          d                     | j                                         d                    | j        	                                
                                dd                                                   }|                     t          |          |v            dS )zk
        The exception for expected failures should be shown in the
        C{printErrors} output.
        r!   r   Nrk  rW  rQ  )rt   r[   rl  r   r   r   r   rX  r   r   r   r  rC   rK   rY  s       r)   test_exceptionTodozTodoTests.test_exceptionTodo  s    
	EEE 	 	 	EEEEEE	&&ty'%..(7BSBSTTT4;//11<<>>qrrBCCIIKKE

f,-----r[  c                      G d dt                     } |d          }|                    | j                   |                     t	          |                     | j                            d           dS )t
        Tests that use the standard library C{expectedFailure} feature worth
        with Trial reporters.
        c                   $    e Zd Zed             ZdS )@TodoTests.test_standardLibraryCompatibilityFailure.<locals>.Testc                 0    |                      d           d S )Nrj   )failr7   s    r)   r   zJTodoTests.test_standardLibraryCompatibilityFailure.<locals>.Test.test_fail  s    		)$$$$$r,   N)r8   r9   r:   r	   r   r<   r,   r)   Testr    s-        % % _% % %r,   r  r   r!   N)StdlibTestCaser   r[   re   rD   rf  r(   r  r   s      r)   (test_standardLibraryCompatibilityFailurez2TodoTests.test_standardLibraryCompatibilityFailure  s    	% 	% 	% 	% 	%> 	% 	% 	%
 tK  T^^DK88991=====r,   c                      G d dt                     } |d          }|                    | j                   |                     t	          |                     | j                            d           dS )r  c                   $    e Zd Zed             ZdS )@TodoTests.test_standardLibraryCompatibilitySuccess.<locals>.Testc                     d S r&   r<   r7   s    r)   rI  zMTodoTests.test_standardLibraryCompatibilitySuccess.<locals>.Test.test_success+  s    r,   N)r8   r9   r:   r	   rI  r<   r,   r)   r  r  *  s-          _  r,   r  rI  r!   N)r  r   r[   re   rD   ri  r  s      r)   (test_standardLibraryCompatibilitySuccessz2TodoTests.test_standardLibraryCompatibilitySuccess$  s    	 	 	 	 	> 	 	 	
 tN##T99$+FFGGKKKKKr,   N)r8   r9   r:   r;   r\   rf  ri  rF  rq  rI  ru  rx  rO  rR  r|  r~  r  r  r<   r,   r)   rb  rb    s        / / /
' ' '* * *> > >N N N< < <L L LN N NP P P
: 
: 
:7 7 7. . .> > >L L L L Lr,   rb  c                   $    e Zd ZdZd Zd Zd ZdS )UncleanWarningTodoTestszJ
    Tests for L{UncleanWarningsReporterWrapper}'s handling of todos.
    c                 l    t                               |            t          | j                  | _        d S r&   )rb  r\   r   r[   r7   s    r)   r\   zUncleanWarningTodoTests.setUp9  r_  r,   c                     |j         j        S )zt
        Get the  todos that happened to a reporter inside of an unclean
        warnings reporter wrapper.
        )r-  re  r   s     r)   rf  z!UncleanWarningTodoTests._getTodos=  s    
 '88r,   c                     |j         j        S )z
        Get the number of unexpected successes that happened to a reporter
        inside of an unclean warnings reporter wrapper.
        )r-  rh  r   s     r)   ri  z/UncleanWarningTodoTests._getUnexpectedSuccessesD  s    
 ';;r,   N)r8   r9   r:   r;   r\   rf  ri  r<   r,   r)   r  r  4  sN         B B B9 9 9< < < < <r,   r  c                       e Zd ZdZd Zd ZdS )MockColorizerzR
    Used by TreeReporterTests to make sure that output is colored correctly.
    c                     g | _         d S r&   r   )r(   r   s     r)   r*   zMockColorizer.__init__Q  s    r,   c                 >    | j                             ||f           d S r&   )r   append)r(   textcolors      r)   r/   zMockColorizer.writeT  s     &&&&&r,   N)r8   r9   r:   r;   r*   r/   r<   r,   r)   r  r  L  s<           ' ' ' ' 'r,   r  c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TreeReporterTestsc                    t          j        d          | _        t                      | _        t          j        | j                  | _        t          | j                  | j        _	        | j        j	        j
        | _
        d S r   )r   r4  r   r   r   r   r  r[   r  
_colorizerr   r7   s    r)   r\   zTreeReporterTests.setUpY  sY    N:..	jj+DK88!.t{!;!;;)-r,   c                 P    	 ddz   n# t           $ r t                      }Y nw xY w|S )Nr!   r   )r   r   )r(   r   s     r)   	makeErrorzTreeReporterTests.makeError`  s?    	EEE  	 	 			AAA	s    ##c                 ~   | j                             | j                   | j                                          |                     | j        d         | j         j        df           |                     | j                                        	                                d         
                                d           dS )zw
        The summary in case of success should have a good count of successes
        and be colored properly.
        r!   PASSEDr   z(successes=1)N)r[   
addSuccessr   r   re   r   SUCCESSr   r   r   r  r7   s    r)   test_summaryColoredSuccessz,TreeReporterTests.test_summaryColoredSuccessg  s    
 	ty)))!t{':H&EFFFK  ""--//399;;_	
 	
 	
 	
 	
r,   c                    	 t          d          # t           $ r/ | j                            | t          j                               Y nw xY w| j                                         |                     | j        d         | j        j        df           |                     | j	        
                                                                d                                         d           dS )zt
        The summary in case of failure should have a good count of errors
        and be colored properly.
        r_   r!   FAILEDr   z
(errors=1)N)r`   r[   ra   rb   rc   r   re   r   FAILUREr   r   r   r  r7   s    r)   test_summaryColoredFailurez,TreeReporterTests.test_summaryColoredFailures  s    
	7u%%% 	7 	7 	7K  s|~~66666	7!t{':H&EFFF--//::<<R@FFHH,WWWWWs    6A
	A
c                    |                      ddg| j                            d                     |                      ddg| j                            d                     |                      dg| j                            d                     |                      g | j                            d                     dS )z
        The tree needs to get the segments of the test ID that correspond
        to the module and class that it belongs to.
        zfoo.barbazzfoo.bar.baz.quxr_   r   zfoo.bar.bazN)re   r[   _getPreludeSegmentsr7   s    r)   test_getPreludez!TreeReporterTests.test_getPrelude  s    
 	 ? ?@Q R R	
 	
 	
 	%)H)H)W)WXXX%$+"A"A)"L"LMMMT[<<UCCDDDDDr,   c                    	 t          d          # t           $ r` | j                            | t          j                               | j                            | j        t          j                               Y nw xY w	 t          d          # t           $ rC t          j        d          }| j                            |t          j                               Y nw xY w| j                                         | j        	                    | j        j
        | j        j                  }|                     |d         d         | | j        g           |                     |d         d         |g           dS )z
        If two different tests have the same error, L{Reporter._groupResults}
        includes them together in one of the tuples in the list it returns.
        r_   r   test_barr   r!   N)r`   r[   ra   rb   rc   r   r   r4  r   _groupResultsrd   r   re   )r(   rr   groupeds      r)   test_groupResultsz#TreeReporterTests.test_groupResults  s^   
	<u%%% 	< 	< 	<K  s|~~666K  CLNN;;;;;	<	8u%%% 	8 	8 	8N:..EK  77777	8 	+++K C
 
 	Aty(9:::A00000s#    A'A;:A;?B A
CCc           	         d }t          j        d          }t          j        d          }t          j        d          }| j                            d|df|df|dfg|           |                     | j                                        d| j        j        |	                                |	                                |	                                dz             d	S )
z
        L{Reporter._printResults} uses the results list and formatter callable
        passed to it to produce groups of results to write to its output
        stream.
        c                 &    t          |           dz   S )NrW  )rK   )ns    r)   	formatterz6TreeReporterTests.test_printResults.<locals>.formatter  s    q66D= r,   r   r  FOOr!   r   zW%(double separator)s
FOO
1

%(first)s
%(second)s
%(double separator)s
FOO
2

%(third)s
)zdouble separatorfirstsecondthirdN)
r   r4  r   r[   _printResultsre   r   r   _doubleSeparatorr6  )r(   r  r  r  r  s        r)   test_printResultsz#TreeReporterTests.test_printResults  s    	! 	! 	! z**
++!*--!!UAJeQZ8)	
 	
 	
 	K  ""
 %)K$@ ))++	 	
 	
 	
 	
 	
r,   N)
r8   r9   r:   r\   r  r  r  r  r  r  r<   r,   r)   r  r  X  s        . . .  

 

 

X X X
E 
E 
E1 1 1,#
 #
 #
 #
 #
r,   r  c                   l    e Zd ZU dZej        Zeej	                 e
d<   d Zd Zd Zd Zd Zd Zd	 Zd
S )ReporterInterfaceTestsas  
    Tests for the bare interface of a trial reporter.

    Subclass this test case and provide a different 'resultFactory' to test
    that a particular reporter implementation will work with the rest of
    Trial.

    @cvar resultFactory: A callable that returns a reporter to be tested. The
        callable must take the same parameters as L{reporter.Reporter}.
    resultFactoryc                     t          j        d          | _        t                      | _        t          j                    | _        |                     | j        | j                  | _	        d S )Nr   	publisher)
r   r4  r   r   r   r   LogPublisherr  r  r[   r7   s    r)   r\   zReporterInterfaceTests.setUp  sP    N:..	jj)++(((OOr,   c                 F    |                      d| j        j                   dS )z4
        shouldStop is False to begin with.
        FN)re   r[   
shouldStopr7   s    r)   test_shouldStopInitiallyFalsez4ReporterInterfaceTests.test_shouldStopInitiallyFalse  s%     	 677777r,   c                 x    | j                                          |                     d| j         j                   dS )zG
        shouldStop becomes True soon as someone calls stop().
        TN)r[   stopre   r  r7   s    r)   test_shouldStopTrueAfterStopz3ReporterInterfaceTests.test_shouldStopTrueAfterStop  s9     	t{566666r,   c                 `    |                      d| j                                                   dS )zS
        wasSuccessful() is True when there have been no results reported.
        TN)re   r[   rH  r7   s    r)   test_wasSuccessfulInitiallyTruez6ReporterInterfaceTests.test_wasSuccessfulInitiallyTrue  s.     	t{88::;;;;;r,   c                     | j                             | j                   |                     d| j                                                    dS )zg
        wasSuccessful() is True when there have been only successes, False
        otherwise.
        TN)r[   r  r   re   rH  r7   s    r)   $test_wasSuccessfulTrueAfterSuccessesz;ReporterInterfaceTests.test_wasSuccessfulTrueAfterSuccesses  sF    
 	ty)))t{88::;;;;;r,   c                     	 ddz   nA# t           $ r4 | j                            | j        t	          j                               Y nw xY w|                     d| j                                                   dS )zP
        wasSuccessful() becomes False after errors have been reported.
        r!   r   FN)r   r[   ra   r   rb   rc   re   rH  r7   s    r)   "test_wasSuccessfulFalseAfterErrorsz9ReporterInterfaceTests.test_wasSuccessfulFalseAfterErrors  s}    	<EEE  	< 	< 	<K  CLNN;;;;;	< 9 9 ; ;<<<<<s    ;AAc                    	 |                      d           nA# | j        $ r4 | j                            | j        t          j                               Y nw xY w|                     d| j                                                   dS )zR
        wasSuccessful() becomes False after failures have been reported.
        r_   FN)	r  rm   r[   rn   r   rb   rc   re   rH  r7   s    r)   $test_wasSuccessfulFalseAfterFailuresz;ReporterInterfaceTests.test_wasSuccessfulFalseAfterFailures  s    	>IIe$ 	> 	> 	>K""49clnn=====	> 9 9 ; ;<<<<<s    ;AAN)r8   r9   r:   r;   r   rz   r  r   r   	IReporter__annotations__r\   r  r  r  r  r  r  r<   r,   r)   r  r    s         	 	 -5,=M4()===P P P8 8 87 7 7< < << < <= = == = = = =r,   r  c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )ReporterTestsz8
    Tests for the base L{reporter.Reporter} class.
    c                 j    t                               |            d| _        | j        | j        _        d S r  )r  r\   _timerr  r[   r7   s    r)   r\   zReporterTests.setUp  s/    $$T***#}r,   c                 0    | xj         dz  c_         | j         S Nr!   )r  r7   s    r)   r  zReporterTests._getTime  s    q{r,   c                 b   | j                             | j                   | j                             | j                   |                     | j         j        dk               |                     | j         j        d           |                     | j                                         d           d S )Nr   r!   T)	r[   r   r   stopTestrC   	_lastTimere   testsRunrH  r7   s    r)   test_startStopzReporterTests.test_startStop  s    di(((TY'''-1222-q1112244d;;;;;r,   c                    |                      t          | j                            }|                    d           |                     | j                                        d           | j                            d           | j                            d           |                    dd           |                     | j                                        d           dS )	zE
        Test that the reporter safely writes to its stream.
        r%  HellozHello
r   z	Hello %s!WorldzHello World!
N)r  r$   r   _writelnre   r   truncateseekr   s     r)   test_brokenStreamzReporterTests.test_brokenStream!  s     ##<+D+D#EE   --//;;;QW-----//1ABBBBBr,   c           	         t          d          }d}d}d}| j                            ||||           |                     | j                                        d|||                    d          d         |fz             d	S )
z
        L{reporter.Reporter} observes warnings emitted by the Twisted log
        system and writes them to its output stream.
        zsome warning textexceptions.RuntimeWarningzpath/to/some/file.pyG   warningcategoryfilenamelinenoz%s:%d: %s: %s
r   r   N)RuntimeWarningr  msgre   r   r   r   )r(   messager  r  r  s        r)   test_warningzReporterTests.test_warning-  s    
 !!455.)h& 	 	
 	
 	
 	K  ""68>>#3F3Fr3JG TT	
 	
 	
 	
 	
r,   c                 V    |                                   |                                   dS )zj
        A warning emitted twice within a single test is only written to the
        stream once.
        N)r  r7   s    r)   test_duplicateWarningSuppressedz-ReporterTests.test_duplicateWarningSuppressed>  s0     	 	r,   c                 N   |                      d          }| j                            |           | j                            d           | j                                         |                                  | j                            d           | j                                         | j                            |           | j                            |           | j                            d           | j                                         |                                  dS )zn
        A warning emitted again after a new test has started is written to the
        stream again.
        test_warningEmittedForNewTestr   N)	__class__r[   r   r   r  r  r  r  r(   r   s     r)   r  z+ReporterTests.test_warningEmittedForNewTestI  s   
 ~~=>>d### 	 	 	 	T"""d### 	 	r,   c                 N   | j                                          | j                            d           | j                                         | j                            t          d          ddd           |                     | j        	                                d           dS )	zl
        L{reporter.Reporter} stops observing log events when its C{done} method
        is called.
        r   zsome messager  zfile/name.py   r  r@   N)
r[   r   r   r  r  r  r  r  re   r   r7   s    r)   test_stopObservingz ReporterTests.test_stopObservingi  s    
 	">220#	 	 	
 	
 	
 	--//44444r,   N)r8   r9   r:   r;   r\   r  r  r  r  r  r  r  r<   r,   r)   r  r    s         - - -
  < < <
C 
C 
C
 
 
"	 	 	  @5 5 5 5 5r,   r  c                       e Zd Zd ZdS )SafeStreamTestsc                     t                      }t          |          }t          j        |          }|                    d           |                     |                                d           dS )z
        Test that L{reporter.SafeStream} successfully write to its original
        stream even if an interrupt happens during the write.
        r  N)r   r$   r   
SafeStreamr/   re   r   )r(   r   brokensafes       r)   	test_safezSafeStreamTests.test_safe{  sb    
 f%%"6**

7**G44444r,   N)r8   r9   r:   r  r<   r,   r)   r  r  z  s#        	5 	5 	5 	5 	5r,   r  c                       e Zd ZU dZej        Zeej	                 e
d<   d Zd Zd Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd ZdS )SubunitReporterTestszx
    Tests for the subunit reporter.

    This just tests that the subunit reporter implements the basic interface.
    r  c                    t           j        t          d          t          j        d          | _        t                      | _        t          j	                    | _
        |                     | j        | j
                  | _        d S )Nz2Subunit not installed, cannot test SubunitReporterr   r  )r   TestProtocolClientr   r   r4  r   r   r   r   r  r  r  r[   r7   s    r)   r\   zSubunitReporterTests.setUp  sh    &.OPPPN:..	ii)++(((OOr,   c                 Z   t                      }t          j        |          } t          ||          |i |}|                                } t          | j        |          |i |}|                     ||           |                     || j                                                   dS )a  
        Assert that 'methodName' on L{SubunitReporter} forwards to the
        equivalent method on subunit.

        Checks that the return value from subunit is returned from the
        L{SubunitReporter} and that the reporter writes the same data to its
        stream as subunit does to its own.

        Assumes that the method on subunit has the same name as the method on
        L{SubunitReporter}.
        N)r   r   r  getattrr   r[   re   r   )	r(   
methodNameargskwargsr   subunitClientsubunitReturnsubunitOutputreporterReturns	            r)   assertForwardsToSubunitz,SubunitReporterTests.assertForwardsToSubunit  s      3F;;:z::DKFKK))9j994J6JJ777(<(<(>(>?????r,   c                     t          ||d          }|dS t          |          D ]I}	 t          ||           |                     t          |||           1# t
          t          f$ r Y  dS w xY wdS )a  
        Remove 'methodName' from 'klass'.

        If 'klass' does not have a method named 'methodName', then
        'removeMethod' succeeds silently.

        If 'klass' does have a method named 'methodName', then it is removed
        using delattr. Also, methods of the same name are removed from all
        base classes of 'klass', thus removing the method entirely.

        @param klass: The class to remove the method from.
        @param methodName: The name of the method to remove.
        N)r  r   delattr
addCleanupsetattrAttributeErrorrO   )r(   klassr  methodbases        r)   removeMethodz!SubunitReporterTests.removeMethod  s     
D11>F5MM 	C 	CDCj))) z6BBBB #I.   	C 	Cs   AA,+A,c                    |                      t          j        d           	 ddz   nB# t          $ r5 | j                            | j        t          j                    d           Y nw xY w| j	        
                                }| j	                            d           | j	                            d           | j                            | j                   | j	        
                                }|                     ||           dS )z
        Some versions of subunit don't have "addExpectedFailure". For these
        versions, we report expected failures as successes.
        rl  r!   r   rp  N)r  r   r  r   r[   rl  r   rb   rc   r   r   r  r  r  re   )r(   expectedFailureOutputsuccessOutputs      r)   .test_subunitWithoutAddExpectedFailureInstalledzCSubunitReporterTests.test_subunitWithoutAddExpectedFailureInstalled  s    
 	(57KLLL	NEEE  	N 	N 	NK**49clnnfMMMMM	N $ 4 4 6 6Qty))),,..(=>>>>>s   ( <A'&A'c                    |                      t          j        d           | j                            | j        d           | j                                        }| j                            d           | j        	                    d           | j        
                    | j                   | j                                        }|                     ||           dS )zz
        Some versions of subunit don't have "addSkip". For these versions, we
        report skips as successes.
        rE  reasonr   N)r  r   r  r[   rE  r   r   r   r  r  r  re   )r(   
skipOutputr  s      r)   #test_subunitWithoutAddSkipInstalledz8SubunitReporterTests.test_subunitWithoutAddSkipInstalled  s    
 	(5yAAADIx000[))++
Qty))),,..
33333r,   c                 
   g fd}|| j         j        _        	 ddz   nD# t          $ r7 t	          j                    }| j                             | j        |d           Y nw xY w|                     | j        |fg           dS )z
        Some versions of subunit have "addExpectedFailure". For these
        versions, when we call 'addExpectedFailure' on the test result, we
        pass the error and test through to the subunit client.
        c                 6                         | |f           d S r&   r  )r   r   addExpectedFailureCallss     r)   rl  zUSubunitReporterTests.test_addExpectedFailurePassedThrough.<locals>.addExpectedFailure  s!    #**D%=99999r,   r!   r   rp  N)r[   _subunitrl  r   rb   rc   r   re   )r(   rl  rc   r$  s      @r)   $test_addExpectedFailurePassedThroughz9SubunitReporterTests.test_addExpectedFailurePassedThrough  s     #%	: 	: 	: 	: 	:
 3E/	HEEE  	H 	H 	H|~~HK**49hGGGGG	H 	0DIx3H2IJJJJJs   ! >A"!A"c                     g fd}|| j         j        _        | j                             | j        d           |                     | j        dfg           dS )z
        Some versions of subunit have "addSkip". For these versions, when we
        call 'addSkip' on the test result, we pass the test and reason through
        to the subunit client.
        c                 6                         | |f           d S r&   r#  )r   r  addSkipCallss     r)   rE  zESubunitReporterTests.test_addSkipSendsSubunitAddSkip.<locals>.addSkip  s!    v/////r,   r  N)r[   r%  rE  r   re   )r(   rE  r)  s     @r)   test_addSkipSendsSubunitAddSkipz4SubunitReporterTests.test_addSkipSendsSubunitAddSkip  sr     	0 	0 	0 	0 	0
 (/$DIx000H(='>?????r,   c                     | j                                          |                     d| j                                                   dS )z
        The subunit reporter doesn't need to print out a summary -- the stream
        of results is everything. Thus, done() does nothing.
        r,   N)r[   r   re   r   r   r7   s    r)   test_doneDoesNothingz)SubunitReporterTests.test_doneDoesNothing  sB    
 	dk224455555r,   c                 <    |                      d| j                   dS )zT
        SubunitReporter.startTest() sends the subunit 'startTest' message.
        r   Nr  r   r7   s    r)   #test_startTestSendsSubunitStartTestz8SubunitReporterTests.test_startTestSendsSubunitStartTest  s"     	$$[$)<<<<<r,   c                 <    |                      d| j                   dS )zR
        SubunitReporter.stopTest() sends the subunit 'stopTest' message.
        r  Nr.  r7   s    r)   !test_stopTestSendsSubunitStopTestz6SubunitReporterTests.test_stopTestSendsSubunitStopTest  s"     	$$Z;;;;;r,   c                 <    |                      d| j                   dS )zV
        SubunitReporter.addSuccess() sends the subunit 'addSuccess' message.
        r  Nr.  r7   s    r)   %test_addSuccessSendsSubunitAddSuccessz:SubunitReporterTests.test_addSuccessSendsSubunitAddSuccess   s"     	$$\49=====r,   c                     	 ddz   n## t           $ r t          j                    }Y nw xY w|                     d| j        |           dS )zR
        SubunitReporter.addError() sends the subunit 'addError' message.
        r!   r   ra   N)r   rb   rc   r  r   )r(   r   s     r)   !test_addErrorSendsSubunitAddErrorz6SubunitReporterTests.test_addErrorSendsSubunitAddError&  s\    	#EEE  	# 	# 	#LNNEEE	#$$ZEBBBBBs    ((c                     	 |                      d           n## | j        $ r t          j                    }Y nw xY w|                     d| j        |           dS )zV
        SubunitReporter.addFailure() sends the subunit 'addFailure' message.
        hellorn   N)r  rm   rb   rc   r  r   )r(   rj   s     r)   %test_addFailureSendsSubunitAddFailurez:SubunitReporterTests.test_addFailureSendsSubunitAddFailure0  si    	%IIg$ 	% 	% 	%lnnGGG	%$$\49gFFFFFs    88c                 >   t                      }t          j        |          }|                    | j                   |                                }| j                            | j                   |                     || j	                                                   dS )z
        SubunitReporter.addFailure() sends the subunit 'addSuccess' message,
        since subunit doesn't model unexpected success.
        N)
r   r   r  r  r   r   r[   rt  re   r   )r(   r   r  r  s       r)   /test_addUnexpectedSuccessSendsSubunitAddSuccesszDSubunitReporterTests.test_addUnexpectedSuccessSendsSubunitAddSuccess:  s    
  3F;;  +++))((333(<(<(>(>?????r,   c                     t          j                                        d          }|                    | j                   | j                                        }|                     d|           dS )zC
        Load-time errors are reported like normal errors.
        doesntexists   doesntexistN)r   r   r   r   r[   r   r   assertIn)r(   r   rQ   s      r)   test_loadTimeErrorsz(SubunitReporterTests.test_loadTimeErrorsF  sc      ""--m<<%%'' 	nf-----r,   N)r8   r9   r:   r;   r   SubunitReporterr  r   r   r  r  r\   r  r  r  r   r&  r*  r,  r/  r1  r3  r5  r8  r:  r>  r<   r,   r)   r  r    s6          -5,DM4()DDDP P P@ @ @*C C C2? ? ?"4 4 4K K K*@ @ @"6 6 6= = =< < <> > >C C CG G G
@ 
@ 
@	. 	. 	. 	. 	.r,   r  c                       e Zd ZdZd ZdS ) SubunitReporterNotInstalledTestszD
    Test behaviour when the subunit reporter is not installed.
    c                     t                      }|                     t          dd           |                     t          t          j        |          }|                     dt          |                     dS )z
        If subunit is not installed, TestProtocolClient will be None, and
        SubunitReporter will raise an error when you try to construct it.
        r  NzSubunit not available)r   patchr   rs   rt   r?  re   rK   )r(   r   rh   s      r)   test_subunitNotInstalledz9SubunitReporterNotInstalledTests.test_subunitNotInstalledW  sa    
 

814888i)A6JJ0#a&&99999r,   N)r8   r9   r:   r;   rD  r<   r,   r)   rA  rA  R  s-         : : : : :r,   rA  c                   >    e Zd ZU ej        Zeej                 e	d<   dS )TimingReporterTestsr  N)
r8   r9   r:   r   TimingTextReporterr  r   r   r  r  r<   r,   r)   rF  rF  b  s-         ,4,GM4()GGGGGr,   rF  c                   F    e Zd ZdZd Zd ZddZd Zd ZddZ	d	 Z
d
 ZdS )LoggingReporterzJ
    Simple reporter that stores the last test that was passed to it.
    c                 H    t          j        j        | g|R i | d | _        d S r&   )r   rz   r*   r   )r(   r	  r
  s      r)   r*   zLoggingReporter.__init__k  s1    "49$999&999			r,   c                     || _         d S r&   r   )r(   r   r   s      r)   ra   zLoggingReporter.addErroro  r+   r,   Nc                     || _         d S r&   rL  )r(   r   rj   rp  s       r)   rl  z"LoggingReporter.addExpectedFailurer  r+   r,   c                     || _         d S r&   rL  )r(   r   rj   s      r)   rn   zLoggingReporter.addFailureu  r+   r,   c                     || _         d S r&   rL  )r(   r   skips      r)   rE  zLoggingReporter.addSkipx  r+   r,   c                     || _         d S r&   rL  rw  s      r)   rt  z$LoggingReporter.addUnexpectedSuccess{  r+   r,   c                     || _         d S r&   rL  r  s     r)   r   zLoggingReporter.startTest~  r+   r,   c                     || _         d S r&   rL  r  s     r)   r  zLoggingReporter.stopTest  r+   r,   r&   )r8   r9   r:   r;   r*   ra   rl  rn   rE  rt  r   r  r<   r,   r)   rI  rI  f  s                             r,   rI  c                   f    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd ZdS )AdaptedReporterTestsz
    L{reporter._AdaptedReporter} is a reporter wrapper that wraps all of the
    tests it receives before passing them on to the original reporter.
    c                 8    |                                  | _        d S r&   )getWrappedResultwrappedResultr7   s    r)   r\   zAdaptedReporterTests.setUp  s    !2244r,   c                 *    |                                 S r&   )r6  r  s     r)   _testAdapterz!AdaptedReporterTests._testAdapter  s    wwyyr,   c                 l    |                      |j        j        |                     |                     d S r&   )re   r-  r   rZ  )r(   rX  r   s      r)   assertWrappedz"AdaptedReporterTests.assertWrapped  s3    8=t?P?PQU?V?VWWWWWr,   c                 D    	 |# t           $ r t                      cY S w xY w)z
        Return a L{Failure} from raising the given exception.

        @param exceptionInstance: The exception to raise.
        @return: L{Failure}
        )BaseExceptionr   )r(   exceptionInstances     r)   
getFailurezAdaptedReporterTests.getFailure  s8    	## 	 	 	99	s    c                 R    t                      }t          j        || j                  S r&   )rI  r   _AdaptedReporterrZ  r   s     r)   rW  z%AdaptedReporterTests.getWrappedResult  s#     ""(1BCCCr,   c                     | j                             | |                     t                                           |                     | j         |            dS )zG
        C{addError} wraps its test with the provided adapter.
        N)rX  ra   r`  r`   r\  r7   s    r)   test_addErrorz"AdaptedReporterTests.test_addError  sL     	##D$//,..*I*IJJJ4-t44444r,   c                     | j                             | |                     t                                           |                     | j         |            dS )zI
        C{addFailure} wraps its test with the provided adapter.
        N)rX  rn   r`  AssertionErrorr\  r7   s    r)   test_addFailurez$AdaptedReporterTests.test_addFailure  sN     	%%dDOON<L<L,M,MNNN4-t44444r,   c                     | j                             | |                     t          d                               |                     | j         |            dS )zF
        C{addSkip} wraps its test with the provided adapter.
        	no reasonN)rX  rE  r`  r   r\  r7   s    r)   test_addSkipz!AdaptedReporterTests.test_addSkip  sP     	""4+9N9N)O)OPPP4-t44444r,   c                 p    | j                             |            |                     | j         |            dS )zH
        C{startTest} wraps its test with the provided adapter.
        N)rX  r   r\  r7   s    r)   test_startTestz#AdaptedReporterTests.test_startTest  s:     	$$T***4-t44444r,   c                 p    | j                             |            |                     | j         |            dS )zG
        C{stopTest} wraps its test with the provided adapter.
        N)rX  r  r\  r7   s    r)   test_stopTestz"AdaptedReporterTests.test_stopTest  s:     	##D)))4-t44444r,   c                     | j                             | |                     t                                t	          d                     |                     | j         |            dS )zQ
        C{addExpectedFailure} wraps its test with the provided adapter.
        ri  N)rX  rl  r`  r`   r   r\  r7   s    r)   test_addExpectedFailurez,AdaptedReporterTests.test_addExpectedFailure  s_     	--$//,..1143D3D	
 	
 	
 	4-t44444r,   c                     | j                             | |                     t                                           |                     | j         |            dS )z@
        C{addExpectedFailure} works without a C{Todo}.
        N)rX  rl  r`  r`   r\  r7   s    r)   test_expectedFailureWithoutTodoz4AdaptedReporterTests.test_expectedFailureWithoutTodo  sL     	--dDOOLNN4S4STTT4-t44444r,   c                     | j                             | t          d                     |                     | j         |            dS )zS
        C{addUnexpectedSuccess} wraps its test with the provided adapter.
        ri  N)rX  rt  r   r\  r7   s    r)   test_addUnexpectedSuccessz.AdaptedReporterTests.test_addUnexpectedSuccess  sD     	//d;6G6GHHH4-t44444r,   c                 p    | j                             |            |                     | j         |            dS )zB
        C{addUnexpectedSuccess} works without a C{Todo}.
        N)rX  rt  r\  r7   s    r)   !test_unexpectedSuccessWithoutTodoz6AdaptedReporterTests.test_unexpectedSuccessWithoutTodo  s:     	//5554-t44444r,   N)r8   r9   r:   r;   r\   rZ  r\  r`  rW  rd  rg  rj  rl  rn  rp  rr  rt  rv  r<   r,   r)   rU  rU    s         
5 5 5  X X X
 
 
D D D5 5 55 5 55 5 55 5 55 5 55 5 55 5 55 5 55 5 5 5 5r,   rU  c                        e Zd ZdZddZd ZdS )
FakeStreamz
    A fake stream which C{isatty} method returns some predictable.

    @ivar tty: returned value of C{isatty}.
    @type tty: C{bool}
    Tc                     || _         d S r&   tty)r(   r{  s     r)   r*   zFakeStream.__init__  s    r,   c                     | j         S r&   rz  r7   s    r)   isattyzFakeStream.isatty  s	    xr,   N)T)r8   r9   r:   r;   r*   r}  r<   r,   r)   rx  rx    sA                r,   rx  c                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )AnsiColorizerTestsz/
    Tests for L{reporter._AnsiColorizer}.
    c                 L    t           j                                        | _        d S r&   )rb   modulescopysavedModulesr7   s    r)   r\   zAnsiColorizerTests.setUp  s    K,,..r,   c                     t           j                                         t           j                            | j                   d S r&   )rb   r  clearupdater  r7   s    r)   tearDownzAnsiColorizerTests.tearDown  s5    4,-----r,   c                     |                      t          j                            t	          d                               dS )zq
        L{reporter._AnsiColorizer.supported} returns C{False} if the given
        stream is not a TTY.
        FN)assertFalser   _AnsiColorizer	supportedrx  r7   s    r)   test_supportedStdOutTTYz*AnsiColorizerTests.test_supportedStdOutTTY  s7    
 	0:::e;L;LMMNNNNNr,   c                     dt           j        d<   |                     t          j                            t                                           dS )zw
        L{reporter._AnsiColorizer.supported} returns C{False} if the curses
        module can't be imported.
        Ncursesrb   r  r  r   r  r  rx  r7   s    r)   test_supportedNoCursesz)AnsiColorizerTests.test_supportedNoCurses  s?    
 !%H0:::<<HHIIIIIr,   c                     G d d          } |            t           j        d<   |                     t          j                            t                                           |                     t          j                            t                                           |                     t           j        d         j        d           dS )a  
        L{reporter._AnsiColorizer.supported} returns C{True} if
        C{curses.tigetnum} returns more than 2 supported colors. It only tries
        to call C{curses.setupterm} if C{curses.tigetnum} previously failed
        with a C{curses.error}.
        c                   "    e Zd ZeZdZd Zd ZdS )>AnsiColorizerTests.test_supportedSetupTerm.<locals>.fakecursesr   c                 &    | xj         dz  c_         d S r  r\   r7   s    r)   	setuptermzHAnsiColorizerTests.test_supportedSetupTerm.<locals>.fakecurses.setupterm      

a



r,   c                 <    | j         rdS |                                 )NrQ  )r\   r   r(   rf   s     r)   tigetnumzGAnsiColorizerTests.test_supportedSetupTerm.<locals>.fakecurses.tigetnum  s    : '1**,,&r,   Nr8   r9   r:   r`   r   r\   r  r  r<   r,   r)   
fakecursesr    s<         EE     ' ' ' ' 'r,   r  r  r!   N)	rb   r  rC   r   r  r  rx  re   r\   r(   r  s     r)   test_supportedSetupTermz*AnsiColorizerTests.test_supportedSetupTerm  s    	' 	' 	' 	' 	' 	' 	' 	' !+
H/99*,,GGHHH/99*,,GGHHHX.4a88888r,   c                      G d d          } |            t           j        d<   |                     t          j                            t                                           dS )z
        L{reporter._AnsiColorizer.supported} returns C{False} and doesn't try
        to call C{curses.setupterm} if C{curses.tigetnum} returns something
        different than C{curses.error}.
        c                       e Zd ZeZd ZdS )GAnsiColorizerTests.test_supportedTigetNumWrongError.<locals>.fakecursesc                     t                      r&   )
ValueErrorr  s     r)   r  zPAnsiColorizerTests.test_supportedTigetNumWrongError.<locals>.fakecurses.tigetnum5  s     ll"r,   Nr8   r9   r:   r`   r   r  r<   r,   r)   r  r  2  s(         E# # # # #r,   r  r  Nr  r  s     r)    test_supportedTigetNumWrongErrorz3AnsiColorizerTests.test_supportedTigetNumWrongError+  sm    	# 	# 	# 	# 	# 	# 	# 	# !+
H0:::<<HHIIIIIr,   c                      G d d          } |            t           j        d<   |                     t          j                            t                                           dS )z
        L{reporter._AnsiColorizer.supported} returns C{False} if
        C{curses.tigetnum} returns less than 2 supported colors.
        c                       e Zd ZeZd ZdS )KAnsiColorizerTests.test_supportedTigetNumNotEnoughColor.<locals>.fakecursesc                     dS r  r<   r  s     r)   r  zTAnsiColorizerTests.test_supportedTigetNumNotEnoughColor.<locals>.fakecurses.tigetnumD  s    qr,   Nr  r<   r,   r)   r  r  A  s(         E    r,   r  r  Nr  r  s     r)   $test_supportedTigetNumNotEnoughColorz7AnsiColorizerTests.test_supportedTigetNumNotEnoughColor;  sm    	 	 	 	 	 	 	 	 !+
H0:::<<HHIIIIIr,   c                      G d d          } |            t           j        d<   |                     t          j                            t                                           |                     t           j        d         j        d           dS )z
        L{reporter._AnsiColorizer.supported} returns C{False} if
        C{curses.tigetnum} raises an error, and calls C{curses.setupterm} once.
        c                   "    e Zd ZeZdZd Zd ZdS )CAnsiColorizerTests.test_supportedTigetNumErrors.<locals>.fakecursesr   c                 &    | xj         dz  c_         d S r  r  r7   s    r)   r  zMAnsiColorizerTests.test_supportedTigetNumErrors.<locals>.fakecurses.setuptermT  r  r,   c                 *    |                                  r&   )r   r  s     r)   r  zLAnsiColorizerTests.test_supportedTigetNumErrors.<locals>.fakecurses.tigetnumW  s    jjll"r,   Nr  r<   r,   r)   r  r  P  s<         EE     # # # # #r,   r  r  r!   N)	rb   r  r  r   r  r  rx  re   r\   r  s     r)   test_supportedTigetNumErrorsz/AnsiColorizerTests.test_supportedTigetNumErrorsJ  s    	# 	# 	# 	# 	# 	# 	# 	# !+
H0:::<<HHIIIX.4a88888r,   N)r8   r9   r:   r;   r\   r  r  r  r  r  r  r  r<   r,   r)   r  r    s         / / /. . .O O OJ J J9 9 96J J J J J J9 9 9 9 9r,   r  c                   *    e Zd ZdZd Zd Zd Zd ZdS )ExitWrapperTestsz-
    Tests for L{reporter._ExitWrapper}.
    c                    t          t          d                    | _        t          j        d          | _        t          j                    | _        t          | j                  | _
        |                     | j
        j                   d S )NzI am a Failurer   )r   rt   rj   r   r4  r   r   rZ   r[   r   wrappedr  r  r7   s    r)   r\   zExitWrapperTests.setUpd  sk    y)9::;;N:..	)++#DK00011111r,   c                     | j                             | j        | j                   |                     | j         j                   |                     | j        j        | j        | j        fg           dS )zm
        L{reporter._ExitWrapper} causes a wrapped reporter to stop after its
        first failure.
        N)	r  rn   r   rj   rC   r  re   r[   ro   r7   s    r)   test_stopOnFailurez#ExitWrapperTests.test_stopOnFailurek  sd    
 		4<888/000-DL0I/JKKKKKr,   c                     | j                             | j        | j                   |                     | j         j                   |                     | j        j        | j        | j        fg           dS )zk
        L{reporter._ExitWrapper} causes a wrapped reporter to stop after its
        first error.
        N)	r  ra   r   rj   rC   r  re   r[   rd   r7   s    r)   test_stopOnErrorz!ExitWrapperTests.test_stopOnErrort  sd    
 	di666/000+ty$,.G-HIIIIIr,   c                     | j                             | j        | j                   |                     | j         j                   |                     | j        j        | j        | j        fg           dS )zy
        L{reporter._ExitWrapper} does not cause a wrapped reporter to stop
        after an unexpected success.
        N)	r  rt  r   rj   r  r  re   r[   rh  r7   s    r)   #test_doesNotStopOnUnexpectedSuccessz4ExitWrapperTests.test_doesNotStopOnUnexpectedSuccess}  sf    
 	))$)T\BBB01118DIt|;T:UVVVVVr,   N)r8   r9   r:   r;   r\   r  r  r  r<   r,   r)   r  r  _  se         2 2 2L L LJ J JW W W W Wr,   r  )Nr;   r1   r   rF   rb   inspectr   ior   r   typingr   r   r   r  r   r   r	   hamcrestr
   r   r   r   twisted.pythonr   twisted.python.failurer   twisted.trialr   r   r   r   twisted.trial.reporterr   r   r   r   r   twisted.trial.unittestr   r   r   _dist.test.matchersr   r   r    matchersr"   r$   SynchronousTestCaser>   rX   rw   r}   r   r   r   r   r  r2  r<  r]  rb  r  r  r  r  r  r  r  rA  rF  rz   rI  rU  rx  r  r  r<   r,   r)   <module>r     s     				 				 



                                      A @ @ @ @ @ @ @ @ @ @ @       * * * * * * B B B B B B B B B B B B B B O O O O O O O O 0 0 0 0 0 0 0 0 ; ; ; ; ; ; ; ; ; ; I I I I I I I I I I      8 8 8 8 8 8 8 82N N N N N- N N N4)K )K )K )K )Kh2 )K )K )KX? ? ? ? ?O ? ? ?z
 z
 z
 z
 z
* z
 z
 z
z    /B   "JW JW JW JW JWX9 JW JW JWZ.0 .0 .0 .0 .0* .0 .0 .0b?A ?A ?A ?A ?Ax3 ?A ?A ?ADF
 F
 F
 F
 F
4 F
 F
 F
R- - - - -h2 - - -:E- E- E- E- E-, E- E- E-P3 3 3 3 3i 3 3 3$[L [L [L [L [L, [L [L [L|< < < < <i < < <0	' 	' 	' 	' 	' 	' 	' 	'm
 m
 m
 m
 m
4 m
 m
 m
`A= A= A= A= A=X9 A= A= A=Hk5 k5 k5 k5 k5* k5 k5 k5\
5 
5 
5 
5 
5h2 
5 
5 
5H. H. H. H. H.1 H. H. H.V: : : : :x'C : : : H H H H H- H H H    h'   >^5 ^5 ^5 ^5 ^587 ^5 ^5 ^5B       g9 g9 g9 g9 g95 g9 g9 g9T%W %W %W %W %Wx3 %W %W %W %W %Wr,   