+
    BiU                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI5 ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIt ! R R]P                   4      t ! R R	]P                   4      t ! R
 R]P                   4      t ! R R]P                   4      t ! R R]P                   4      t ! R R]P                   4      t ! R R]4      t ! R R]P                   4      t ! R R4      t ! R R]]P                   4      t ! R R4      t ! R R]]P                   4      t ! R R]]P                   4      t ! R  R!]]P                   4      t ! R" R#]P                   4      t ]!R$8X  d   ]PD                  ! 4        R# R# )%z9Unit tests for contextlib.py, and other context managers.N)*)support)	os_helper)ExceptionIsLikeMixinc                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )TestAbstractContextManagerc                r     ! R  R\         4      pV! 4       pV P                  VP                  4       V4       R# )c                   2   a a ] tR t^t oV 3R ltRtVtV ;t# );TestAbstractContextManager.test_enter.<locals>.DefaultEnterc                $   < \         SV `  ! V!   R # Nsuper__exit__selfargs	__class__s   &*+/usr/lib/python3.14/test/test_contextlib.pyr   DTestAbstractContextManager.test_enter.<locals>.DefaultEnter.__exit__        $'     __name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r   DefaultEnterr
           ( (r   r#   N)AbstractContextManagerassertIs	__enter__)r   r#   managers   &  r   
test_enter%TestAbstractContextManager.test_enter   s/    	(1 	( .g'')73r   c                     ! R  R\         4      pV P                  \        4      ;_uu_ 4        ^*V! 4       n        RRR4       R#   + '       g   i     R# ; i)c                   6   a a ] tR t^t oRtV 3R ltRtVtV ;t# )DTestAbstractContextManager.test_slots.<locals>.DefaultContextManagerc                $   < \         SV `  ! V!   R # r   r   r   s   &*r   r   MTestAbstractContextManager.test_slots.<locals>.DefaultContextManager.__exit__   r   r   r   )	r   r   r   r   	__slots__r   r   r   r    r!   s   @@r   DefaultContextManagerr-      s     I( (r   r1   N)r%   assertRaisesAttributeErrorvar)r   r1   s   & r   
test_slots%TestAbstractContextManager.test_slots   s=    	($: 	( ~..*,!#' /...s   AA	c                     ! R  R\         4      pV P                  \        4      ;_uu_ 4        V! 4        RRR4       R#   + '       g   i     R# ; i)c                       ] tR t^&tRtR# )ETestAbstractContextManager.test_exit_is_abstract.<locals>.MissingExitr   Nr   r   r   r   r   r   r   r   MissingExitr9   &       r   r;   N)r%   r2   	TypeError)r   r;   s   & r   test_exit_is_abstract0TestAbstractContextManager.test_exit_is_abstract%   s6    	0 	 y))M *)))s	   ?A	c                    ! R  R4      pV P                  V\        4        ! R R\        4      pV P                  V\        4        ! R RV4      pV P                  V\        4        ! R RV4      pV P                  V\        4       R# )	c                   ,   a  ] tR t^-t o R tR tRtV tR# )RTestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratchc                    V # r   r   r   s   &r   r'   \TestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratch.__enter__.       r   c                    R # r   r   )r   exc_type	exc_value	tracebacks   &&&&r   r   [TestAbstractContextManager.test_structural_subclassing.<locals>.ManagerFromScratch.__exit__0   s    r   r   Nr   r   r   r   r'   r   r   r   r"   s   @r   ManagerFromScratchrB   -   s      r   rN   c                   2   a a ] tR t^5t oV 3R ltRtVtV ;t# )LTestAbstractContextManager.test_structural_subclassing.<locals>.DefaultEnterc                $   < \         SV `  ! V!   R # r   r   r   s   &*r   r   UTestAbstractContextManager.test_structural_subclassing.<locals>.DefaultEnter.__exit__6   r   r   r   r   r!   s   @@r   r#   rP   5   r$   r   r#   c                       ] tR t^;tRtRtR# )GTestAbstractContextManager.test_structural_subclassing.<locals>.NoEnterNr   )r   r   r   r   r'   r   r   r   r   NoEnterrT   ;   s    Ir   rU   c                       ] tR t^@tRtRtR# )FTestAbstractContextManager.test_structural_subclassing.<locals>.NoExitNr   )r   r   r   r   r   r   r   r   r   NoExitrW   @   s    Hr   rX   N)assertIsSubclassr%   assertNotIsSubclass)r   rN   r#   rU   rX   s   &    r   test_structural_subclassing6TestAbstractContextManager.test_structural_subclassing,   s    	 	 	02HI	(1 	( 	l,BC	( 	 	  *@A	' 	 	  )?@r   r   N)
r   r   r   r   r)   r5   r>   r[   r   r   rM   s   @r   r   r      s      4-A Ar   r   c                      a  ] tR t^Ft o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR t]P(                  R 4       t]P(                  R 4       tR tR tR tR tRtV tR# )ContextManagerTestCasec                  a . o\         V3R  l4       pV! 4       ;_uu_ 4       pV P                  S^.4       V P                  V^*4       SP                  V4       RRR4       V P                  S. RO4       R#   + '       g   i     L&; i)c               3   \   <"   S P                  ^4       ^*x  S P                  R4       R# 5i     Nappendstates   r   woohoo@ContextManagerTestCase.test_contextmanager_plain.<locals>.woohooJ   s"     LLOHLL   ),Nrb   *   rc   )contextmanagerassertEqualre   r   rh   xrg   s   &  @r   test_contextmanager_plain0ContextManagerTestCase.test_contextmanager_plainH   sq    		 
	 XXUQC(Q#LLO  	-	 Xs   7A77B	c           	       a . o\         V3R  l4       pV P                  \        4      ;_uu_ 4        V! 4       ;_uu_ 4       pV P                  S^.4       V P                  V^*4       SP	                  V4       \        4       h  + '       g   i     M; i RRR4       M  + '       g   i     M; iT P                  S. RO4       R# )c               3      <"   S P                  ^4        ^*x  S P                  R4       R#   S P                  R4       i ; i5ira   rd   rf   s   r   rh   BContextManagerTestCase.test_contextmanager_finally.<locals>.woohooW   s3     LLO"S!S!s   A- AA  ANrk   )rm   r2   ZeroDivisionErrorrn   re   ro   s   &  @r   test_contextmanager_finally2ContextManagerTestCase.test_contextmanager_finallyU   s    		" 
	" 011Q  ,  B'Q'))	  2111 	-s   B AB	BBB.	c           
        \         R  4       p V! 4       ;_uu_ 4        ^^ ,           RRR4       T P                  \        X4      ^4       T P                  T^ ,          P                  R4       T P                  T^ ,          P                  R4        ! R R\        4      p T! 4       ;_uu_ 4        T! ^*4      h  + '       g   i     L; i  \         d+   p\        P                  ! TP                  4      p Rp?LRp?ii ; i  + '       g   i     M7; i  T d+   p\        P                  ! TP                  4      p Rp?MRp?ii ; iT P                  \        T4      ^4       T P                  T^ ,          P                  R4       T P                  T^ ,          P                  R4        ! R R\        4      p\        R	4      T! R	4      3 EF0  pT P                  \        T4      R
7      ;_uu_ 4         T! 4       ;_uu_ 4        Th  + '       g   i     M; i T P                  T R24       MN  \        T4       d<   pT P                  Y&4       \        P                  ! TP                  4      p Rp?MRp?ii ; iT P                  \        T4      ^4       T P                  T^ ,          P                  R4       T P                  T^ ,          P                  R4       RRR4       EK    + '       g   i     EK0  ; i	  R# )c               3      "   R x  R # 5ir   r   r   r   r   f?ContextManagerTestCase.test_contextmanager_traceback.<locals>.fg           	Ntest_contextmanager_traceback1/0c                       ] tR t^vtRtR# )RContextManagerTestCase.test_contextmanager_traceback.<locals>.RuntimeErrorSubclassr   Nr:   r   r   r   RuntimeErrorSubclassr   v   r<   r   r   zraise RuntimeErrorSubclass(42)c                       ] tR t^tRtR# )SContextManagerTestCase.test_contextmanager_traceback.<locals>.StopIterationSubclassr   Nr:   r   r   r   StopIterationSubclassr      r<   r   r   spamtype was suppressedzraise stop_exc)rm   rv   rJ   
extract_tb__traceback__rn   lennamelineRuntimeErrorStopIterationsubTestr   failr&   )r   r{   eframesr   r   stop_excs   &      r   r   4ContextManagerTestCase.test_contextmanager_tracebackf   s4   		 
		;! 
 	Va()HI/	< 		;*2..   	;))!//:F	; # 	;))!//:F	; 	Va()HI)IJ	M 	 &!!&)
H 4>22<&  II
/:;	 H~ CMM!.&11!//BFC   Va0  1PQ  1AB 3222	
s   C 
B8C  D /	D8C	C C D  C;;D D	D D E EE4K+6H1HHH1K+1I<	1I7	2K+7I<	<A$K++K=c                    \         R  4       pV! 4       pVP                  4        V P                  VP                  \        \	        R4      R4      4       R# )c               3      "   R x  R # 5ir   r   r   r   r   wheeCContextManagerTestCase.test_contextmanager_no_reraise.<locals>.whee   r}   r~   fooN)rm   r'   assertFalser   r=   )r   r   ctxs   &  r   test_contextmanager_no_reraise5ContextManagerTestCase.test_contextmanager_no_reraise   sD    		 
	fi51A4HIr   c                   \         R  4       pV! 4       pVP                  4        V P                  \        4      ;_uu_ 4        VP	                  \
        \        R4      R4       RRR4       \        P                  ! RR7      '       d(   V P                  VP                  P                  4       R# R#   + '       g   i     LV; i)c               3   0   "    R x  R #    R x   R # ; i5ir   r   r   r   r   whooOContextManagerTestCase.test_contextmanager_trap_yield_after_throw.<locals>.whoo   s     s   
 r   NTcpython)rm   r'   r2   r   r   r=   r   check_impl_detailr   gengi_suspendedr   r   r   s   &  r   *test_contextmanager_trap_yield_after_throwAContextManagerTestCase.test_contextmanager_trap_yield_after_throw   s    		 
	
 f|,,LLIe$4d; -$$T22SWW112 3 -,s   !B00C 	c                    \         R  4       pV! 4       pV P                  \        4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)c               3      "   R# 5i)FNr   r   r   r   r   FContextManagerTestCase.test_contextmanager_trap_no_yield.<locals>.whoo   s     s   N)rm   r2   r   r'   r   s   &  r   !test_contextmanager_trap_no_yield8ContextManagerTestCase.test_contextmanager_trap_no_yield   sF    		 
	 f|,,MMO -,,,s   AA	c                l   \         R  4       pV! 4       pVP                  4        V P                  \        4      ;_uu_ 4        VP	                  RRR4       RRR4       \
        P                  ! RR7      '       d(   V P                  VP                  P                  4       R# R#   + '       g   i     LV; i)c               3      "   R x  R x  R # 5ir   r   r   r   r   r   JContextManagerTestCase.test_contextmanager_trap_second_yield.<locals>.whoo   s     s   NTr   )
