
    =e                        d dl Z d dlZd dlZd dlmZmZmZ d dlZd dlZd dl	m
Z
  G d de          Zd Zd Zd Z G d	 d
          Z G d dej                  Z G d dej                  Z eej        j                  ZdD ]Zee= ddZeed<    edefe          Z G d dej                  Z G d dej                  Zedk    r ej                     dS dS )    N)warnings_helpercaptured_stdoutcaptured_stderr)strclassc                   (    e Zd Z G d d          ZdS )MockTracebackc                       e Zd Zd Zd ZdS ) MockTraceback.TracebackExceptionc                 <    |                     dd          | _        d S )Ncapture_localsF)getr   )selfargskwargss      0/usr/lib/python3.11/unittest/test/test_result.py__init__z)MockTraceback.TracebackException.__init__   s    "(**-=u"E"ED    c                 D    dg}| j         r|                    d           |S )NA tracebacklocals)r   appendr   results     r   formatz'MockTraceback.TracebackException.format   s+    #_F" (h'''Mr   N)__name__
__module____qualname__r   r    r   r   TracebackExceptionr
      s5        	F 	F 	F	 	 	 	 	r   r   N)r   r   r   r   r   r   r   r   r      s<                 r   r   c                  2    t           t          j        _         d S N)	tracebackunittestr   r   r   r   restore_tracebackr$      s     )HOr   c                  >    t          d           t          d          )Nzdo cleanup1zbad cleanup1)print	TypeErrorr   r   r   bad_cleanup1r(      s    	-
N
#
##r   c                  >    t          d           t          d          )Nzdo cleanup2zbad cleanup2)r&   
ValueErrorr   r   r   bad_cleanup2r+      s    	-
^
$
$$r   c                   &    e Zd Zd Zd Zd Zd ZdS )BufferedWriterc                 "    d| _         d| _        d S N r   bufferr   s    r   r   zBufferedWriter.__init__%   s    r   c                 &    | xj         |z  c_         d S r!   )r2   )r   args     r   writezBufferedWriter.write)   s    sr   c                 >    | xj         | j        z  c_         d| _        d S r/   r1   r3   s    r   flushzBufferedWriter.flush,   s    t{"r   c                     | j         S r!   )r   r3   s    r   getvaluezBufferedWriter.getvalue0   s
    {r   N)r   r   r   r   r6   r8   r:   r   r   r   r-   r-   $   sP                  r   r-   c                   t    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 Zd ZdS )Test_TestResultc                    t          j                    }|                     |                                           |                     t          |j                  d           |                     t          |j                  d           |                     |j        d           |                     |j	        d           | 
                    |j                   | 
                    |j                   d S Nr   F)r#   
TestResult
assertTruewasSuccessfulassertEquallenerrorsfailurestestsRun
shouldStopassertIsNone_stdout_buffer_stderr_bufferr   s     r   	test_initzTest_TestResult.test_init>   s    $&&,,..///V]++Q///V_--q111!,,,*E222&/000&/00000r   c                     t          j                    }|                                 |                     |j        d           d S NT)r#   r?   stoprB   rG   r   s     r   	test_stopzTest_TestResult.test_stopL   s<    $&&*D11111r   c                      G d dt           j                  } |d          }t          j                    }|                    |           |                     |                                           |                     t          |j                  d           |                     t          |j	                  d           |                     |j
        d           |                     |j        d           |                    |           d S )Nc                       e Zd Zd ZdS )+Test_TestResult.test_startTest.<locals>.Fooc                     d S r!   r   r3   s    r   test_1z2Test_TestResult.test_startTest.<locals>.Foo.test_1W       r   Nr   r   r   rT   r   r   r   FoorR   V   #            r   rW   rT   r      Fr#   TestCaser?   	startTestr@   rA   rB   rC   rD   rE   rF   rG   stopTestr   rW   testr   s       r   test_startTestzTest_TestResult.test_startTestU   s   	 	 	 	 	(# 	 	 	 s8}}$&&,,..///V]++Q///V_--q111!,,,*E222r   c                 z    G d dt           j                  } |d          }t          j                    }|                    |           |                     |                                           |                     t          |j                  d           |                     t          |j	                  d           |                     |j
        d           |                     |j        d           |                    |           |                     |                                           |                     t          |j                  d           |                     t          |j	                  d           |                     |j
        d           |                     |j        d           d S )Nc                       e Zd Zd ZdS )*Test_TestResult.test_stopTest.<locals>.Fooc                     d S r!   r   r3   s    r   rT   z1Test_TestResult.test_stopTest.<locals>.Foo.test_1l   rU   r   NrV   r   r   r   rW   rc   k   rX   r   rW   rT   r   rY   FrZ   r^   s       r   test_stopTestzTest_TestResult.test_stopTestj   s   	 	 	 	 	(# 	 	 	 s8}}$&&,,..///V]++Q///V_--q111!,,,*E222 	,,..///V]++Q///V_--q111!,,,*E22222r   c                 |    t          j                    }|                                 |                                 d S r!   )r#   r?   startTestRunstopTestRunr   s     r   test_startTestRun_stopTestRunz-Test_TestResult.test_startTestRun_stopTestRun   s:    $&&r   c                 J    G d dt           j                  } |d          }t          j                    }|                    |           |                    |           |                    |           |                     |                                           |                     t          |j
                  d           |                     t          |j                  d           |                     |j        d           |                     |j        d           d S )Nc                       e Zd Zd ZdS ),Test_TestResult.test_addSuccess.<locals>.Fooc                     d S r!   r   r3   s    r   rT   z3Test_TestResult.test_addSuccess.<locals>.Foo.test_1   rU   r   NrV   r   r   r   rW   rl      rX   r   rW   rT   r   rY   F)r#   r[   r?   r\   
addSuccessr]   r@   rA   rB   rC   rD   rE   rF   rG   r^   s       r   test_addSuccesszTest_TestResult.test_addSuccess   s   	 	 	 	 	(# 	 	 	 s8}}$&&$,,..///V]++Q///V_--q111!,,,*E22222r   c                 0    G d dt           j                  } |d          }	 |                    d           n#  t          j                    }Y nxY wt          j                    }|                    |           |                    ||           |                    |           | 	                    |
                                           |                     t          |j                  d           |                     t          |j                  d           |                     |j        d           |                     |j        d           |j        d         \  }}|                     ||           |                     |t&                     d S )Nc                       e Zd Zd ZdS ),Test_TestResult.test_addFailure.<locals>.Fooc                     d S r!   r   r3   s    r   rT   z3Test_TestResult.test_addFailure.<locals>.Foo.test_1   rU   r   NrV   r   r   r   rW   rr      rX   r   rW   rT   foor   rY   F)r#   r[   failsysexc_infor?   r\   
addFailurer]   assertFalserA   rB   rC   rD   rE   rF   rG   assertIsassertIsInstancestrr   rW   r_   exc_info_tupler   	test_caseformatted_excs          r   test_addFailurezTest_TestResult.test_addFailure   s   	 	 	 	 	(# 	 	 	 s8}}	,IIe	, \^^NNN$&&$///--//000V]++Q///V_--q111!,,,*E222#)?1#5 	=i&&&mS11111s	   ; Ac                     G d dt           j                  } |d          fd} |            }t          j        | }t          j                    }|                               |                    |           |                               |j        d         d         fd|D             }| 	                    t          |          d           |                     d|d                    d S )	Nc                       e Zd Zd ZdS )DTest_TestResult.test_addFailure_filter_traceback_frames.<locals>.Fooc                     d S r!   r   r3   s    r   rT   zKTest_TestResult.test_addFailure_filter_traceback_frames.<locals>.Foo.test_1   rU   r   NrV   r   r   r   rW   r      rX   r   rW   rT   c                  h    	                       d           d S #  t          j                    cY S xY w)Nrt   )ru   rv   rw   r_   s   r   get_exc_infozMTest_TestResult.test_addFailure_filter_traceback_frames.<locals>.get_exc_info   s;    &		%     &|~~%%%s    1r   rY   c                     g | ]}|v|	S r   r   .0lr   s     r   
<listcomp>zKTest_TestResult.test_addFailure_filter_traceback_frames.<locals>.<listcomp>   #    AAA!=*@*@1*@*@*@r    raise self.failureException(msg)r#   r[   r"   format_exceptionr?   r\   rx   r]   rE   rB   rC   assertIn	r   rW   r   r~   full_excr   droppedr   r_   s	          @@r   'test_addFailure_filter_traceback_framesz7Test_TestResult.test_addFailure_filter_traceback_frames   s"   	 	 	 	 	(# 	 	 	 s8}}	& 	& 	& 	& 	& &-~>$&&$///*1-AAAAhAAAWq)))8'!*EEEEEr   c                     G d dt           j                  } |d          fd} |            }t          j        | }t          j                    }|                               |                    |           |                               |j        d         d         fd|D             }| 	                    t          |          d           |                     d|d                    d S )	Nc                       e Zd Zd ZdS )LTest_TestResult.test_addFailure_filter_traceback_frames_context.<locals>.Fooc                     d S r!   r   r3   s    r   rT   zSTest_TestResult.test_addFailure_filter_traceback_frames_context.<locals>.Foo.test_1   rU   r   NrV   r   r   r   rW   r      rX   r   rW   rT   c                      	 	                       d           d S #  t          d          xY w#  t          j                    cY S xY w)Nrt   *   )ru   r*   rv   rw   r   s   r   r   zUTest_TestResult.test_addFailure_filter_traceback_frames_context.<locals>.get_exc_info   sU    &)IIe$$$$$)$R..(&|~~%%%s    ,/ Ar   rY   c                     g | ]}|v|	S r   r   r   s     r   r   zSTest_TestResult.test_addFailure_filter_traceback_frames_context.<locals>.<listcomp>  r   r   r   r   r   s	          @@r   /test_addFailure_filter_traceback_frames_contextz?Test_TestResult.test_addFailure_filter_traceback_frames_context   s"   	 	 	 	 	(# 	 	 	 s8}}	& 	& 	& 	& 	& &-~>$&&$///*1-AAAAhAAAWq)))8'!*EEEEEr   c                     G d dt           j                  }d } |            } |d          }t          j                    }|                    |           |                    ||           |                    |           |j        d         d         }|                     |                    d          d           d S )Nc                       e Zd Zd ZdS )`Test_TestResult.test_addFailure_filter_traceback_frames_chained_exception_self_loop.<locals>.Fooc                     d S r!   r   r3   s    r   rT   zgTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_self_loop.<locals>.Foo.test_1  rU   r   NrV   r   r   r   rW   r     rX   r   rW   c                  v    	 t          d          } | | _        | | _        | #  t          j                    cY S xY w)NLoop	Exception	__cause____context__rv   rw   )loops    r   r   ziTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_self_loop.<locals>.get_exc_info  sC    & ((!%#' 
&|~~%%%s   ! 8rT   r   rY   zException: Loop
	r#   r[   r?   r\   rx   r]   rE   rB   countr   rW   r   r~   r_   r   r   s          r   Ctest_addFailure_filter_traceback_frames_chained_exception_self_loopzSTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_self_loop  s    	 	 	 	 	(# 	 	 		& 	& 	& &s8}}$&&$///*1-,,-@AA1EEEEEr   c                 (    G d dt           j                  }d } |            } |d          }t          j                    }|                    |           |                    ||           |                    |           |j        d         d         }|                     |                    d          d           |                     |                    d          d           |                     |                    d	          d           d S )
Nc                       e Zd Zd ZdS )\Test_TestResult.test_addFailure_filter_traceback_frames_chained_exception_cycle.<locals>.Fooc                     d S r!   r   r3   s    r   rT   zcTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_cycle.<locals>.Foo.test_11  rU   r   NrV   r   r   r   rW   r   0  rX   r   rW   c                      	 t          d          t          d          t          d          }}} ||f|| f| |fg}|D ]\  }}||_        ||_        |#  t          j                    cY S xY w)NABCr   )r   r   r   edgesex1ex2s         r   r   zeTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_cycle.<locals>.get_exc_info4  s    
& $C..)C..)C..a1Q!Q!Q0 % * *HC$'CM&)COO&|~~%%%s   AA A)rT   r   rY   zException: A
zException: B
zException: C
r   r   s          r   ?test_addFailure_filter_traceback_frames_chained_exception_cyclezOTest_TestResult.test_addFailure_filter_traceback_frames_chained_exception_cycle/  s(   	 	 	 	 	(# 	 	 		& 	& 	& &s8}}$&&$///*1-,,-=>>BBB,,-=>>BBB,,-=>>BBBBBr   c                      G d dt           j                  } |d          }	 t                      #  t          j                    }Y nxY wt          j                    }|                    |           |                    ||           |                    |           | 	                    |
                                           |                     t          |j                  d           |                     t          |j                  d           |                     |j        d           |                     |j        d           |j        d         \  }}|                     ||           |                     |t&                     d S )Nc                       e Zd Zd ZdS )*Test_TestResult.test_addError.<locals>.Fooc                     d S r!   r   r3   s    r   rT   z1Test_TestResult.test_addError.<locals>.Foo.test_1e  rU   r   NrV   r   r   r   rW   r   d  rX   r   rW   rT   rY   r   F)r#   r[   r'   rv   rw   r?   r\   addErrorr]   ry   rA   rB   rC   rD   rE   rF   rG   rz   r{   r|   r}   s          r   test_addErrorzTest_TestResult.test_addErrorc  s   	 	 	 	 	(# 	 	 	 s8}}	,++	, \^^NNN$&&n-----//000V]++Q///V_--q111!,,,*E222#)=#3 	=i&&&mS11111s	   3 A
c                     G d dt           j                  } |d          }t          j                    }d|_        t          t           j        _        |                     t                     |	                                 |
                    |           |                                 |                     t          |j                  d           |j        d         \  }}|                     d|           d S )Nc                       e Zd Zd ZdS )1Test_TestResult.test_addError_locals.<locals>.Fooc                     ddz   d S )NrY   r   r   r3   s    r   rT   z8Test_TestResult.test_addError_locals.<locals>.Foo.test_1  s    !r   NrV   r   r   r   rW   r     s#            r   rW   rT   TrY   r   zA tracebacklocals)r#   r[   r?   	tb_localsr   r   r"   
addCleanupr$   rg   runrh   rB   rC   rD   )r   rW   r_   r   r   r   s         r   test_addError_localsz$Test_TestResult.test_addError_locals~  s    	 	 	 	 	(# 	 	 	 s8}}$&&$1!)***V]++Q///#)=#3 	=,m<<<<<r   c                     G fddt           j                  }d  |d          t          j                                                   |                                                                |                     t          j                  d           |                     t          j	                  d           |                     j
        d           |                     j        d           j        d         \  }}|                     |           |                     d|           j	        d         \  }}|                     |           |                     d|           d S )	Nc                       e Zd Z fdZdS ),Test_TestResult.test_addSubTest.<locals>.Fooc                     |                      d          5  | j        	 ddz   n## t          $ r t          j                    }Y nw xY w                    |           |                     d           d d d            d S # 1 swxY w Y   d S )NrY   rt   r   some recognizable failure)subTest_subtestZeroDivisionErrorrv   rw   
addSubTestru   )r   r~   r   subtestr_   s     r   rT   z3Test_TestResult.test_addSubTest.<locals>.Foo.test_1  s    \\a\(( 	; 	;"mG8!, 8 8 8),8 %%dG^DDDII9:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s1   B'BABA/BB
BNrV   )r   r   r_   s   r   rW   r     s8        ; ; ; ; ; ; ; ; ;r   rW   rT   rY   Fr   r   r   )r#   r[   r?   r   ry   rA   rB   rC   rD   rE   rF   rG   rz   r   )r   rW   r   r   r   r   r_   s       @@@r   test_addSubTestzTest_TestResult.test_addSubTest  s   	; 	; 	; 	; 	; 	; 	; 	; 	;(# 	; 	; 	; s8}}$&&--//000V]++Q///V_--q111!,,,*E222#)=#3 	=i))))=999#)?1#5 	=i)))1=AAAAAr   c                     G d dt                     }t          j                    }|                     |                    |                     d|j        j        d<   |                     |                    |                     d S )Nc                   *    e Zd Z G d de          ZdS )5Test_TestResult.testStackFrameTrimming.<locals>.Framec                       e Zd Zi ZdS )>Test_TestResult.testStackFrameTrimming.<locals>.Frame.tb_frameN)r   r   r   	f_globalsr   r   r   tb_framer     s        			r   r   N)r   r   r   objectr   r   r   r   Framer     s>            6     r   r   T
__unittest)r   r#   r?   ry   _is_relevant_tb_levelr   r   r@   )r   r   r   s      r   testStackFrameTrimmingz&Test_TestResult.testStackFrameTrimming  s    	 	 	 	 	F 	 	 	 $&&55e<<===15 .44U;;<<<<<r   c                    t          j                    }d |_        d|_        |                    d d            |                     |j                   t          j                    }d |_        d|_        |                    d d            |                     |j                   t          j                    }d |_        d|_        |                    d            |                     |j                   d S )Nc                      dS r/   r   _s    r   <lambda>z.Test_TestResult.testFailFast.<locals>.<lambda>       r   Tc                      dS r/   r   r   s    r   r   z.Test_TestResult.testFailFast.<locals>.<lambda>  r   r   c                      dS r/   r   r   s    r   r   z.Test_TestResult.testFailFast.<locals>.<lambda>  r   r   )	r#   r?   _exc_info_to_stringfailfastr   r@   rG   rx   addUnexpectedSuccessr   s     r   testFailFastzTest_TestResult.testFailFast  s    $&&%2]"d###)***$&&%2]"$%%%)***$&&%2]"##D))))*****r   c                      t                      }t          j        |d          } fd}|                    |          }|                                                      |                                                    d                     d S )NT)streamr   c                 <                         | j                   d S r!   )r@   r   )r   r   s    r   r_   z5Test_TestResult.testFailFastSetByRunner.<locals>.test  s    OOFO,,,,,r   z

OK
)r-   r#   TextTestRunnerr   r8   r@   r:   endswith)r   r   runnerr_   r   s   `    r   testFailFastSetByRunnerz'Test_TestResult.testFailFastSetByRunner  s    !!(FFF	- 	- 	- 	- 	-D!!))22:>>?????r   N)r   r   r   rK   rO   r`   re   ri   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r<   r<   4   s*       	1 	1 	12 2 2  *3 3 36  03 3 3N2 2 26F F F4F F F:F F F2C C Ch2 2 26= = =& B  B  BD= = =+ + +&@ @ @ @ @r   r<   c                      e Zd ZdZd Zd Zd Zd Zd Zd Z	 e
j        ej        j        dk    d	          d
             Z e
j        ej        j        dk    d	          d             Z e
j        ej        j        dk    d	          d             Z e
j        ej        j        dk    d	          d             Z G d de
j                  ZddZd Zd Zd Zd Zd Zd Zd Zd ZdS )Test_TextTestResultNc                     t          j        d dd          }|                     |                    |           dt          z   dz              d S )NTrY   z$testGetDescriptionWithoutDocstring (z8.Test_TextTestResult.testGetDescriptionWithoutDocstring)r#   TextTestResultrB   getDescriptionr   r   s     r   "testGetDescriptionWithoutDocstringz6Test_TextTestResult.testGetDescriptionWithoutDocstring  s_    (tQ77%%d++6AJK	L 	L 	L 	L 	Lr   c                    |                      dd          5  t          j        d dd          }|                     |                    | j                  dt          z   dz              d d d            n# 1 swxY w Y   |                      d          5  t          j        d dd          }|                     |                    | j                  dt          z   dz              d d d            d S # 1 swxY w Y   d S )	NrY      rt   barTz+testGetSubTestDescriptionWithoutDocstring (zN.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstring) (foo=1, bar=2)zsome messagezN.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstring) [some message]r   r#   r   rB   r   r   r   r   s     r   )testGetSubTestDescriptionWithoutDocstringz=Test_TextTestResult.testGetSubTestDescriptionWithoutDocstring  s   \\aQ\'' 	f 	f,T4;;F))$-88AHLdef f f	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f \\.)) 	f 	f,T4;;F))$-88AHLdef f f	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	fs%   AA44A8;A8AC11C58C5c                     |                                  5  t          j        d dd          }|                     |                    | j                  dt          z   dz              d d d            d S # 1 swxY w Y   d S )NTrY   z4testGetSubTestDescriptionWithoutDocstringAndParams (zT.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) (<subtest>)r   r   s     r   2testGetSubTestDescriptionWithoutDocstringAndParamszFTest_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams  s    \\^^ 	# 	#,T4;;F))$-88"#&""# # #	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   AA22A69A6c                    d}t          j        d dd          }dd g fD ]g}|                     |          5  |                     |                    | j                  |t          |fz             d d d            n# 1 swxY w Y   hd S )NzmtestGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalsyValues) [%s]TrY   r   r#   r   r   rB   r   r   r   )r   expectedr   r5   s       r   'testGetSubTestDescriptionForFalsyValuesz;Test_TextTestResult.testGetSubTestDescriptionForFalsyValues  s     C(tQ77tR= 	 	Cc""    ))$-88#.                	 	s   9A::A>	A>	c                 `   |                      d          5  |                      dd          5  t          j        d dd          }|                     |                    | j                  dt          z   dz              d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )	NrY   r   r      bazr   Tz1testGetNestedSubTestDescriptionWithoutDocstring (z[.Test_TextTestResult.testGetNestedSubTestDescriptionWithoutDocstring) (baz=2, bar=3, foo=1)r   r   s     r   /testGetNestedSubTestDescriptionWithoutDocstringzCTest_TextTestResult.testGetNestedSubTestDescriptionWithoutDocstring  s;   \\a\   	1 	1!++ 1 1!0tQ??  --dm<<&'*001 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1s5   B#AB?B#B	B#B	B##B'*B'c                 b   |                      dd          5  |                      dd          5  t          j        d dd          }|                     |                    | j                  dt          z   d	z              d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )
NrY   r   r   r     r  Tz;testGetDuplicatedNestedSubTestDescriptionWithoutDocstring (ze.Test_TextTestResult.testGetDuplicatedNestedSubTestDescriptionWithoutDocstring) (baz=3, bar=4, foo=1)r   r   s     r   9testGetDuplicatedNestedSubTestDescriptionWithoutDocstringzMTest_TextTestResult.testGetDuplicatedNestedSubTestDescriptionWithoutDocstring  sg   \\aQ\'' 	R 	R!++ R R!0tQ??  --dm<<&' *QQR R RR R R R R R R R R R R R R R R	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	R 	Rs5   B$AB B$B	B$B	B$$B(+B(r   z)Docstrings are omitted with -O2 and abovec                     t          j        ddd          }|                     |                    |           dt          z   dz              dS )5Tests getDescription() for a method with a docstring.NTrY   z(testGetDescriptionWithOneLineDocstring (zr.Test_TextTestResult.testGetDescriptionWithOneLineDocstring)
Tests getDescription() for a method with a docstring.r   r   s     r   &testGetDescriptionWithOneLineDocstringz:Test_TextTestResult.testGetDescriptionWithOneLineDocstring  si     (tQ77%%d++"HH	J 	J 	J 	J 	Jr   c                    t          j        ddd          }|                     dd          5  |                     |                    | j                  dt          z   dz              ddd           dS # 1 swxY w Y   dS )r  NTrY   r   r   z/testGetSubTestDescriptionWithOneLineDocstring (z.Test_TextTestResult.testGetSubTestDescriptionWithOneLineDocstring) (foo=1, bar=2)
Tests getDescription() for a method with a docstring.r  r   s     r   -testGetSubTestDescriptionWithOneLineDocstringzATest_TextTestResult.testGetSubTestDescriptionWithOneLineDocstring$  s     (tQ77\\aQ\'' 	J 	J%%dm44"HHJ J J	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J   :A55A9<A9c                     t          j        ddd          }|                     |                    |           dt          z   dz              dS )oTests getDescription() for a method with a longer docstring.
        The second line of the docstring.
        NTrY   z*testGetDescriptionWithMultiLineDocstring (z{.Test_TextTestResult.testGetDescriptionWithMultiLineDocstring)
Tests getDescription() for a method with a longer docstring.r   r   s     r   (testGetDescriptionWithMultiLineDocstringz<Test_TextTestResult.testGetDescriptionWithMultiLineDocstring2  sb     (tQ77%%d++"	 	 	 	 	r   c                    t          j        ddd          }|                     dd          5  |                     |                    | j                  dt          z   dz              ddd           dS # 1 swxY w Y   dS )r  NTrY   r   r   z1testGetSubTestDescriptionWithMultiLineDocstring (z.Test_TextTestResult.testGetSubTestDescriptionWithMultiLineDocstring) (foo=1, bar=2)
Tests getDescription() for a method with a longer docstring.r  r   s     r   /testGetSubTestDescriptionWithMultiLineDocstringzCTest_TextTestResult.testGetSubTestDescriptionWithMultiLineDocstring@  s     (tQ77\\aQ\'' 	 	%%dm44"  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r  c                   |    e Zd Zd Zd Zd Zd Zej        d             Z	ej        d             Z
d Zd Zd	Zd
 Zd	S )Test_TextTestResult.Testc                     d S r!   r   r3   s    r   testSuccessz$Test_TextTestResult.Test.testSuccessQ  s    Dr   c                 0    |                      d           d S )NskipskipTestr3   s    r   testSkipz!Test_TextTestResult.Test.testSkipS  s    MM&!!!!!r   c                 0    |                      d           d S Nru   ru   r3   s    r   testFailz!Test_TextTestResult.Test.testFailU  s    IIfr   c                      t          d          )Nerror)r   r3   s    r   	testErrorz"Test_TextTestResult.Test.testErrorW  s    G$$$r   c                 0    |                      d           d S r#  r$  r3   s    r   testExpectedFailurez,Test_TextTestResult.Test.testExpectedFailureY  s    IIfr   c                     d S r!   r   r3   s    r   testUnexpectedSuccessz.Test_TextTestResult.Test.testUnexpectedSuccess\  s    Dr   c                     |                      dd          5  	 d d d            n# 1 swxY w Y   |                      dd          5  	 d d d            d S # 1 swxY w Y   d S )NonerY   atwor   b)r   r3   s    r   testSubTestSuccessz+Test_TextTestResult.Test.testSubTestSuccess_  s    eq))                eq))                   s   &**AAAc                    |                      dd          5  	 d d d            n# 1 swxY w Y   |                      dd          5  |                     d           d d d            n# 1 swxY w Y   |                      dd	          5  |                     d           d d d            n# 1 swxY w Y   |                      d
d          5  t          d
          # 1 swxY w Y   d S )NsuccessrY   r/  r  r   r2  ru   r  )cr'  r  )d)r   r   ru   r   r3   s    r   testSubTestMixedz)Test_TextTestResult.Test.testSubTestMixedd  s   i1--                f** & &f%%%& & & & & & & & & & & & & & &f** " "		&!!!" " " " " " " " " " " " " " "g++ ) )((() ) ) ) ) ) ) ) ) )sB   &**A**A.1A.B..B25B2C  C$'C$Nc                 "    | j         | j         d S r!   )tearDownErrorr3   s    r   tearDownz!Test_TextTestResult.Test.tearDowno  s    !-(( .-r   )r   r   r   r  r!  r%  r(  r#   expectedFailurer*  r,  r4  r9  r;  r<  r   r   r   Testr  P  s        	 	 		" 	" 	"	 	 		% 	% 	%		!	 	 
"	!			!	 	 
"	!		 	 	
	) 	) 	) 	) 	) 	) 	) 	)r   r>  c                    t                      }t          j                            |          }t          j        |d|          }|                     |          }||_        |                    |           |                                S rM   )	r-   r#   r   _WritelnDecoratorr   r>  r;  r   r:   )r   	test_name	verbosityr;  r   r   r_   s          r   	_run_testzTest_TextTestResult._run_tests  sq    !!226::(yAAyy##*   r   c                    |                      |                     dd          d           |                      |                     dd          d           |                      |                     dd          d           |                      |                     dd          d	           |                      |                     d
d          d           |                      |                     dd          d           d S )Nr  rY   .r!  sr%  Fr(  Er*  xr,  urB   rC  r3   s    r   testDotsOutputz"Test_TextTestResult.testDotsOutput|  s    q993???
A66<<<
A66<<<Q77===(=qAA3GGG(?CCSIIIIIr   c                 Z   t            d| j        j         }|                     |                     dd          d| d           |                     |                     dd          d| d           |                     |                     d	d          d
| d           |                     |                     dd          d| d           |                     |                     dd          d| d           |                     |                     dd          d| d           d S )NrE  r  r   testSuccess (z.testSuccess) ... ok
r!  
testSkip (z.testSkip) ... skipped 'skip'
r%  
testFail (z.testFail) ... FAIL
r(  testError (z.testError) ... ERROR
r*  ztestExpectedFailure (z+.testExpectedFailure) ... expected failure
r,  ztestUnexpectedSuccess (z/.testUnexpectedSuccess) ... unexpected success
r   r>  r   rB   rC  r   	classnames     r   testLongOutputz"Test_TextTestResult.testLongOutput  s~   ::$)"8::	q99JJJJ	L 	L 	L
A66PiPPP	R 	R 	R
A66FiFFF	H 	H 	HQ77IyIII	K 	K 	K(=qAAhhhh	j 	j 	j(?CCn9nnn	p 	p 	p 	p 	pr   c                 Z    |                      |                     dd          d           d S )Nr4  rY   rE  rK  r3   s    r   testDotsOutputSubTestSuccessz0Test_TextTestResult.testDotsOutputSubTestSuccess  s-    (<a@@#FFFFFr   c                     t            d| j        j         }|                     |                     dd          d| d           d S )NrE  r4  r   ztestSubTestSuccess (z.testSubTestSuccess) ... ok
rR  rS  s     r   testLongOutputSubTestSuccessz0Test_TextTestResult.testLongOutputSubTestSuccess  s`    ::$)"8::	(<a@@X	XXX	Z 	Z 	Z 	Z 	Zr   c                 Z    |                      |                     dd          d           d S )Nr9  rY   sFErK  r3   s    r   testDotsOutputSubTestMixedz.Test_TextTestResult.testDotsOutputSubTestMixed  s-    (:A>>FFFFFr   c                     t            d| j        j         }|                     |                     dd          d| d| d| d| d	           d S )	NrE  r9  r   ztestSubTestMixed (z,.testSubTestMixed) ... 
  testSubTestMixed (zG.testSubTestMixed) [skip] (b=2) ... skipped 'skip'
  testSubTestMixed (z=.testSubTestMixed) [fail] (c=3) ... FAIL
  testSubTestMixed (z+.testSubTestMixed) [error] (d=4) ... ERROR
rR  rS  s     r   testLongOutputSubTestMixedz.Test_TextTestResult.testLongOutputSubTestMixed  s    ::$)"8::	(:A>>_Y _ _'0_ _'0_ _ (1_ _ _	` 	` 	` 	` 	`r   c                    |                      ddt          d                    }|                     |d           |                      ddt          d                    }|                     |d           |                      ddt          d                    }|                     |d	           |                      d
dt          d                    }|                     |d           d S )Nr  rY   ru   rG  r(  EFr%  r'  FEr!  sF)rC  AssertionErrorrB   r   )r   outs     r   testDotsOutputTearDownFailz.Test_TextTestResult.testDotsOutputTearDownFail  s    nn]A~f/E/EFFc"""nn[!^F-C-CDDd###nnZIg,>,>??d###nnZN6,B,BCCd#####r   c                 4   t            d| j        j         }|                     ddt	          d                    }|                     |d| d           |                     ddt	          d                    }|                     |d| d	| d
           |                     ddt          d                    }|                     |d| d| d           |                     ddt	          d                    }|                     |d| d| d           d S )NrE  r  r   ru   rN  z.testSuccess) ... FAIL
r(  rQ  z!.testError) ... ERROR
testError (z.testError) ... FAIL
r%  r'  rP  z.testFail) ... FAIL
testFail (z.testFail) ... ERROR
r!  rO  z(.testSkip) ... skipped 'skip'
testSkip (z.testSkip) ... FAIL
)r   r>  r   rC  rc  rB   r   )r   rT  rd  s      r   testLongOutputTearDownFailz.Test_TextTestResult.testLongOutputTearDownFail  s   ::$)"8::	nn]A~f/E/EFFLLLL	N 	N 	Nnn[!^F-C-CDDIy I I'0I I I	J 	J 	J nnZIg,>,>??Hi H H&/H H H	I 	I 	I nnZN6,B,BCCGi G G&/G G G	H 	H 	H 	H 	Hr   r!   )r   r   r   maxDiffr   r   r  r  r
  r  r#   skipIfrv   flagsoptimizer  r  r  r  r[   r>  rC  rL  rU  rW  rY  r\  r^  re  rg  r   r   r   r   r     sO       GL L Lf f f# # #  1 1 1R R R X_SY'1,@B BJ JB BJ X_SY'1,@B B
J 
JB B
J X_SY'1,@B B
 
B B
 X_SY'1,@B B B B!) !) !) !) !)x  !) !) !)F! ! ! !J J Jp p pG G GZ Z Z
G G G` ` `$ $ $H H H H Hr   r   )addSkipaddExpectedFailurer   r   c                 Z    g | _         g | _        d| _        d| _        d| _        d| _        d S r>   )rE   rD   rF   rG   r2   r   )r   r   descriptionsrB  s       r   r   r     s0    DMDKDMDODKDNNNr   r   	OldResultc                   ,    e Zd Zd Zd Zd Zd Zd ZdS )Test_OldTestResultc                    t          j        dt          f          5  t                      }|                    |           |                     t          |j                  |           d d d            d S # 1 swxY w Y   d S )NzTestResult has no add.+ method,)r   check_warningsRuntimeWarningrp  r   rB   rC   rE   )r   r_   rE   r   s       r   assertOldResultWarningz)Test_OldTestResult.assertOldResultWarning  s    +2NCE E 	= 	=[[FHHVS118<<<		= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=s   AA55A9<A9c                      G d dt           j                  }dD ]4\  }} ||          }|                     |t          |                      5d S )Nc                   T    e Zd Zd Zej        d             Zej        d             ZdS )2Test_OldTestResult.testOldTestResult.<locals>.Testc                 0    |                      d           d S )Nfoobarr  r3   s    r   r!  z;Test_OldTestResult.testOldTestResult.<locals>.Test.testSkip  s    h'''''r   c                     t           r!   )r'   r3   s    r   testExpectedFailzCTest_OldTestResult.testOldTestResult.<locals>.Test.testExpectedFail  s    r   c                     d S r!   r   r3   s    r   r,  zHTest_OldTestResult.testOldTestResult.<locals>.Test.testUnexpectedSuccess  s    r   N)r   r   r   r!  r#   r=  r}  r,  r   r   r   r>  ry    s]        ( ( (%    &% %  &%  r   r>  ))r!  T)r}  T)r,  F)r#   r[   rv  int)r   r>  rA  should_passr_   s        r   testOldTestResultz$Test_OldTestResult.testOldTestResult  s    	 	 	 	 	8$ 	 	 	'I 	D 	D"I{ 4	??D''ck/.B.BCCCC		D 	Dr   c                 t     G d dt           j                  }|                      |d          d           d S )Nc                       e Zd Zd Zd ZdS )7Test_OldTestResult.testOldTestTesultSetup.<locals>.Testc                 0    |                      d           d S )N	no reasonr  r3   s    r   setUpz=Test_OldTestResult.testOldTestTesultSetup.<locals>.Test.setUp  s    k*****r   c                     d S r!   r   r3   s    r   testFooz?Test_OldTestResult.testOldTestTesultSetup.<locals>.Test.testFoo  rU   r   N)r   r   r   r  r  r   r   r   r>  r    s2        + + +    r   r>  r  r   )r#   r[   rv  r   r>  s     r   testOldTestTesultSetupz)Test_OldTestResult.testOldTestTesultSetup  sU    	 	 	 	 	8$ 	 	 	
 	##DDOOQ77777r   c                     t          j        d           G d dt           j                              }|                      |d          d           d S )Nr  c                       e Zd Zd ZdS )7Test_OldTestResult.testOldTestResultClass.<locals>.Testc                     d S r!   r   r3   s    r   r  z?Test_OldTestResult.testOldTestResultClass.<locals>.Test.testFoo  rU   r   Nr   r   r   r  r   r   r   r>  r    s#            r   r>  r  r   )r#   r  r[   rv  r  s     r   testOldTestResultClassz)Test_OldTestResult.testOldTestResultClass  sj    	{	#	#	 	 	 	 	8$ 	 	 