rm   r'   r2   r   r   r   r   r   r   r   r   s   &  r   %test_contextmanager_trap_second_yield<ContextManagerTestCase.test_contextmanager_trap_second_yield   s    		 
	 f|,,LLtT* -$$T22SWW112 3 -,s   B##B3	c                    \         R  4       pV! 4       pVP                  4        V P                  \        4      ;_uu_ 4        VP	                  \
        RR4       RRR4       R#   + '       g   i     R# ; i)c               3   B   "    R x  R #   \          d    \        hi ; i5ir   )r   SyntaxErrorr   r   r   r   GContextManagerTestCase.test_contextmanager_non_normalised.<locals>.whoo   s!     " "!!"s   
 N)rm   r'   r2   r   r   r   r   s   &  r   "test_contextmanager_non_normalised9ContextManagerTestCase.test_contextmanager_non_normalised   sV    		" 
	" f{++LLtT2 ,+++s   A##A4	c                  a a . o\         V V3R  l4       pV! 4       ;_uu_ 4       pS P                  S^.4       S P                  V^*4       SP                  V4       \        R4      h  + '       g   i     M; iS P                  S. RO4       R# )c               3      <"   SP                  ^4        ^*x  R#   \         dB   p SP                  T P                  ^ ,          4       SP                  S. RO4        Rp ? R# Rp ? ii ; i5i)rb   Nrk   )re   rv   r   rn   )r   r   rg   s    r   rh   AContextManagerTestCase.test_contextmanager_except.<locals>.woohoo   sQ     LLO6$ 6QVVAY'  556s*   A+ A+A(6A#A+#A((A+rc   Nrk   )rm   rn   re   rv   ro   s   f  @r   test_contextmanager_except1ContextManagerTestCase.test_contextmanager_except   sw    		6 
	6 XXUQC(Q#LLO#C((	 X
 	-s   AA&&A6	c           
        \         R  4       p ! R R\        4      p\        R4      V! R4      3 F8  pV P                  \        V4      R7      ;_uu_ 4         V! 4       ;_uu_ 4        Vh	  R#   + '       g   i     M; i T P	                  T R24       M)  \
         d   pT P                  YC4        Rp?MRp?ii ; iRRR4       K    + '       g   i     K  ; i)c               3      "   R x  R # 5ir   r   r   r   r   rh   JContextManagerTestCase.test_contextmanager_except_stopiter.<locals>.woohoo   r}   r~   c                       ] tR t^tRtR# )YContextManagerTestCase.test_contextmanager_except_stopiter.<locals>.StopIterationSubclassr   Nr:   r   r   r   r   r      r<   r   r   r   r   Nr   )rm   r   r   r   r   	Exceptionr&   )r   rh   r   r   exs   &    r   #test_contextmanager_except_stopiter:ContextManagerTestCase.test_contextmanager_except_stopiter   s    		 
		M 	 'v.0Ef0MNH4>22<&	 O "
 II
/:; ! 0MM"//0	 3222sH   C	B&A--A=8BC	B<	!B7	2C	7B<	<C		Cc                   R p/ p\        WV4       VR,          p\        R4      p V! 4       ;_uu_ 4        Vh  + '       g   i     M; i T P                  R4       R#   \         d   pT P	                  YT4        Rp?R# Rp?ii ; i)ztfrom __future__ import generator_stop
from contextlib import contextmanager
@contextmanager
def woohoo():
    yield
rh   r   NzStopIteration was suppressed)execr   r   r   r&   )r   codelocalsrh   r   r   s   &     r   !test_contextmanager_except_pep4798ContextManagerTestCase.test_contextmanager_except_pep479   sy     T6"! (	6 
 II45  	(MM"''	(s&   A 8A	A B*BBc                   \         R  4       p V! 4       ;_uu_ 4        \        h  + '       g   i     M}; i  \         dm   pT P                  \	        T4      \
        4       T P                  TP                  ^ ,          R4       T P                  TP                  \        4        Rp?MRp?ii ; i T! 4       ;_uu_ 4        \        R4      h  + '       g   i     R# ; i  \         di   pT P                  \	        T4      \        4       T P                  TP                  ^ ,          R4       T P                  TP                  4        Rp?R# Rp?ii ; i)c               3   V   "    R x  R #   \          d   p \        R4      T hR p ? ii ; i5i)Nissue29692:Chainedr   r   excs    r   test_issue29692oContextManagerTestCase.test_contextmanager_do_not_unchain_non_stopiteration_exceptions.<locals>.test_issue29692  s-     B B"#78cABs   )
 )&!&)Nr   zissue29692:Unchained)rm   rv   r   r&   r   r   rn   r   assertIsInstance	__cause__r   assertIsNone)r   r   r   s   &  r   ?test_contextmanager_do_not_unchain_non_stopiteration_exceptionsVContextManagerTestCase.test_contextmanager_do_not_unchain_non_stopiteration_exceptions  s    		B 
	B
	C ""'' #" 	CMM$r(L1RWWQZ)=>!!",,0ABB	C
	, ""#$:;; #"" 	,MM$r(M2RWWQZ)?@bll++	,sW   7 $4	7 7 B.A"B))B.2C! CC	C! C! !E,AEEc           	        \         R  4       pV P                  \        4      ;_uu_ 4        V! 4       ;_uu_ 4        ^^ ,           RRR4       RRR4       V P                  \        4      ;_uu_ 4        V! 4       ;_uu_ 4        \        h  + '       g   i     LL; i  + '       g   i     LW; i  + '       g   i     M; i RRR4       R#   + '       g   i     R# ; i)c               3   \   "    R x  R #   \          d   p \        RT  24      T hR p ? ii ; i5i)Nzcaught r   r   s    r   rh   LContextManagerTestCase.test_contextmanager_wrap_runtimeerror.<locals>.woohoo#  s/     = ="WSE?3<=s   ,
 ,)$),N)rm   r2   r   r   r   rh   s   & r   %test_contextmanager_wrap_runtimeerror<ContextManagerTestCase.test_contextmanager_wrap_runtimeerror"  s    		= 
	= |,,A  - }--##  -,  .---s@   B
B	B1CB.	BBB+	.B>9CC	c                <    R  p\         V! RR7      R 4       4       pV# )c                     a  V 3R  lpV# )c                 R   < SP                  4        F  w  r\        WV4       K  	  V # r   )itemssetattr)funckvkws   &  r   decorateXContextManagerTestCase._create_contextmanager_attribs.<locals>.attribs.<locals>.decorate7  s$    88:CAD1% &r   r   )r   r   s   l r   attribsFContextManagerTestCase._create_contextmanager_attribs.<locals>.attribs6  s     Or   barr   c              3     "   Rx  R# 5iWhee!Nr   )r   s   &r   bazBContextManagerTestCase._create_contextmanager_attribs.<locals>.baz<  s
      r~   rm   )r   r   r   s   &  r   _create_contextmanager_attribs5ContextManagerTestCase._create_contextmanager_attribs5  s/    	 
	U		 
 
	 
r   c                    V P                  4       pV P                  VP                  R 4       V P                  VP                  R4       R# )r   r   N)r   rn   r   r   r   r   s   & r   test_contextmanager_attribs2ContextManagerTestCase.test_contextmanager_attribsC  s8    113e,%(r   c                ^    V P                  4       pV P                  VP                  R 4       R# r   r   rn   __doc__r   s   & r   test_contextmanager_doc_attrib5ContextManagerTestCase.test_contextmanager_doc_attribH  s$    113g.r   c                j    V P                  4       ! R 4      pV P                  VP                  R4       R # )Nr   r   r   s   & r   *test_instance_docstring_given_cm_docstringAContextManagerTestCase.test_instance_docstring_given_cm_docstringM  s)    113D9g.r   c                    \         R  4       pV! ^^^!^,R7      ;_uu_ 4       pV P                  VR4       RRR4       R#   + '       g   i     R# ; i)c              3      "   WW#3x  R # 5ir   r   r   r   r   kwdss   &&&&r   rh   4ContextManagerTestCase.test_keywords.<locals>.woohooT  s     t**s   	r	  N)      !   ,   rm   rn   )r   rh   targets   &  r   test_keywords$ContextManagerTestCase.test_keywordsR  sG    		+ 
	+"2B776V%56 8777s	   >A	c                   a   ! R  R4      p\         V 3R l4       pV! V! 4       V! 4       R7      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)c                       ] tR tRtRtR# )0ContextManagerTestCase.test_nokeepref.<locals>.Ai[  r   Nr:   r   r   r   Ar  [  r<   r   r  c              3      <"   \         P                  ! V 4      p \         P                  ! V4      p\        P                  ! 4        SP	                  V ! 4       4       SP	                  V! 4       4       R x  R # 5ir   )weakrefrefr   
gc_collectr   )abr   s   &&r   rh   5ContextManagerTestCase.test_nokeepref.<locals>.woohoo^  sO     AAAA ac"ac"s   A4A7r  Nr   )r   r  rh   s   f  r   test_nokeepref%ContextManagerTestCase.test_nokeeprefZ  sF    	 	 
	 
	 AC13  s   AA	c                   \         R  4       pV P                  \        4      ;_uu_ 4        V! 4        RRR4       V P                  \        4      ;_uu_ 4        V! ^^4       RRR4       V P                  \        4      ;_uu_ 4        V! ^R7       RRR4       R#   + '       g   i     Lp; i  + '       g   i     LT; i  + '       g   i     R# ; i)c             3      "   R x  R # 5ir   r   r  r  s   &$r   rh   8ContextManagerTestCase.test_param_errors.<locals>.woohool  r}   r~   Nr  )rm   r2   r=   r   s   & r   test_param_errors(ContextManagerTestCase.test_param_errorsk  s    		 
	 y))H *y))1aL *y))QK *)	 *))))))s#   B
B-
C B*	-B=	 C	c                   a aaa ^ o^ o\         VVV 3R l4       pV! 4       VV3R l4       oS! 4        S P                  S^
4       S P                  S^ 4       R# )    c               3   v   <"   S^,          oSp S^,          oRx  S^,          oSP                  SV 4       R# 5irb   N)rn   )beforedepthncolsr   s    r   rh   5ContextManagerTestCase.test_recursive.<locals>.woohooz  s;      QJEFQJEQJEUF+s   69c                  (   < S ^
8  d
   S! 4        R# R# )
   Nr   )r-  	recursives   r   r2  8ContextManagerTestCase.test_recursive.<locals>.recursive  s    rz r   Nr  )r   rh   r-  r.  r2  s   f @@@r   test_recursive%ContextManagerTestCase.test_recursivew  s\    		, 
	, 
	 
	 	#"r   r   N)r   r   r   r   rq   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   requires_docstringsr  r  r  r   r&  r4  r   r   rM   s   @r   r^   r^   F   s     .."0CdJ333."<$6*,.$&)
   / !/   / !/7"
# #r   r^   c                   P   a  ] tR tRt o ]P
                  R 4       tR tR tRt	V t
R# )ClosingTestCasei  c                t    \         P                  p\        R 4      pV P                  VP                  V4       R # r   )closingr  rn   r   cm_docstringobjs   &  r   test_instance_docs"ClosingTestCase.test_instance_docs  s*     dml3r   c                   a . o ! V3R  lR4      pV! 4       pV P                  S. 4       \        V4      ;_uu_ 4       pV P                  W#4       RRR4       V P                  S^.4       R#   + '       g   i     L%; i)c                   .   <a  ] tR tRt o V3R ltRtV tR# )'ClosingTestCase.test_closing.<locals>.Ci  c                *   < SP                  ^4       R# r+  rd   r   rg   s   &r   close-ClosingTestCase.test_closing.<locals>.C.close      Qr   r   Nr   r   r   r   rE  r   r   r"   rg   s   @r   CrB            r   rJ  N)rn   r:  r   rJ  rp   yrg   s   &   @r   test_closingClosingTestCase.test_closing  sc    	  	  C#QZZ1Q" $ Zs   A,,A<	c           	       a . o ! V3R  lR4      pV! 4       pV P                  S. 4       V P                  \        4      ;_uu_ 4        \        V4      ;_uu_ 4       pV P                  W#4       ^^ ,           RRR4       RRR4       V P                  S^.4       R#   + '       g   i     L-; i  + '       g   i     L8; i)c                   .   <a  ] tR tRt o V3R ltRtV tR# )-ClosingTestCase.test_closing_error.<locals>.Ci  c                *   < SP                  ^4       R# r+  rd   rD  s   &r   rE  3ClosingTestCase.test_closing_error.<locals>.C.close  rG  r   r   NrH  rI  s   @r   rJ  rR    rK  r   rJ  N)rn   r2   rv   r:  rL  s   &   @r   test_closing_error"ClosingTestCase.test_closing_error  s    	  	  C#011q  &A  2 	$  21s$   B.B	6B.B+&B..B>	r   N)r   r   r   r   r   r6  r>  rN  rU  r   r   rM   s   @r   r8  r8    s,       4 !4	%% %r   r8  c                   &   a  ] tR tRt o R tRtV tR# )NullcontextTestCasei  c                     ! R  R4      pV! 4       p\        V4      ;_uu_ 4       pV P                  W24       RRR4       R#   + '       g   i     R# ; i)c                       ] tR tRtRtR# )/NullcontextTestCase.test_nullcontext.<locals>.Ci  r   Nr:   r   r   r   rJ  r[    r<   r   rJ  N)nullcontextr&   )r   rJ  cc_ins   &   r   test_nullcontext$NullcontextTestCase.test_nullcontext  s6    	 	C^^tMM$" ^^^s   AA	r   N)r   r   r   r   r_  r   r   rM   s   @r   rX  rX    s     # #r   rX  c                   &   a  ] tR tRt o R tRtV tR# )FileContextTestCasei  c           	        \         P                  ! 4       p \        VR RR7      ;_uu_ 4       pV P                  VP                  4       VP                  R4       RRR4       V P                  XP                  4       V P                  \        4      ;_uu_ 4        \        VRRR7      ;_uu_ 4       pV P                  VP                  4       V P                  VP                  4       R4       ^^ ,           RRR4       RRR4       V P                  VP                  4       \        P                  ! V4       R#   + '       g   i     L; i  + '       g   i     L^; i  + '       g   i     Li; i  \        P                  ! T4       i ; i)wzutf-8)encodingzBooh
Nr)tempfilemktempopenr   closedwrite
assertTruer2   rv   rn   readr   unlink)r   tfnr{   s   &  r   testWithOpen FileContextTestCase.testWithOpen  s   oo	"c311Q  *! 2 OOAHH%""#455#sW55$$QXX.$$QVVXx8E 6 6
 OOAHH%S! 21
 65 65 S!sT   E2 -D9A E2 E1AE	6E>#E2 9E		E2 EEE/	*E2 2F
r   N)r   r   r   r   rp  r   r   rM   s   @r   rb  rb    s     " "r   rb  c                   D   a  ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
LockContextTestCasei  c           	        V P                  V! 4       4       V;_uu_ 4        V P                  V! 4       4       R R R 4       V P                  V! 4       4       V P                  \        4      ;_uu_ 4        V;_uu_ 4        V P                  V! 4       4       ^^ ,           R R R 4       R R R 4       V P                  V! 4       4       R #   + '       g   i     L; i  + '       g   i     LC; i  + '       g   i     LN; ir   )r   rl  r2   rv   )r   locklockeds   &&&r   boilerPlateLockContextTestCase.boilerPlate  s    "TOOFH% "011)A  2 	" T  21s/   C3C,> C	C,C	C)$C,,C<	c                f    \         P                  ! 4       pV P                  WP                  4       R # r   )	threadingLockrw  rv  r   ru  s   & r   testWithLock LockContextTestCase.testWithLock  s     ~~{{+r   c                f    \         P                  ! 4       pV P                  WP                  4       R # r   )rz  RLockrw  	_is_ownedr|  s   & r   testWithRLock!LockContextTestCase.testWithRLock  s      ~~.r   c                b   a \         P                  ! 4       oV3R  lpV P                  SV4       R# )c                  $   < S P                  4       # r   )r  ru  s   r   rv  5LockContextTestCase.testWithCondition.<locals>.locked  s    >>##r   N)rz  	Conditionrw  r   rv  ru  s   & @r   testWithCondition%LockContextTestCase.testWithCondition  s&    ""$	$v&r   c                b   a \         P                  ! 4       oV3R  lpV P                  SV4       R# )c                  Z   < S P                  R 4      '       d   S P                  4        R # R# FTacquirereleaser  s   r   rv  5LockContextTestCase.testWithSemaphore.<locals>.locked  !    ||E""r   N)rz  	Semaphorerw  r  s   & @r   testWithSemaphore%LockContextTestCase.testWithSemaphore  s(    ""$	 	v&r   c                b   a \         P                  ! 4       oV3R  lpV P                  SV4       R# )c                  Z   < S P                  R 4      '       d   S P                  4        R # R# r  r  r  s   r   rv  <LockContextTestCase.testWithBoundedSemaphore.<locals>.locked  r  r   N)rz  BoundedSemaphorerw  r  s   & @r   testWithBoundedSemaphore,LockContextTestCase.testWithBoundedSemaphore  s(    ))+	 	v&r   r   N)r   r   r   r   rw  r}  r  r  r  r  r   r   rM   s   @r   rs  rs    s(     	#,/''' 'r   rs  c                   <   a  ] tR tRt o RtRtRtRtR tR t	Rt
V tR# )	mycontexti  z9Example decoration-compatible context manager for testingFNc                    R V n         V # TstartedrD   s   &r   r'   mycontext.__enter__  s    r   c                &    Wn         V P                  # r   )r   catchr   r   s   &*r   r   mycontext.__exit__  s    zzr   r   r  )r   r   r   r   r  r  r   r  r'   r   r   r   rM   s   @r   r  r    s&     CG
CE r   r  c                   z   a  ] tR tRt o ]P
                  R 4       tR tR tR t	R t