$	#	 	##DDOOQ77777r   c                      G d dt           j                  }t          j        t          t	          j                              }|                     |d                     d S )Nc                       e Zd Zd ZdS )8Test_OldTestResult.testOldResultWithRunner.<locals>.Testc                     d S r!   r   r3   s    r   r  z@Test_OldTestResult.testOldResultWithRunner.<locals>.Test.testFoo  rU   r   Nr  r   r   r   r>  r    rX   r   r>  )resultclassr   r  )r#   r[   r   rp  ioStringIOr   )r   r>  r   s      r   testOldResultWithRunnerz*Test_OldTestResult.testOldResultWithRunner  sx    	 	 	 	 	8$ 	 	 	 (Y13@ @ @ 	

44	??#####r   N)r   r   r   rv  r  r  r  r  r   r   r   rr  rr    sb        = = =D D D"8 8 88 8 8$ $ $ $ $r   rr  c                       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 Zd Zd Zd Zd Zd ZdS )TestOutputBufferingc                 J    t           j        | _        t           j        | _        d S r!   )rv   stdout	_real_outstderr	_real_errr3   s    r   r  zTestOutputBuffering.setUp	  s    r   c                 J    | j         t          _        | j        t          _        d S r!   )r  rv   r  r  r  r3   s    r   r<  zTestOutputBuffering.tearDown  s    ^
^