R tR tR	 tR
 tR tRtV tR# )TestContextDecoratori  c                r    \         P                  p\        4       pV P                  VP                  V4       R # r   )r  r  rn   r;  s   &  r   r>  'TestContextDecorator.test_instance_docs  s*     !((kl3r   c                    \        4       pV;_uu_ 4       pV P                  W!4       V P                  VP                  4       R R R 4       V P	                  VP
                  R4       R #   + '       g   i     L.; i)NNNN)r  r&   rl  r  rn   r   )r   contextresults   &  r   test_contextdecorator*TestContextDecorator.test_contextdecorator  sP    +WMM&*OOGOO,  	&89	 Ws   -A((A8	c           	     `   \        4       pV P                  \        R 4      ;_uu_ 4        T;_uu_ 4        \        R 4      h  + '       g   i     M; i RRR4       M  + '       g   i     M; iT P                  TP                  4       T P                  TP                  ^ ,          \        4       \        4       pRTn        T;_uu_ 4        \        R 4      h  + '       g   i     M; iT P                  TP                  4       T P                  TP                  ^ ,          \        4       R# )r   NT)r  assertRaisesRegex	NameErrorassertIsNotNoner   r&   r  )r   r  s   & r   $test_contextdecorator_with_exception9TestContextDecorator.test_contextdecorator_with_exception  s    +##Iu55&&  6555 	W[[)gkk!ni0+WE"" WW[[)gkk!ni0s(   AA 	 AAA-	CC)	c                |   a a \        4       oSVV 3R  l4       pV! 4        S P                  SP                  R4       R# )c                  t   < SP                  S P                  4       SP                  S P                  4       R # r   r   r   rl  r  r  r   s   r   test1TestContextDecorator.test_decorator.<locals>.test1  %    gkk*OOGOO,r   Nr  )r  rn   r   r   r  r  s   f @r   test_decorator#TestContextDecorator.test_decorator.  s8    +		- 
	- 	&89r   c                <  a a \        4       oSVV 3R  l4       pS P                  \        R4      ;_uu_ 4        V! 4        RRR4       S P                  SP                  4       S P                  SP                  ^ ,          \        4       R#   + '       g   i     LT; i)c                     < SP                  S P                  4       SP                  S P                  4       \	        R 4      hr   )r   r   rl  r  r  r  s   r   r  @TestContextDecorator.test_decorator_with_exception.<locals>.test<  s0    gkk*OOGOO,E""r   r   N)r  r  r  r  r   r&   r  s   f @r   test_decorator_with_exception2TestContextDecorator.test_decorator_with_exception9  sl    +		# 
	#
 ##Iu55F 6W[[)gkk!ni0 65s   BB	c                  a \        4       o ! V3R  lR\        4      pV! 4       pVP                  ^^4       V P                  VP                  ^4       V P                  VP
                  ^4       V P                  VP                  R4       V! 4       pVP                  RRR4       V P                  VP                  R4       V P                  VP
                  R4       V P                  VP                  R4       V! 4       pVP                  ^^R7       V P                  VP                  ^4       V P                  VP
                  ^4       R# )c                   8   <a  ] tR tRt o  ZRR l4       tRtV tR# )9TestContextDecorator.test_decorating_method.<locals>.TestiK  Nc                *    Wn         W n        W0n        R # r   r  r  r]  )r   r  r  r]  s   &&&&r   method@TestContextDecorator.test_decorating_method.<locals>.Test.methodM  s    r   r  r   )r   r   r   r   r  r   r   )r"   r  s   @r   Testr  K  s      r   r  Nr  r  r]  r$  )r  objectr  rn   r  r  r]  )r   r  r  r  s   &  @r   test_decorating_method+TestContextDecorator.test_decorating_methodH  s    +	6 	 vAq##&vCc"%%%va1##r   c           	          ! R  R\         4      pV P                  \        R4      ;_uu_ 4        V! 4       ;_uu_ 4         RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                   ,   a  ] tR tRt o R tR tRtV tR# )7TestContextDecorator.test_typo_enter.<locals>.mycontextig  c                    R # r   r   rD   s   &r   	__unter__ATestContextDecorator.test_typo_enter.<locals>.mycontext.__unter__h      r   c                    R # r   r   r  s   &*r   r   @TestContextDecorator.test_typo_enter.<locals>.mycontext.__exit__j  r  r   r   N)r   r   r   r   r  r   r   r   rM   s   @r   r  r  g        r   r  the context managerNContextDecoratorr  r=   r   r  s   & r   test_typo_enter$TestContextDecorator.test_typo_enterf  sP    	( 	 ##I/DEE  FE FEE"   A%A	 A%A"A%%A6	c           	          ! R  R\         4      pV P                  \        R4      ;_uu_ 4        V! 4       ;_uu_ 4         RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                   ,   a  ] tR tRt o R tR tRtV tR# )6TestContextDecorator.test_typo_exit.<locals>.mycontextis  c                    R # r   r   rD   s   &r   r'   @TestContextDecorator.test_typo_exit.<locals>.mycontext.__enter__t  r  r   c                    R # r   r   r  s   &*r   __uxit__?TestContextDecorator.test_typo_exit.<locals>.mycontext.__uxit__v  r  r   r   N)r   r   r   r   r'   r  r   r   rM   s   @r   r  r  s  r  r   r  zthe context manager.*__exit__Nr  r  s   & r   test_typo_exit#TestContextDecorator.test_typo_exitr  sP    	( 	 ##I/NOO  PO POOr  c                   a a  ! R  R\         4      p ! R RV\        4      pV! 4       oSVV 3R l4       pV! 4        S P                  SP                  R4       R# )c                   4   a  ] tR tRt o RtRtR tR tRtV t	R# )HTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontexti  FNc                    R V n         V # r  r  rD   s   &r   r'   RTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontext.__enter__  s    #r   c                    Wn         R # r   r   r  s   &*r   r   QTestContextDecorator.test_contextdecorator_as_mixin.<locals>.somecontext.__exit__      r   r  )
r   r   r   r   r  r   r'   r   r   r   rM   s   @r   somecontextr    s     GC r   r  c                       ] tR tRtRtR# )FTestContextDecorator.test_contextdecorator_as_mixin.<locals>.mycontexti  r   Nr:   r   r   r   r  r    r<   r   r  c                  t   < SP                  S P                  4       SP                  S P                  4       R # r   r  r  s   r   r  ATestContextDecorator.test_contextdecorator_as_mixin.<locals>.test  r  r   Nr  )r  r  rn   r   )r   r  r  r  r  s   f   @r   test_contextdecorator_as_mixin3TestContextDecorator.test_contextdecorator_as_mixin~  sU    		& 			%5 	 +		- 
	- 	&89r   c                   a a \         V3R  l4       p. oV! ^4      V V3R l4       pV! R4       S P                  S. RO4       . oV! R4       S P                  S. RO4       R# )c              3   \   <"   SP                  V 4       R x  SP                  R4       R # 5i)Nrc   rd   )rM  rg   s   &r   rh   ETestContextDecorator.test_contextmanager_as_decorator.<locals>.woohoo  s      LLOLLrj   c                 P   < SP                  S^.4       SP                  V 4       R# r+  )rn   re   )rp   r   rg   s   &r   r  CTestContextDecorator.test_contextmanager_as_decorator.<locals>.test  s     UQC(LLOr   	somethingsomething elseN)rb   r  rc   )rb   r  rc   r  )r   rh   r  rg   s   f  @r    test_contextmanager_as_decorator5TestContextDecorator.test_contextmanager_as_decorator  sn    		 
	
 		 
	 	[ 56  :;r   r   N)r   r   r   r   r   r6  r>  r  r  r  r  r  r  r  r  r  r   r   rM   s   @r   r  r    sO       4 !4:1":1$<		:0< <r   r  c                      a  ] tR tRt o Rt]P                  R 4       tR tR t	R t
R tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )TestBaseExitStacki  Nc                    V P                   P                  pV P                  4       pV P                  VP                  V4       R # r   )
exit_stackr  rn   r;  s   &  r   r>  $TestBaseExitStack.test_instance_docs  s3     ..ool3r   c                r    V P                  4       ;_uu_ 4         R R R 4       R #   + '       g   i     R # ; ir   )r	  rD   s   &r   test_no_resources#TestBaseExitStack.test_no_resources  s!    __ s   %6	c                  a R/ 3R/ 3R	/ 3R\        ^R7      3R\        ^R7      3R	\        ^R7      3R	\        ^^R7      3.p. oV3R lpV P                  4       ;_uu_ 4       p\        V4       F  w  rEV'       d    V'       d   VP                  ! V.VO5/ VB pMJV'       d   VP                  ! V.VO5!  pM-V'       d   VP                  ! V3/ VB pMVP                  V4      pV P	                  Wb4       K  	  VP
                   F  pV P	                  V^,          P                  V4       V P                  V^,          P                  VP                  4       V P                  V^,          P                  VP                  4       K  	  RRR4       V P                  SV4       . oV P                  4       ;_uu_ 4       pV P                  \        4      ;_uu_ 4        VP                  ^R7       RRR4       V P                  \        4      ;_uu_ 4        V P                  P                  ^R7       RRR4       V P                  \        4      ;_uu_ 4        VP                  V^R7       RRR4       RRR4       V P                  S. 4       R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lf; i  + '       g   i     Lq; i)