r   c                    | j         }| j        }t          j                    }|                     |j                   |                     |t          j                   |                     |t          j	                   |
                    |            |                     |t          j                   |                     |t          j	                   d S r!   )r  r  r#   r?   ry   r2   rz   rv   r  r  r\   )r   real_outreal_errr   s       r   testBufferOutputOffz'TestOutputBuffering.testBufferOutputOff  s    >>$&&'''h
+++h
+++h
+++h
+++++r   c                 $   | j         }| j        }t          j                    }|                     |j                   d|_        |                     |t          j                   |                     |t          j	                   |
                    |            |                     |t          j                   |                     |t          j	                   |                     t          j        t          j                   |                     t          j	        t          j                   |                     t          j        t          j	                   t          j        }t          j	        }t          j                    |_        t          j                    |_        t#          d           t#          dt          j	                   |                     |                                d           |                     |                                d           |                     |j                                        d           |                     |j                                        d           |                    |            |                    |            |                     t          j        |j                   |                     t          j	        |j                   |                     |j                                        d           |                     |j                                        d           |                     |                                d           |                     |                                d           d S )NTrt   r   filezfoo
zbar
r0   )r  r  r#   r?   ry   r2   rz   rv   r  r  r\   assertIsNotr{   r  r  _original_stdout_original_stderrr&   rB   r:   rn   r]   )r   r  r  r   
out_stream
err_streams         r   #testBufferOutputStartTestAddSuccessz7TestOutputBuffering.testBufferOutputStartTestAddSuccess   s   >>$&&'''h
+++h
+++3:...3:...cj"+666cj"+666SZ000Z
Z
"$+--"$+--ee#*%%%%,,..888,,..888099;;R@@@099;;R@@@$cj&"9:::cj&"9:::099;;R@@@099;;R@@@,,..333,,..33333r   c                 d    t          j                    }d|_        |                    |            |S rM   )r#   r?   r2   r\   r   s     r   getStartedResultz$TestOutputBuffering.getStartedResultP  s0    $&&r   c                    t           t          j        _        |                     t
                     dD ]\  }}}|                                 }t          j        }t          j	        }t          j                    |_        t          j                    |_        t          dt          j                   |rt          dt          j	                   t          ||          } || d           |                    |            t          ||          }|                     t%          |          d           |d         \  }	}
t'          j        d          }d	}|rt'          j        d
          }d||}|                     |	|            |                     |j                                        |           |                     |j                                        |           |                     |
|           d S )N)rD   r   TrE   rx   Fr  r  rt   r  r   NNNrY   r   z9
                Stdout:
                foo
            r0   z9
                Stderr:
                bar
            r   )r   r#   r   r"   r   r$   r  rv   r  r  r  r  r  r  r&   getattrr]   rB   rC   textwrapdedentrz   r:   assertMultiLineEqual)r   message_attradd_attrinclude_errorr   buffered_outbuffered_erraddFunctionresult_listr_   messageexpectedOutMessageexpectedErrMessageexpectedFullMessages                 r   !testBufferOutputAddErrorOrFailurez5TestOutputBuffering.testBufferOutputAddErrorOrFailureV  s   $1!)***6
 )	D )	D1L(M **,,F:L:L&(kmmF#&(kmmF#%cj)))) .e#*---- "&(33KK0111OOD!!!!&,77KS--q111'NMD'!) 2 " " "$ %-_ 6 & &"
 8J7IK]K]"^MM$%%%V4==??ASTTTV4==??ASTTT%%g/BCCCCS)	D )	Dr   c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     t          |          |           |                     d
|           |                     ||           d S )NTc                       e Zd Zd Zd ZdS )0TestOutputBuffering.testBufferSetUp.<locals>.Fooc                 .    t          d           ddz   d S Nset uprY   r   r&   r3   s    r   r  z6TestOutputBuffering.testBufferSetUp.<locals>.Foo.setUp  s    h!r   c                     d S r!   r   r3   s    r   test_fooz9TestOutputBuffering.testBufferSetUp.<locals>.Foo.test_foo  rU   r   Nr   r   r   r  r  r   r   r   rW   r    2              r   rW   r  
Stdout:
set up
rY   
test_foo (
.test_foo)r   #ZeroDivisionError: division by zeror   r#   r?   r2   r[   	TestSuiterB   r:   rC   rD   r   r|   r   	r   r  r   rW   suiteexpected_outdescriptionr   r   s	            r   testBufferSetUpz#TestOutputBuffering.testBufferSetUp  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455f,**L999V]++Q///<8C==<<<#)=#3 	=Y555;]KKKlM22222   /33c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     t          |          |           |                     d
|           |                     ||           d S )NTc                       e Zd Zd Zd ZdS )3TestOutputBuffering.testBufferTearDown.<locals>.Fooc                 .    t          d           ddz   d S Nz	tear downrY   r   r  r3   s    r   r<  z<TestOutputBuffering.testBufferTearDown.<locals>.Foo.tearDown      k"""!r   c                     d S r!   r   r3   s    r   r  z<TestOutputBuffering.testBufferTearDown.<locals>.Foo.test_foo  rU   r   N)r   r   r   r<  r  r   r   r   rW   r    r  r   rW   r  z
Stdout:
tear down
rY   r  r  r   r  r  r  s	            r   testBufferTearDownz&TestOutputBuffering.testBufferTearDown  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455f/**L999V]++Q///<8C==<<<#)=#3 	=Y555;]KKKlM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     t          |          |           |                     d
|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     t          |          |           |                     d|           |                     d|           |                     ||           d S )NTc                       e Zd Zd Zd ZdS )5TestOutputBuffering.testBufferDoCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     d S Nr  r&   r   r(   r+   r3   s    r   r  z;TestOutputBuffering.testBufferDoCleanups.<locals>.Foo.setUp  7    h--------r   c                     d S r!   r   r3   s    r   r  z>TestOutputBuffering.testBufferDoCleanups.<locals>.Foo.test_foo  rU   r   Nr  r   r   r   rW   r    s2        . . .    r   rW   r  (
Stdout:
set up
do cleanup2
do cleanup1
r   r  r  r   ValueError: bad cleanup2r'   
Stdout:
set up
do cleanup2

do cleanup1
rY   TypeError: bad cleanup1r*   r   r#   r?   r2   r[   r  rB   r:   rC   rD   r   r|   r   assertNotInr  s	            r   testBufferDoCleanupsz(TestOutputBuffering.testBufferDoCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455fF**L999V]++Q///<8C==<<<#)=#3 	=Y5550-@@@m4448-HHH*M:::#)=#3 	=Y555/???}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     t          |          |           |                     d
|           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     t          |          |           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     t          |          |           |                     d|           |                     d|           |                     d|           |                     ||           d S )NTc                       e Zd Zd Zd ZdS );TestOutputBuffering.testBufferSetUp_DoCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     ddz   d S r  r  r3   s    r   r  zATestOutputBuffering.testBufferSetUp_DoCleanups.<locals>.Foo.setUp  s>    h------!r   c                     d S r!   r   r3   s    r   r  zDTestOutputBuffering.testBufferSetUp_DoCleanups.<locals>.Foo.test_foo  rU   r   Nr  r   r   r   rW   r    s2          
    r   rW   r  r  r  r  r  r   r  r*   r'   r  
do cleanup2
r  rY   r  r   r  r   r  r  r  s	            r   testBufferSetUp_DoCleanupsz.TestOutputBuffering.testBufferSetUp_DoCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455fF**L999V]++Q///<8C==<<<#)=#3 	=Y555;]KKK}555m444+];;;*M:::*M:::#)=#3 	=Y5550-@@@,m<<<m4448-HHH*M:::#)=#3 	=Y555/???,m<<<}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     t          |          |           |                     d
|           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     t          |          |           |                     d|           |                     d|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     t          |          |           |                     d|           |                     d|           |                     d|           |                     ||           d S )NTc                        e Zd Zd Zd Zd ZdS )>TestOutputBuffering.testBufferTearDown_DoCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     d S r  r  r3   s    r   r  zDTestOutputBuffering.testBufferTearDown_DoCleanups.<locals>.Foo.setUp  r  r   c                 .    t          d           ddz   d S r  r  r3   s    r   r<  zGTestOutputBuffering.testBufferTearDown_DoCleanups.<locals>.Foo.tearDown  r  r   c                     d S r!   r   r3   s    r   r  zGTestOutputBuffering.testBufferTearDown_DoCleanups.<locals>.Foo.test_foo  rU   r   N)r   r   r   r  r<  r  r   r   r   rW   r    sA        . . .      r   rW   r  z2
Stdout:
set up
tear down
do cleanup2
do cleanup1
r  r  r  r   r  r*   r'   z
Stdout:
set up
tear down
r  r  rY   r  r   z&
Stdout:
set up
tear down
do cleanup2
r   r  r  r  s	            r   testBufferTearDown_DoCleanupsz1TestOutputBuffering.testBufferTearDown_DoCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+		 		 		 		 		(# 		 		 		 "CC
OO#455fQ**L999V]++Q///<8C==<<<#)=#3 	=Y555;]KKK}555m4446FFF*M:::*M:::#)=#3 	=Y5550-@@@,m<<<m444C]SSS*M:::#)=#3 	=Y555/???,m<<<}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     |j        |           |                     d
|           |                     ||           d S )NTc                   *    e Zd Zed             Zd ZdS )5TestOutputBuffering.testBufferSetupClass.<locals>.Fooc                 .    t          d           ddz   d S Nset up classrY   r   r  clss    r   
setUpClassz@TestOutputBuffering.testBufferSetupClass.<locals>.Foo.setUpClass)  s    n%%%!r   c                     d S r!   r   r3   s    r   r  z>TestOutputBuffering.testBufferSetupClass.<locals>.Foo.test_foo-  rU   r   Nr   r   r   classmethodr
  r  r   r   r   rW   r  (  <          [    r   rW   r  
Stdout:
set up class
rY   setUpClass ()r   r  r   r#   r?   r2   r[   r  rB   r:   rC   rD   r   r  r   r  s	            r   testBufferSetupClassz(TestOutputBuffering.testBufferSetupClass#  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455f2**L999V]++Q///5Xc]]555#)=#3 	=.<<<;]KKKlM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     |j        |           |                     d
|           |                     ||           d S )NTc                   *    e Zd Zed             Zd ZdS )8TestOutputBuffering.testBufferTearDownClass.<locals>.Fooc                 .    t          d           ddz   d S Ntear down classrY   r   r  r  s    r   tearDownClasszFTestOutputBuffering.testBufferTearDownClass.<locals>.Foo.tearDownClass@      '(((!r   c                     d S r!   r   r3   s    r   r  zATestOutputBuffering.testBufferTearDownClass.<locals>.Foo.test_fooD  rU   r   N)r   r   r   r  r  r  r   r   r   rW   r  ?  r  r   rW   r  
Stdout:
tear down class
rY   tearDownClass (r  r   r  r  r  s	            r   testBufferTearDownClassz+TestOutputBuffering.testBufferTearDownClass:  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455f5**L999V]++Q///8888#)=#3 	=.<<<;]KKKlM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     |j        |           |                     d
|           |                     d|           |                     ||           |j	        d         \  }}|                     |j        |           |                     d|           |                     d|           |                     ||           d S )NTc                   @    e Zd Zed             Zed             Zd ZdS ):TestOutputBuffering.testBufferDoClassCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     d S Nr  r&   addClassCleanupr(   r+   r  s    r   r
  zETestOutputBuffering.testBufferDoClassCleanups.<locals>.Foo.setUpClassW  >    n%%%##L111##L11111r   c                 $    t          d           d S )Nr  r  r  s    r   r  zHTestOutputBuffering.testBufferDoClassCleanups.<locals>.Foo.tearDownClass\  s    '(((((r   c                     d S r!   r   r3   s    r   r  zCTestOutputBuffering.testBufferDoClassCleanups.<locals>.Foo.test_foo_  rU   r   Nr   r   r   r  r
  r  r  r   r   r   rW   r"  V  sW        2 2 [2 ) ) [)    r   rW   r  1
Stdout:
tear down class
do cleanup2
do cleanup1
r   r  r  r   r  r'   rY   r  r*   r   r#   r?   r2   r[   r  rB   r:   rC   rD   r   r  r   r  r  s	            r   testBufferDoClassCleanupsz-TestOutputBuffering.testBufferDoClassCleanupsQ  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+
	 
	 
	 
	 
	(# 
	 
	 
	 "CC
OO#455fO**L999V]++Q///8888#)=#3 	=.<<<0-@@@m444lM222#)=#3 	=.<<</???}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     |j        |           |                     d
|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     |j        |           |                     d|           |                     d|           |                     d|           |                     ||           |j	        d         \  }}|                     |j        |           |                     d|           |                     d|           |                     d|           |                     ||           d S )NTc                   *    e Zd Zed             Zd ZdS )ETestOutputBuffering.testBufferSetupClass_DoClassCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     ddz   d S r  r%  r  s    r   r
  zPTestOutputBuffering.testBufferSetupClass_DoClassCleanups.<locals>.Foo.setUpClassx  sE    n%%%##L111##L111!r   c                     d S r!   r   r3   s    r   r  zNTestOutputBuffering.testBufferSetupClass_DoClassCleanups.<locals>.Foo.test_foo~  rU   r   Nr  r   r   r   rW   r0  w  s<          [
    r   rW   r  z.
Stdout:
set up class
do cleanup2
do cleanup1
r  r  r  r   r  r*   r'   r  rY   r  r   r   r  r,  r  s	            r   $testBufferSetupClass_DoClassCleanupsz8TestOutputBuffering.testBufferSetupClass_DoClassCleanupsr  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455fL**L999V]++Q///5Xc]]555#)=#3 	=.<<<;]KKK}555m4441=AAA#)=#3 	=.<<<0-@@@,m<<<m444lM222#)=#3 	=.<<</???,m<<<}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  }t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j	                  d           dt          |           d}|j	        d	         \  }}|                     |j        |           |                     d
|           |                     d|           |                     d|           |                     d|           |j	        d         \  }}|                     |j        |           |                     d|           |                     d|           |                     d|           |                     ||           |j	        d         \  }}|                     |j        |           |                     d|           |                     d|           |                     d|           |                     ||           d S )NTc                   @    e Zd Zed             Zed             Zd ZdS )HTestOutputBuffering.testBufferTearDownClass_DoClassCleanups.<locals>.Fooc                     t          d           |                     t                     |                     t                     d S r$  r%  r  s    r   r
  zSTestOutputBuffering.testBufferTearDownClass_DoClassCleanups.<locals>.Foo.setUpClass  r'  r   c                 .    t          d           ddz   d S r  r  r  s    r   r  zVTestOutputBuffering.testBufferTearDownClass_DoClassCleanups.<locals>.Foo.tearDownClass  r  r   c                     d S r!   r   r3   s    r   r  zQTestOutputBuffering.testBufferTearDownClass_DoClassCleanups.<locals>.Foo.test_foo  rU   r   Nr*  r   r   r   rW   r6    sW        2 2 [2   [    r   rW   r  r+  r  r  r  r   r  r*   r'   r  rY   r  r   r   r  r,  r  s	            r   'testBufferTearDownClass_DoClassCleanupsz;TestOutputBuffering.testBufferTearDownClass_DoClassCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 	 "CC
OO#455fO**L999V]++Q///8888#)=#3 	=.<<<;]KKK}555m4444mDDD#)=#3 	=.<<<0-@@@,m<<<m444lM222#)=#3 	=.<<</???,m<<<}555lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  } G d dt
                    }d|_        |t          j        d<   | 	                    t          j        j
        d           t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j                  d           d	}|j        d
         \  }}	|                     |j        |           |                     d|	           |                     ||	           d S )NTc                       e Zd Zd ZdS )6TestOutputBuffering.testBufferSetUpModule.<locals>.Fooc                     d S r!   r   r3   s    r   r  z?TestOutputBuffering.testBufferSetUpModule.<locals>.Foo.test_foo  rU   r   Nr   r   r   r  r   r   r   rW   r=    rX   r   rW   c                   $    e Zd Zed             ZdS )9TestOutputBuffering.testBufferSetUpModule.<locals>.Modulec                  .    t          d           ddz   d S Nset up modulerY   r   r  r   r   r   setUpModulezETestOutputBuffering.testBufferSetUpModule.<locals>.Module.setUpModule  s    o&&&!r   Nr   r   r   staticmethodrE  r   r   r   ModulerA    -          \  r   rH  r  
Stdout:
set up module
rY   setUpModule (Module)r   r  r   r#   r?   r2   r[   r   r   rv   modulesr   popr  rB   r:   rC   rD   r  r   
r   r  r   rW   rH  r  r  r  r   r   s
             r   testBufferSetUpModulez)TestOutputBuffering.testBufferSetUpModule  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 		 	 	 	 	V 	 	 	 " &H222"CC
OO#455f3**L999V]++Q///,#)=#3 	=.<<<;]KKKlM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  } G d dt
                    }d|_        |t          j        d<   | 	                    t          j        j
        d           t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j                  d           d	}|j        d
         \  }}	|                     |j        |           |                     d|	           |                     ||	           d S )NTc                       e Zd Zd ZdS )9TestOutputBuffering.testBufferTearDownModule.<locals>.Fooc                     d S r!   r   r3   s    r   r  zBTestOutputBuffering.testBufferTearDownModule.<locals>.Foo.test_foo  rU   r   Nr?  r   r   r   rW   rS    rX   r   rW   c                   $    e Zd Zed             ZdS )<TestOutputBuffering.testBufferTearDownModule.<locals>.Modulec                  .    t          d           ddz   d S Nztear down modulerY   r   r  r   r   r   tearDownModulezKTestOutputBuffering.testBufferTearDownModule.<locals>.Module.tearDownModule      ()))!r   N)r   r   r   rG  rY  r   r   r   rH  rV    rI  r   rH  r  
Stdout:
tear down module
rY   tearDownModule (Module)r   r  rL  rO  s
             r   testBufferTearDownModulez,TestOutputBuffering.testBufferTearDownModule  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 		 	 	 	 	V 	 	 	 " &H222"CC
OO#455f6**L999V]++Q////#)=#3 	=.<<<;]KKKlM22222r  c                 &   t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  } G d dt
                    }d|_        |t          j        d<   | 	                    t          j        j
        d           t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j                  d           d	}|j        d
         \  }}	|                     |j        |           |                     d|	           |                     d|	           |                     ||	           d S )NTc                       e Zd Zd ZdS );TestOutputBuffering.testBufferDoModuleCleanups.<locals>.Fooc                     d S r!   r   r3   s    r   r  zDTestOutputBuffering.testBufferDoModuleCleanups.<locals>.Foo.test_foo  rU   r   Nr?  r   r   r   rW   r`     rX   r   rW   c                   $    e Zd Zed             ZdS )>TestOutputBuffering.testBufferDoModuleCleanups.<locals>.Modulec                      t          d           t          j        t                     t          j        t                     d S NrD  r&   r#   addModuleCleanupr(   r+   r   r   r   rE  zJTestOutputBuffering.testBufferDoModuleCleanups.<locals>.Module.setUpModule  8    o&&&),777),77777r   NrF  r   r   r   rH  rc    s-        8 8 \8 8 8r   rH  r  z!
Stdout:
do cleanup2
do cleanup1
rY   r\  r   r  r'   r   r#   r?   r2   r[   r   r   rv   rM  r   rN  r  rB   r:   rC   rD   r  r   r  rO  s
             r   testBufferDoModuleCleanupsz.TestOutputBuffering.testBufferDoModuleCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 		8 	8 	8 	8 	8V 	8 	8 	8 " &H222"CC
OO#455f>**L999V]++Q////#)=#3 	=.<<<0-@@@m444lM22222r  c                    t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  } G d dt
                    }d|_        |t          j        d<   | 	                    t          j        j
        d           t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j                  d           d	}|j        d
         \  }}	|                     |j        |           |                     d|	           |                     d|	           |                     d|	           |                     d|	           |j        d         \  }}	|                     ||	           |                     |j        |           |                     d|	           |                     d|	           |                     d|	           |                     ||	           d S )NTc                       e Zd Zd ZdS )GTestOutputBuffering.testBufferSetUpModule_DoModuleCleanups.<locals>.Fooc                     d S r!   r   r3   s    r   r  zPTestOutputBuffering.testBufferSetUpModule_DoModuleCleanups.<locals>.Foo.test_foo  rU   r   Nr?  r   r   r   rW   rm    rX   r   rW   c                   $    e Zd Zed             ZdS )JTestOutputBuffering.testBufferSetUpModule_DoModuleCleanups.<locals>.Modulec                      t          d           t          j        t                     t          j        t                     ddz   d S rC  rf  r   r   r   rE  zVTestOutputBuffering.testBufferSetUpModule_DoModuleCleanups.<locals>.Module.setUpModule"  s?    o&&&),777),777!r   NrF  r   r   r   rH  rp  !  s-          \  r   rH  r  z/
Stdout:
set up module
do cleanup2
do cleanup1
r   rK  r   r  r*   r'   rJ  rY   r  r   ri  rO  s
             r   &testBufferSetUpModule_DoModuleCleanupsz:TestOutputBuffering.testBufferSetUpModule_DoModuleCleanups  s    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 		 	 	 	 	V 	 	 	 " &H222"CC
OO#455fM**L999V]++Q///,#)=#3 	=.<<<;]KKK}555m4442MBBB#)=#3 	=lM222.<<<0-@@@,m<<<m444lM22222r  c                 X   t                      5 }t          j                    }d d d            n# 1 swxY w Y   d|_         G d dt          j                  } G d dt
                    }d|_        |t          j        d<   | 	                    t          j        j
        d           t          j         |d          g          } ||           d}|                     |                                |           |                     t          |j                  d           d	}|j        d
         \  }}	|                     |j        |           |                     d|	           |                     d|	           |                     d|	           |                     d|	           |j        d         \  }}	|                     |j        |           |                     d|	           |                     d|	           |                     d|	           |                     ||	           d S )NTc                       e Zd Zd ZdS )JTestOutputBuffering.testBufferTearDownModule_DoModuleCleanups.<locals>.Fooc                     d S r!   r   r3   s    r   r  zSTestOutputBuffering.testBufferTearDownModule_DoModuleCleanups.<locals>.Foo.test_fooF  rU   r   Nr?  r   r   r   rW   ru  E  rX   r   rW   c                   :    e Zd Zed             Zed             ZdS )MTestOutputBuffering.testBufferTearDownModule_DoModuleCleanups.<locals>.Modulec                      t          d           t          j        t                     t          j        t                     d S re  rf  r   r   r   rE  zYTestOutputBuffering.testBufferTearDownModule_DoModuleCleanups.<locals>.Module.setUpModuleI  rh  r   c                  .    t          d           ddz   d S rX  r  r   r   r   rY  z\TestOutputBuffering.testBufferTearDownModule_DoModuleCleanups.<locals>.Module.tearDownModuleN  rZ  r   N)r   r   r   rG  rE  rY  r   r   r   rH  rx  H  sH        8 8 \8   \  r   rH  r  z2
Stdout:
tear down module
do cleanup2
do cleanup1
r   r\  r   r  r*   r'   r[  rY   r  r   ri  rO  s
             r   )testBufferTearDownModule_DoModuleCleanupsz=TestOutputBuffering.testBufferTearDownModule_DoModuleCleanups@  sq    	+&(**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	 	 	 	 	(# 	 	 			 		 		 		 		V 		 		 		 " &H222"CC
OO#455fP**L999V]++Q////#)=#3 	=.<<<;]KKK}555m4445}EEE#)=#3 	=.<<<0-@@@,m<<<m444lM22222r  N)r   r   r   r  r<  r  r  r  r  r  r  r  r  r  r  r  r-  r3  r:  rP  r]  rj  rr  r{  r   r   r   r  r    sZ       $ $ $$ $ $, , ,-4 -4 -4`  -D -D -D^3 3 3,3 3 3,3 3 3<'3 '3 '3R)3 )3 )3V3 3 3.3 3 3.3 3 3B%3 %3 %3N(3 (3 (3T3 3 383 3 383 3 3<%3 %3 %3N'3 '3 '3 '3 '3r   r  __main__r  ) r  rv   r  test.supportr   r   r   r"   r#   unittest.utilr   r   r   r$   r(   r+   r-   r[   r<   r   dictr?   __dict__	classDictmr   typerp  rr  r  r   mainr   r   r   <module>r     sP   				 



  J J J J J J J J J J      " " " " " "    F   * * *$ $ $
% % %
        c@ c@ c@ c@ c@h' c@ c@ c@LfH fH fH fH fH(+ fH fH fHR D$-..	
  A!    !	* Dvi33	1$ 1$ 1$ 1$ 1$* 1$ 1$ 1$h`	3 `	3 `	3 `	3 `	3(+ `	3 `	3 `	3F zHMOOOOO r   