rb   )example)r   callbackc                 ,   < SP                  W34       R# )zTest metadata propagationNrd   )r   r
  r  s   *,r   _exit.TestBaseExitStack.test_callback.<locals>._exit  s    MM4,'r   N)arg)r  r  r   rb   )rb      )dictr	  reversedr  r&   _exit_callbacks__wrapped__assertNotEqualr   r   r  rn   r2   r=   )	r   expectedr  stackr   r
  r{   wrapperr  s	   &       @r   test_callbackTestBaseExitStack.test_callback  s,   H2JBKa!4?#DO$Da!,-
 	( __%&x0
Du<t<t<Au4t4Au55Au-Aa' 1 !00gaj44e<##GAJ$7$7H!!'!*"4"4emmD 1  	*__%""9--1% .""9--((Q(/ .""9--15 .  	$3 & .----- ss   " JJ"J?C
J=KJ!	.%KJ4	0%KK	)KJ	!J1,K4K?KKKK*	c                  a a \         oVV 3R  lpR pV 3R lp ! R R\        4      pS P                  4       ;_uu_ 4       pVP                  V4       S P	                  VP
                  R,          ^,          V4       V! V4      pVP                  V4       S P	                  VP
                  R,          ^,          P                  V4       VP                  V4       S P	                  VP
                  R,          ^,          V4       V! V4      pVP                  V4       S P	                  VP
                  R,          ^,          P                  V4       VP                  V4       S P	                  VP
                  R,          ^,          V4       VP                  V4       S P	                  VP
                  R,          ^,          V4       ^^ ,           RRR4       R#   + '       g   i     R# ; i)c                 ,   < SP                  V S4       R # r   )r&   )rH   r   exc_tb
exc_raisedr   s   &&&r   _expect_exc0TestBaseExitStack.test_push.<locals>._expect_exc  s    MM(J/r   c                      R # r  r   exc_detailss   *r   _suppress_exc2TestBaseExitStack.test_push.<locals>._suppress_exc      r   c                 n   < SP                  V 4       SP                  V4       SP                  V4       R # r   )r   )rH   r   r#  r   s   &&&r   
_expect_ok/TestBaseExitStack.test_push.<locals>._expect_ok  s-    h'c"f%r   c                   2   a  ] tR tRt o R tR tR tRtV tR# )+TestBaseExitStack.test_push.<locals>.ExitCMi  c                    Wn         R # r   	check_exc)r   r4  s   &&r   __init__4TestBaseExitStack.test_push.<locals>.ExitCM.__init__  s    !*r   c                (    V P                  R 4       R# )zShould not be called!N)r   rD   s   &r   r'   5TestBaseExitStack.test_push.<locals>.ExitCM.__enter__  s    		12r   c                &    V P                   ! V!   R # r   r3  r   r)  s   &*r   r   4TestBaseExitStack.test_push.<locals>.ExitCM.__exit__  s    ,r   r3  N	r   r   r   r   r5  r'   r   r   r   rM   s   @r   ExitCMr1    s     +3- -r   r=  N)rv   r  r	  pushr&   r  __self__)r   r%  r*  r.  r=  r  cmr$  s   f      @r   	test_pushTestBaseExitStack.test_push  sd   &
	0		&	-V 	- __%JJz"MM%//3A6
C
#BJJrNMM%//3A6??DJJ}%MM%//3A6F$BJJrNMM%//3A6??DJJ{#MM%//3A6DJJ{#MM%//3A6DaC s    FGG+	c                  a  ! V3R  lR\         4      p. oV! 4       pV P                  4       ;_uu_ 4       pVP                  V3R l4       pV P                  V4       VP	                  V4       V P                  VP                  R,          ^,          P                  V4       SP                  ^4       RRR4       V P                  S. RO4       R#   + '       g   i     L&; i)c                   :   <a  ] tR tRt o V3R ltV3R ltRtV tR# )4TestBaseExitStack.test_enter_context.<locals>.TestCMi  c                *   < SP                  ^4       R# r+  rd   )r   r  s   &r   r'   >TestBaseExitStack.test_enter_context.<locals>.TestCM.__enter__      a r   c                *   < SP                  ^4       R#    Nrd   )r   r)  r  s   &*r   r   =TestBaseExitStack.test_enter_context.<locals>.TestCM.__exit__  rI  r   r   NrL   )r"   r  s   @r   TestCMrF    s     !! !r   rN  c                  *   < S P                  ^4       R# )   Nrd   r  s   r   r  3TestBaseExitStack.test_enter_context.<locals>._exit      a r   Nr>  )rb   r  rL  rP  )
r  r	  r  r  enter_contextr&   r  r@  re   rn   )r   rN  rA  r  r  r  s   &    @r   test_enter_context$TestBaseExitStack.test_enter_context  s    	!V 	! X__%^^! !  '#MM%//3A6??DMM!  	. s   A=CC 	c           	         ! R  R4      p ! R R4      p ! R R4      pV P                  4       ;_uu_ 4       pV P                  \        R4      ;_uu_ 4        VP                  V! 4       4       RRR4       V P                  \        R4      ;_uu_ 4        VP                  V! 4       4       RRR4       V P                  \        R4      ;_uu_ 4        VP                  V! 4       4       RRR4       V P	                  VP
                  4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L[; i  + '       g   i     R# ; i)c                       ] tR tRtRtR# )FTestBaseExitStack.test_enter_context_errors.<locals>.LacksEnterAndExiti  r   Nr:   r   r   r   LacksEnterAndExitrY    r<   r   rZ  c                   &   a  ] tR tRt o R tRtV tR# )?TestBaseExitStack.test_enter_context_errors.<locals>.LacksEnteri  c                    R # r   r   )r   exc_infos   &*r   r   HTestBaseExitStack.test_enter_context_errors.<locals>.LacksEnter.__exit__  r  r   r   N)r   r   r   r   r   r   r   rM   s   @r   
LacksEnterr\          r   r`  c                   &   a  ] tR tRt o R tRtV tR# )>TestBaseExitStack.test_enter_context_errors.<locals>.LacksExiti  c                    R # r   r   rD   s   &r   r'   HTestBaseExitStack.test_enter_context_errors.<locals>.LacksExit.__enter__  r  r   r   N)r   r   r   r   r'   r   r   rM   s   @r   	LacksExitrc    ra  r   rf  r  N)r	  r  r=   rT  r   r  )r   rZ  r`  rf  r  s   &    r   test_enter_context_errors+TestBaseExitStack.test_enter_context_errors  s    	 		 		 	 __%''	3HII##$5$78 J''	3HII##JL1 J''	3HII##IK0 JU223 IIIIII sS   ED	-&ED'	*&ED:	'#ED$E'D72E:E
EE	c                *  a . oV P                  4       ;_uu_ 4       pVP                  V3R  l4       pV P                  V4       VP                  4        SP	                  ^4       RRR4       V P                  S^^.4       R#   + '       g   i     L&; i)c                  *   < S P                  ^4       R# r+  rd   rQ  s   r   r  +TestBaseExitStack.test_close.<locals>._exit-  rS  r   N)r	  r  r  rE  re   rn   )r   r  r  r  s   &  @r   
test_closeTestBaseExitStack.test_close*  st    __%^^! !  'KKMMM!  	!Q( s   ABB	c                l  a . oV P                  4       ;_uu_ 4       pVP                  V3R  l4       pV P                  V4       VP                  4       pSP	                  ^4       RRR4       SP	                  ^4       XP                  4        V P                  S. RO4       R#   + '       g   i     LG; i)c                  *   < S P                  ^4       R# rK  rd   rQ  s   r   r  -TestBaseExitStack.test_pop_all.<locals>._exit8  rS  r   N)rb   r  rL  )r	  r  r  pop_allre   rE  rn   )r   r  r  	new_stackr  s   &   @r   test_pop_allTestBaseExitStack.test_pop_all5  s    __%^^! !  'IMM!  	a+ s   AB##B3	c           	        V P                  \        4      ;_uu_ 4        V P                  4       ;_uu_ 4       pVP                  R  4       ^^ ,           RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                      R # )Fr   r   s   *r   <lambda>3TestBaseExitStack.test_exit_raise.<locals>.<lambda>E  s    r   N)r2   rv   r	  r?  r   r  s   & r   test_exit_raise!TestBaseExitStack.test_exit_raiseB  sW    011""e

-.! # 21"" 211s"   A8A%	A8%A50A88B		c                    V P                  4       ;_uu_ 4       pVP                  R  4       ^^ ,           RRR4       R#   + '       g   i     R# ; i)c                      R # r  r   r   s   *r   rw  6TestBaseExitStack.test_exit_suppress.<locals>.<lambda>J      Dr   Nr	  r?  ry  s   & r   test_exit_suppress$TestBaseExitStack.test_exit_suppressH  s4    __%JJ()aC s	   ?A	c                   R  p V P                  4       ;_uu_ 4       pVP                  V\        4       ^^ ,           RRR4       T P                  X\        4       \        P
                  ! TP                  4      pR.T P                  ,           RR.,           pT P                  T Uu. uF  qwP                  TP                  3NK  	  upT4       T P                  TP                  \        4       \        P
                  ! TP                  P                  4      pT P                  T Uu. uF  qwP                  TP                  3NK  	  upR.4       R#   + '       g   i     EL; i  \         d   pTp Rp?EL5Rp?ii ; iu upi u upi )c                     V hr   r   r   s   &r   	raise_excBTestBaseExitStack.test_exit_exception_traceback.<locals>.raise_excS      Ir   N)test_exit_exception_tracebackz with self.exit_stack() as stack:)_exit_wrapperzcallback(*args, **kwds))r  	raise exc)r  r   )r	  r  
ValueErrorr   rJ   r   r   callback_error_internal_framesrn   r   r   __context__rv   )	r   r  r  r   r   	ve_framesr  r{   
zde_framess	   &        r   r  /TestBaseExitStack.test_exit_exception_tracebackM  sC   		""ey*5! # 	c:.(():):;	RS//09')) 	 	'01y!ffaffy18	= 	coo/@A))#//*G*GH
J?Jq66166*J?BC	E' #""  	C	 2 @s?   E'  EE' ' F( FE$	E' $E' 'E?2E::E?c                    ! R  R4      p ! R R4      p ! R R4      p V! \         4      ;_uu_ 4        V! \        \        4      ;_uu_ 4        V! 4       ;_uu_ 4        V! \        4      ;_uu_ 4        ^^ ,           RRR4       RRR4       RRR4       RRR4       V P	                  R4       VP                  ^,          pV P                  V\        4       V P                  VP                  \        4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  \          d   pT P                  TP                  \        4       T P                  TP                  P                  \        4       T P                  TP                  P                  P                  4        Rp?EL!Rp?ii ; i)c                   2   a  ] tR tRt o R tR tR tRtV tR# )JTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcip  c                    Wn         R # r   r   r  s   &&r   r5  STestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__init__q  r  r   c                    V # r   r   rD   s   &r   r'   TTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__enter__s  rF   r   c                    V P                   hr   r   r:  s   &*r   r   STestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExc.__exit__u  s    hhr   r   Nr<  rM   s   @r   RaiseExcr  p  s      r   r  c                   2   a  ] tR tRt o R tR tR tRtV tR# )UTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContextix  c                    Wn         W n        R # r   )outerinner)r   r  r  s   &&&r   r5  ^TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__init__y  s    "
"
r   c                    V # r   r   rD   s   &r   r'   _TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__enter__|  rF   r   c                >     V P                   h   T P                  h; ir   r  r  r:  s   &*r   r   ^TestBaseExitStack.test_exit_exception_chaining_reference.<locals>.RaiseExcWithContext.__exit__~  s"    %**$%**$s    r  Nr<  rM   s   @r   RaiseExcWithContextr  x  s     #% %r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )MTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExci  c                    V # r   r   rD   s   &r   r'   WTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExc.__enter__  rF   r   c                &    V\        V 4      n        R # r  )r   saved_detailsr:  s   &*r   r   VTestBaseExitStack.test_exit_exception_chaining_reference.<locals>.SuppressExc.__exit__  s    +6T
(r   r   NrL   rM   s   @r   SuppressExcr    s      r   r  N0Expected IndexError, but no exception was raised)

IndexErrorKeyErrorr3   r  r   r   r  r   r  rv   )r   r  r  r  r   	inner_excs   &     r   &test_exit_exception_chaining_reference8TestBaseExitStack.test_exit_exception_chaining_referencem  s8   	 	
	% 
	%	 		J*%%(>BB$%j11E 2 ' C & IIHI--a0	i4i335FG 21 ' CB &%
  	G!!#//8<!!#//"="=~Ncoo99EEFF		Gsw   E D2D	D3
C9=DD	D2E 9D	DDD	D/*D22E	=E GA9GGc                .  a R  pRoV3R lp V P                  4       ;_uu_ 4       pVP                  V\        4       VP                  V\        4       VP                  V\        4       VP                  V4       VP                  V\        4       ^^ ,           RRR4       V P                  R4       S^,          pV P                  V\        4       V P                  VP                  \        4       R#   + '       g   i     Lb; i  \         d   pT P                  TP                  \        4       T P                  TP                  P                  \        4       T P                  TP                  P                  P                  4        Rp?LRp?ii ; i)c                     V hr   r   r   s   &r   r  ATestBaseExitStack.test_exit_exception_chaining.<locals>.raise_exc  r  r   Nc                     < V oR # r  r   )r)  r  s   *r   suppress_excDTestBaseExitStack.test_exit_exception_chaining.<locals>.suppress_exc  s    'Mr   r  )r	  r  r  r  r3   r?  r  r   r   r  r   rv   )r   r  r  r  r   r  r  s   &     @r   test_exit_exception_chaining.TestBaseExitStack.test_exit_exception_chaining  s$   	 	
	J""ey*5y(3y.9

<(y*5A # IIHI!!$	i4i335FG# #"  	G!!#//8<!!#//"="=~Ncoo99EEFF		Gs0   D A3C3D 3D	>D FA9FFc           
       a aa  ! R  R\         4      o\        V3R l4       o\        VV 3R l4       pSV3 F5  pS P                  4       ;_uu_ 4         V! 4       ;_uu_ 4        \        4       h	  R#   + '       g   i     M; i S P	                  R4       M/  S d&   pS P                  TP                  4        Rp?MRp?ii ; iRRR4       K    + '       g   i     K  ; i)c                       ] tR tRtRtR# )PTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.MyExceptioni  r   Nr:   r   r   r   MyExceptionr    r<   r   r  c               3   d   <"    R x  R #   \          d    S! 4       p  T h  R T n        i ; ii ; i5ir   )BaseExceptionr  )r   r  s    r   my_cmJTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.my_cm  s6     +  +!m+I&*CO+s    0 0- 	)-0c               3      <"   SP                  4       ;_uu_ 4       p V P                  S! 4       4       V x  R R R 4       R #   + '       g   i     R # ; i5ir   )r	  rT  )r  r  r   s    r   my_cm_with_exit_stackZTestBaseExitStack.test_exit_exception_explicit_none_context.<locals>.my_cm_with_exit_stack  s8     ""e##EG, #"""s   AA
AA		ANr  )r   rm   r   r  r   r   r  )r   r  rA  r   r  r  s   f   @@r   )test_exit_exception_explicit_none_context;TestBaseExitStack.test_exit_exception_explicit_none_context  s    	) 	 
	+ 
	+ 
	 
	
 /0BR(l*	 1 
 IIPQ # 7%%coo667	  sH   CB"A11B<BCC	B>	9C>C	CC!c                   R  pR p V P                  4       ;_uu_ 4       pVP                  R 4       VP                  V\        4       RRR4       V P                  R4        V P                  4       ;_uu_ 4       pVP                  V\        4       VP                  V4       VP                  V\        4       RRR4       V P                  R4       R#   + '       g   i     L; i  \         d!   pT P                  T\        4        Rp?LRp?ii ; i  + '       g   i     Ld; i  \         d"   pT P                  T\        4        Rp?R# Rp?ii ; i)c                     V hr   r   r   s   &r   r  HTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.raise_exc  r  r   c                      R # r  r   r(  s   *r   r  KTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.suppress_exc  r,  r   c                      R # r   r   r   r   r   rw  GTestBaseExitStack.test_exit_exception_non_suppressing.<locals>.<lambda>  s    tr   Nr  z.Expected KeyError, but no exception was raised)r	  r  r  r   r   r   r  r?  )r   r  r  r  r   s   &    r   #test_exit_exception_non_suppressing5TestBaseExitStack.test_exit_exception_non_suppressing  s    			J""e|,y*5 # IIHI	H""ey(3

<(y*5 # IIFG! #"  	3!!#z22	3 #"  	1!!#x00	1s^   C' )C	C' #D( ;>D9D( C$	C' 'D2DDD%	 D( (E3EEc                   \         R  4       p\        ^4      p\        ^4      p\        ^4      p\        ^4      p V P                  4       ;_uu_ 4       pVP                  V! V4      4       VP                  V! V4      4       VP                  V! V4      4       Vh  + '       g   i     R# ; i  \         d   pT P	                  Yu4       T P	                  TP
                  T4       T P	                  TP
                  P
                  T4       T P	                  TP
                  P
                  P
                  T4       T P                  TP
                  P
                  P
                  P
                  4        Rp?R# Rp?ii ; i)c              3   $   "    R x  V h  T h; i5ir   r   r   s   &r   gets_the_context_rightZTestBaseExitStack.test_exit_exception_with_correct_context.<locals>.gets_the_context_right  s     	c	s   
 N)rm   r   r	  rT  r&   r  r   )r   r  exc1exc2exc3exc4r  r   s   &       r   (test_exit_exception_with_correct_context:TestBaseExitStack.test_exit_exception_with_correct_context  s1   		 
	 ||||
	L""e##$:4$@A##$:4$@A##$:4$@A
	 #""
  	LMM#$MM#//40MM#//55t<MM#//55AA4H22>>JJL L	Ls1   B. ABB+	%B. +B. .F 9B<E;;F c                R   R  p\        ^4      p\        ^4      p\        ^4      p\        ^4      p\        ^4      p V P                  4       ;_uu_ 4       pVP                  WV4       VP                  WV4       Vh  + '       g   i     R# ; i  \          Ed   pT P                  Y4       T P                  TP                  T4       T P                  TP                  P                  T4       T P                  TP                  P                  P                  T4       T P                  TP                  P                  P                  P                  T4       T P                  TP                  P                  P                  P                  P                  4        Rp?R# Rp?ii ; i)c                      V h  Th; ir   r   )r  	outer_excs   &&r   raise_nestedQTestBaseExitStack.test_exit_exception_with_existing_context.<locals>.raise_nested  s     s    N)r   r	  r  r&   r  r   )	r   r  r  r  r  r  exc5r  r   s	   &        r   )test_exit_exception_with_existing_context;TestBaseExitStack.test_exit_exception_with_existing_context  s;   	 
 |||||	Q""e|48|48
 #""  	QMM#$MM#//40MM#//55t<MM#//55AA4HMM,,88DDdL++77CCOOQ Q	Qs0   B 'A;;B	B B F&D F!!F&c                    R  p V P                  4       ;_uu_ 4       pVP                  V4       ^^ ,           RRR4       R#   + '       g   i     R# ; i  \         d   pT P                  R4        Rp?R# Rp?ii ; i)c                      R # r  r   r(  s   *r   r  DTestBaseExitStack.test_body_exception_suppress.<locals>.suppress_exc5  r,  r   Nz%Expected no exception, got IndexError)r	  r?  r  r   )r   r  r  r   s   &   r   test_body_exception_suppress.TestBaseExitStack.test_body_exception_suppress4  s^    		?""e

<(! #"""  	?II=>>	?s3   A AA A	A A A=!A88A=c                    V P                  4       ;_uu_ 4       pVP                  R  4       VP                  R 4       VP                  R 4       RRR4       R#   + '       g   i     R# ; i)c                      R # r  r   r   s   *r   rw  ITestBaseExitStack.test_exit_exception_chaining_suppress.<locals>.<lambda>@  r  r   c                      ^^ ,          # r  r   r   s   *r   rw  r  A  s    AaCr   c                      / ^,          # r  r   r   s   *r   rw  r  B  s    BqEr   Nr  ry  s   & r   %test_exit_exception_chaining_suppress7TestBaseExitStack.test_exit_exception_chaining_suppress>  sG    __%JJ()JJ'(JJ)* s   7AA+	c                    V P                  4       ;_uu_ 4       p\        R 4       F  pVP                  \        4       K  	  RRR4       R#   + '       g   i     R# ; i)i'  N)r	  ranger  int)r   r  is   &  r   test_excessive_nesting(TestBaseExitStack.test_excessive_nestingD  s:    __%5\s# " s   (AA	c                    ! R  R\         4      pV! 4       p\        4       Vn        \        4       Vn        V P                  4       pV P	                  \
        R4      ;_uu_ 4        VP                  V4       RRR4       VP                  V4       V P                  VP                  R,          ^,          V4       R#   + '       g   i     LM; i)c                       ] tR tRtRtR# )7TestBaseExitStack.test_instance_bypass.<locals>.ExampleiK  r   Nr:   r   r   r   Exampler  K  s    tr   r  r  Nr>  )
r  r'   r   r	  r  r=   rT  r?  r&   r  )r   r  rA  r  s   &   r   test_instance_bypass&TestBaseExitStack.test_instance_bypassJ  s    #f#Yxh!##I/DEE# F

2e++B/2B7 FEs   #B::C
	c           	       a  ! R  R\         4      o ! R R\        4      p\        V3R l4       p\        R 4       pV P                  S4      ;_uu_ 4       pV P	                  4       ;_uu_ 4       pVP                  V! 4       4       VP                  V! 4       4       V! R4      h  + '       g   i     M; i RRR4       M  + '       g   i     M; iXP                  pT P                  TS4       T P                  TP                  T4       T P                  TP                  P                  4       T P                  TP                  P                  4       T P                  TP                  TP                  4       R# )c                       ] tR tRtRtR# )ITestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.UniqueExceptioniW  r   Nr:   r   r   r   UniqueExceptionr  W  s    $r   r   c                       ] tR tRtRtR# )LTestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.UniqueRuntimeErroriX  r   Nr:   r   r   r   UniqueRuntimeErrorr  X  s    r   r  c               3   R   <"    ^x  R#   \          d   p S! R4      T hRp ? ii ; i5i)rb   znew exceptionNr   )r   r   s    r   second@TestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.secondZ  s/     @ @%o6C?@s   ' '$	$'c               3   B   "    ^x  R#   \          d   p T hRp ? ii ; i5ir+  r  r   s    r   first?TestBaseExitStack.test_dont_reraise_RuntimeError.<locals>.firsta  s#      	s   
 zplease no infinite loop.N)r   r   rm   r2   r	  rT  	exceptionr   r  r   r   r&   )r   r  r  r	  err_ctxes_ctxr   r   s   &      @r   test_dont_reraise_RuntimeError0TestBaseExitStack.test_dont_reraise_RuntimeErrorU  s   .i.44		@ 
	@ 
	 
	 //7""f$$VX.$$UW-()CDD #"" 0/// c?3coo/AB#//556#//334cmmS__5s   B?-5B"	"B2-B??C	r   )r   r   r   r   r	  r   r6  r>  r  r  rB  rU  rg  rl  rs  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   rM   s   @r   r  r    s     J  4 !4'%R D/&4&	),
E@.H`H> RDH6L>Q8?+$	8 6  6r   r  c                   "    ] tR tRt]tRR.tRtR# )TestExitStackix  r   N)r   r  )r   zif cb(*exc_details):)r   r   r   r   	ExitStackr	  r  r   r   r   r   r  r  x  s    J!,&"r   r  c                   j   a  ] tR tRt o RtRt]P                  R 4       tR t	R t
R tR tR tR	tV tR# )
TestRedirectStreami  Nc                    V P                   P                  pV P                  R 4      pV P                  VP                  V4       R # r   )redirect_streamr  rn   r;  s   &  r   r>  %TestRedirectStream.test_instance_docs  s9     ++33""4(l3r   c                    \        \        V P                  4      pV P                  R 4       V P	                  \        \        V P                  4      V4       R # r   )getattrsysorig_streamr  r&   )r   orig_stdouts   & r   test_no_redirect_in_init+TestRedirectStream.test_no_redirect_in_init  s=    c4#3#34T"gc4#3#34kBr   c           	        \         P                  ! 4       pR p\        \        V P                  4      pV P                  V4      ;_uu_ 4        \        V\        \        V P                  4      R7       RRR4       V P                  \        \        V P                  4      V4       VP                  4       P                  4       pV P                  WB4       R#   + '       g   i     Lk; i)z<Consider an API like help(), which prints directly to stdoutfileN)ioStringIOr  r  r  r  printr&   getvaluestriprn   )r   r{   msgr  ss   &    r   test_redirect_to_string_io-TestRedirectStream.test_redirect_to_string_io  s    KKMLc4#3#34!!!$$#GC)9)9:; %gc4#3#34kBJJL  	 %$s   &CC$	c                    \         P                  ! 4       pV P                  V4      ;_uu_ 4       pV P                  W!4       R R R 4       R #   + '       g   i     R # ; ir   )r"  r#  r  r&   )r   r{   enter_results   &  r   test_enter_result_is_target.TestRedirectStream.test_enter_result_is_target  s;    KKM!!!$$MM,* %$$$s   AA	c           
     L   \         P                  ! 4       pV P                  V4      p\        \        V P
                  4      pV;_uu_ 4        \        R R\        \        V P
                  4      R7       RRR4       V;_uu_ 4        \        R\        \        V P
                  4      R7       RRR4       V P                  \        \        V P
                  4      V4       VP                  4       pV P                  VR4       R#   + '       g   i     L; i  + '       g   i     Lq; i)Hello endr!  NWorld!r   Hello World!

r"  r#  r  r  r  r  r$  r&   r%  rn   r   r{   
write_to_fr  r(  s   &    r   test_cm_is_reusable&TestRedirectStream.test_cm_is_reusable  s    KKM))!,
c4#3#34Z'sd6F6F)GH Z(d.>.>!?@ gc4#3#34kBJJL,- ZZs   'D &D D	D#	c                L   \         P                  ! 4       pV P                  V4      p\        \        V P
                  4      pT;_uu_ 4        \        R R\        \        V P
                  4      R7       V;_uu_ 4        \        R\        \        V P
                  4      R7       RRR4       RRR4       V P                  \        \        V P
                  4      V4       VP                  4       pV P                  VR4       R#   + '       g   i     Lf; i  + '       g   i     Lq; i)r0  r1  r2  r4  r   Nr5  r6  r7  s   &    r   test_cm_is_reentrant'TestRedirectStream.test_cm_is_reentrant  s    KKM))!,
c4#3#34Z'sd6F6F)GHhWS$2B2B%CD   	gc4#3#34kBJJL,-	  Zs$   1D<&D 	"D DDD#	r   )r   r   r   r   r  r  r   r6  r>  r  r)  r-  r9  r<  r   r   rM   s   @r   r  r    sF     OK  4 !4C
!+

.
. 
.r   r  c                       ] tR tRt]tRtRtR# )TestRedirectStdouti  stdoutr   N)r   r   r   r   redirect_stdoutr  r  r   r   r   r   r?  r?        %OKr   r?  c                       ] tR tRt]tRtRtR# )TestRedirectStderri  stderrr   N)r   r   r   r   redirect_stderrr  r  r   r   r   r   rD  rD    rB  r   rD  c                   z   a  ] tR tRt o ]P
                  R 4       tR tR tR t	R t
R tR tR	 tR
 tR tRtV tR# )TestSuppressi  c                r    \         P                  p\        4       pV P                  VP                  V4       R # r   )suppressr  rn   r;  s   &  r   r>  TestSuppress.test_instance_docs  s*      ''jl3r   c                    \        \        4      ;_uu_ 4       pV P                  V4       R R R 4       R #   + '       g   i     R # ; ir   )rJ  r  r   )r   r,  s   & r   test_no_result_from_enter&TestSuppress.test_no_result_from_enter  s,    j!!\l+ "!!!s	   4A	c                    \        \        4      ;_uu_ 4        V P                  \        ^^4      ^ 4       RRR4       R#   + '       g   i     R# ; i)r  N)rJ  r  rn   powrD   s   &r   test_no_exceptionTestSuppress.test_no_exception  s2    j!!SAY+ "!!!s	   ?A	c                    \        \        4      ;_uu_ 4        \        ^4       RRR4       R#   + '       g   i     R# ; i)   N)rJ  r=   r   rD   s   &r   test_exact_exception!TestSuppress.test_exact_exception  s#    i  F !   s   .?	c                    \        \        4      ;_uu_ 4        R ^2,           RRR4       R#   + '       g   i     R# ; i)r0  N)rJ  LookupErrorrD   s   &r   test_exception_hierarchy%TestSuppress.test_exception_hierarchy  s#    k""BK #"""s   
,=	c           	         V P                  \        4      ;_uu_ 4        \        \        4      ;_uu_ 4        ^^ ,           RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir+  )r2   rv   rJ  r=   rD   s   &r   test_other_exception!TestSuppress.test_other_exception  sF    011)$$! % 21$$ 211s"   A%
A	 A%A"A%%A6	c           	         V P                  \        4      ;_uu_ 4        \        4       ;_uu_ 4        ^^ ,           RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir+  )r2   rv   rJ  rD   s   &r   test_no_argsTestSuppress.test_no_args  sA    011!  21 211s!   A 
A	A AA  A1	c                   \        \        \        4      ;_uu_ 4        ^^ ,           RRR4       \        \        \        4      ;_uu_ 4        \        ^4       RRR4       R#   + '       g   i     LB; i  + '       g   i     R# ; ir+  )rJ  rv   r=   r   rD   s   &r   test_multiple_exception_args)TestSuppress.test_multiple_exception_args  sL    '33aC 4'33F 43 43333s   
A!A4!A1	4B	c           	        \        \        4      pV;_uu_ 4         R R R 4       V;_uu_ 4        \        ^4       R R R 4       T;_uu_ 4        V;_uu_ 4        \        ^4       R R R 4       Rp^^ ,           R R R 4       V P                  X4       R #   + '       g   i     L}; i  + '       g   i     Lr; i  + '       g   i     L\; i  + '       g   i     L\; i)NT)rJ  r   r   rl  )r   ignore_exceptionsouter_continueds   &  r   r<  !TestSuppress.test_cm_is_reentrant  s    $Y/ F ""A #"OaC	 
 	(  #" s:   BB$C
B7	#C
B!	$B4	7CC

C	c                   R  pR p\        \        4      ;_uu_ 4        V! 4       h  + '       g   i     M; i\        \        \        4      ;_uu_ 4        T! 4       h  + '       g   i     M; iT P                  \        4      ;_uu_ 4       p\        \        4      ;_uu_ 4        T! 4       h  + '       g   i     M; i RRR4       M  + '       g   i     M; iT P                  XP                  \	        R\        R4      \        R4      .4      4       \        \        4      ;_uu_ 4        \        R\        4       .4      h  + '       g   i     M; iT P                  \        4      ;_uu_ 4       p\        \        4      ;_uu_ 4        \        R\        R4      \        R4      .4      h  + '       g   i     M; i RRR4       M  + '       g   i     M; iT P                  TP                  \        R\        R4      .4      4       T P                  \        4      ;_uu_ 4       p\        \        4      ;_uu_ 4        \        R\        R4      \        R4      .4      h  + '       g   i     M; i RRR4       M  + '       g   i     M; iT P                  TP                  \	        R\        R4      .4      4       R# )	c                  V    \        R \        R4      \        R4      \        R4      .4      # )zEG with ValueErrors onlyve1ve2ve3)ExceptionGroupr  r   r   r   rw  4TestSuppress.test_exception_groups.<locals>.<lambda>  s%    &
5 1:e3DE
r   c            	      j    \        R \        R4      \        R4      \        R4      \        R4      .4      # ) EG with many types of exceptionsrj  ke1rk  ke2)rm  r  r  r   r   r   rw  rn     s*    .E1BHUOT
r   Nrp  rq  rr  messagegr   )	rJ  r  r  r2   rm  assertExceptionIsLiker  GeneratorExitBaseExceptionGroup)r   eg_veeg_alleg1s   &   r   test_exception_groups"TestSuppress.test_exception_groups  s   

 j!!'M "!j(++(N ,+~..#*%%h &%% /... 	""MM2%(5/2	
 m$$$Y0ABB %$ 122c(##(]35GRU4WXX $## 3222 	""MM-i-:L9MN	
 ~..#-(((]35GRU4WXX )(( /... 	""MM>)hsm_E	
sz   &6	AA-	C
%B-	-B=8C

C	.EE	4G
!F-	-F=8G

G	*J !I#	#I3.J  J	r   N)r   r   r   r   r   r6  r>  rM  rQ  rU  rY  r\  r_  rb  r<  r{  r   r   rM   s   @r   rH  rH    sO       4 !4,,

)(
 (
r   rH  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )	TestChdiri&  c                    \         P                  P                  ! \         P                  P                  \         P                  P	                  \
        4      4      .VO5!  # r   )ospathjoindirnamerealpath__file__)r   partss   &*r   make_relative_pathTestChdir.make_relative_path'  s>    ww||GGOOBGG,,X67

 	
r   c                f   \         P                  ! 4       pV P                  R 4      pV P                  W4       \	        V4      ;_uu_ 4        V P                  \         P                  ! 4       V4       RRR4       V P                  \         P                  ! 4       V4       R#   + '       g   i     L7; i)dataN)r  getcwdr  r  chdirrn   )r   old_cwdr  s   &  r   test_simpleTestChdir.test_simple-  sm    ))+((0G,6]]RYY[&1 g. ]s   &B  B0	c                d   \         P                  ! 4       pV P                  R 4      pV P                  R4      pV P                  WV34       \	        V4      \	        V4      rTT;_uu_ 4        V P                  \         P                  ! 4       V4       T;_uu_ 4        V P                  \         P                  ! 4       V4       V;_uu_ 4        V P                  \         P                  ! 4       V4       RRR4       V P                  \         P                  ! 4       V4       RRR4       V P                  \         P                  ! 4       V4       RRR4       V P                  \         P                  ! 4       V4       R#   + '       g   i     L; i  + '       g   i     Lw; i  + '       g   i     L]; i)r  archivetestdataN)r  r  r  assertNotInr  rn   )r   r  target1target2chdir1chdir2s   &     r   test_reentrantTestChdir.test_reentrant6  s   ))+))&1))*;<G"45wwVRYY['2  g6V$$RYY[':   g6	 
 RYY['2  	g.	 V  Vs<   *0F0F	
&E90-F	-F9F	F	FFF/	c                   \         P                  ! 4       pV P                  R 4      pV P                  W4        \	        V4      ;_uu_ 4        V P                  \         P                  ! 4       V4       \        R4      h  + '       g   i     M6; i  \         d&   pT P                  \        T4      R4        Rp?MRp?ii ; iT P                  \         P                  ! 4       T4       R# )r  boomN)r  r  r  r  r  rn   r   str)r   r  r  res   &   r   test_exceptionTestChdir.test_exceptionG  s    ))+((0G,	.v  f5"6**   	.SWf--	.g.s/   B 1A==B	B B C B;;C r   N)
r   r   r   r   r  r  r  r  r   r   rM   s   @r   r~  r~  &  s     
//"/ /r   r~  __main__)#r  r"  r  r  rg  rz  rJ   unittest
contextlibr  r   test.supportr   test.support.testcaser   r  TestCaser   r^   r8  rX  rb  rs  r  r  r  r  r  r  r?  rD  rH  r~  r   mainr   r   r   <module>r     s\   ? 	 	 
       " 6 2A!2!2 2AjF#X.. F#R
%h'' %D#(++ #"(++ "$-'(++ -'`  ]<8,, ]<@J6 J6Z%x'8'8 6. 6.r+X->-> +X->-> ^
'):): ^
B,/!! ,/^ zMMO r   