
    =edA                     N   d dl Z d dlZd dlZd dlmZ  ej        d            G d de          Zd Z G d d	          Z	 G d
 d          Z
 G d d          Z G d d          Z ej        dd          Z G d dej                  Zedk    r ej                     dS dS )    N)supportT)modulec                       e Zd ZdS )MyExceptionN__name__
__module____qualname__     4/usr/lib/python3.11/unittest/test/test_async_case.pyr   r   	           Dr   r   c                  .    t          j        d            d S N)asyncioset_event_loop_policyr   r   r   tearDownModuler      s    !$'''''r   c                   "    e Zd ZddZd Zd ZdS )TestCMNc                 "    || _         || _        d S r   )orderingenter_result)selfr   r   s      r   __init__zTestCM.__init__   s     (r   c                 H   K   | j                             d           | j        S )Nenter)r   appendr   r   s    r   
__aenter__zTestCM.__aenter__   s%      W%%%  r   c                 >   K   | j                             d           d S )Nexit)r   r   r   exc_infos     r   	__aexit__zTestCM.__aexit__   s"      V$$$$$r   r   )r   r	   r
   r   r   r$   r   r   r   r   r      sF        ) ) ) )! ! !% % % % %r   r   c                       e Zd ZdS )LacksEnterAndExitNr   r   r   r   r&   r&      r   r   r&   c                       e Zd Zd ZdS )
LacksEnterc                 
   K   d S r   r   r"   s     r   r$   zLacksEnter.__aexit__!         r   N)r   r	   r
   r$   r   r   r   r(   r(       #            r   r(   c                       e Zd Zd ZdS )	LacksExitc                 
   K   d S r   r   r   s    r   r   zLacksExit.__aenter__$   r*   r   N)r   r	   r
   r   r   r   r   r-   r-   #   r+   r   r-   VARr   )defaultc                   f    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd ZdS )TestAsyncCaseNc                 D    |                      t          j                   d S r   )
addCleanupr   
gc_collectr   s    r   setUpzTestAsyncCase.setUp.   s     	*+++++r   c                    g d G fddt           j                  }g d |d          }|                                }|                     |j        g            |                     |j        g            |                                |                     t                               g d |d          }|                                 |                                |                     t                               |                                 |                                |                     t                               d S )N)r6   
asyncSetUptestasyncTearDowntearDowncleanup6cleanup5cleanup4cleanup3cleanup2cleanup1c                       e Zd ZfdZfdZfdZfdZfdZ fdZfdZ	fdZ
fd	Zfd
ZfdZdS )+TestAsyncCase.test_full_cycle.<locals>.Testc                 .   |                      g                                d           t                              t                                          dz              |                     | j                   |                     | j                   d S )Nr6   )r6   )	assertEqualr   r/   setgetr4   on_cleanup1addAsyncCleanupon_cleanup2r   eventss    r   r6   z1TestAsyncCase.test_full_cycle.<locals>.Test.setUp@   s|      ,,,g&&&		J./// 0111$$T%566666r   c                 B  K   |                      d d                                        d           t                              t                                          dz              |                     | j                   |                     | j                   d S )N   r8   )r8   )	rE   r   r/   rF   rG   r4   on_cleanup3rI   on_cleanup4r   rL   expecteds    r   r8   z6TestAsyncCase.test_full_cycle.<locals>.Test.asyncSetUpG   s        "1"666l+++		O3444 0111$$T%566666r   c                 B  K   |                      d d                                        d           t                              t                                          dz              |                     | j                   |                     | j                   d S )N   r9   )r9   )	rE   r   r/   rF   rG   r4   on_cleanup5rI   on_cleanup6rQ   s    r   	test_funcz5TestAsyncCase.test_full_cycle.<locals>.Test.test_funcN   s        "1"666f%%%		I-... 0111$$T%566666r   c                    K   |                      d d                    t                              t                                          dz                                  d           d S )N   )r:   r:   )rE   r/   rF   rG   r   rQ   s    r   r:   z9TestAsyncCase.test_full_cycle.<locals>.Test.asyncTearDownU   s]        "1"666		$66777o.....r   c                     |                      d d                                        d           t                              t                                          dz              d S )N   r;   )r;   rE   r   r/   rF   rG   rQ   s    r   r;   z4TestAsyncCase.test_full_cycle.<locals>.Test.tearDownZ   X      "1"666j)))		M122222r   c                    |                      d d                                        d           t                              t                                          dz              t                                          d S )N
   rA   )rA   r\   )r   cvarrL   rR   s    r   rH   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup1_   sc      #2#777j)))		M1222wwyyr   c                    K   |                      d d                                        d           t                              t                                          dz              d S )N	   r@   )r@   r\   rQ   s    r   rJ   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup2f   \        "1"666j)))		M122222r   c                     |                      d d                                        d           t                              t                                          dz              d S )N   r?   )r?   r\   rQ   s    r   rO   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup3k   r]   r   c                    K   |                      d d                                        d           t                              t                                          dz              d S )N   r>   )r>   r\   rQ   s    r   rP   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup4p   rc   r   c                     |                      d d                                        d           t                              t                                          dz              d S )N   r=   )r=   r\   rQ   s    r   rU   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup5u   r]   r   c                    K   |                      d d                                        d           t                              t                                          dz              d S )N   r<   )r<   r\   rQ   s    r   rV   z7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup6z   rc   r   N)r   r	   r
   r6   r8   rW   r:   r;   rH   rJ   rO   rP   rU   rV   )r`   rL   rR   s   r   TestrC   ?   s_       7 7 7 7 77 7 7 7 7 77 7 7 7 7 7/ / / / / /
3 3 3 3 3 3
! ! ! ! ! ! !3 3 3 3 3 3
3 3 3 3 3 3
3 3 3 3 3 3
3 3 3 3 3 3
3 3 3 3 3 3 3 3r   rl   r   rW   )	unittestIsolatedAsyncioTestCaserunrE   errorsfailurestupledebug
doCleanups)r   rl   r9   resultr`   rL   rR   s       @@@r   test_full_cyclezTestAsyncCase.test_full_cycle3   s   
  
  
 >	3 >	3 >	3 >	3 >	3 >	3 >	3 >	3 >	383 >	3 >	3 >	3@ tK  +++"---***uX///tK  

***uX///***uX/////r   c                     G fddt           j                  }g  |d          }|                                }|                     ddg           |                     |j        d         d         |           |                     d|j        d         d                    g  |d          }|                     |j                   	 |	                                 | 
                    d	           n# t          $ r Y nw xY w|                     dg           |                                 |                     ddg           d S )
Nc                   8    e Zd Z fdZ fdZ fdZ fdZdS )3TestAsyncCase.test_exception_in_setup.<locals>.Testc                    K                        d           |                     | j                   t                      Nr8   r   rI   
on_cleanupr   rK   s    r   r8   z>TestAsyncCase.test_exception_in_setup.<locals>.Test.asyncSetUp   s9      l+++$$T_555!mm#r   c                 6   K                        d           d S Nr9   r   rK   s    r   rW   z=TestAsyncCase.test_exception_in_setup.<locals>.Test.test_func   s      f%%%%%r   c                 6   K                        d           d S Nr:   r   rK   s    r   r:   zATestAsyncCase.test_exception_in_setup.<locals>.Test.asyncTearDown         o.....r   c                 6   K                        d           d S Ncleanupr   rK   s    r   r}   z>TestAsyncCase.test_exception_in_setup.<locals>.Test.on_cleanup         i(((((r   Nr   r	   r
   r8   rW   r:   r}   rL   s   r   rl   ry      sy        $ $ $ $ $
& & & & &/ / / / /) ) ) ) ) ) )r   rl   rW   r8   r   r   r   rN    Expected a MyException exceptionrm   rn   ro   rE   assertIsrp   assertInr4   _tearDownAsyncioRunnerrs   failr   rt   r   rl   r9   ru   rL   s       @r   test_exception_in_setupz%TestAsyncCase.test_exception_in_setup   sx   	) 	) 	) 	) 	) 	) 	)83 	) 	) 	)  tK  ,	!:;;;fmA&q)4000mV]1%5a%8999tK  3444	:JJLLL II89999  	 	 	D	 	,000,	!:;;;;;   C5 5
DDc                     G fddt           j                  }g  |d          }|                                }|                     g d           |                     |j        d         d         |           |                     d|j        d         d                    g  |d          }|                     |j                   	 |	                                 | 
                    d           n# t          $ r Y nw xY w|                     d	d
g           |                                 |                     g d           d S )Nc                   8    e Zd Z fdZ fdZ fdZ fdZdS )2TestAsyncCase.test_exception_in_test.<locals>.Testc                 6   K                        d           d S r{   r   rK   s    r   r8   z=TestAsyncCase.test_exception_in_test.<locals>.Test.asyncSetUp         l+++++r   c                    K                        d           |                     | j                   t                      r   r|   rK   s    r   rW   z<TestAsyncCase.test_exception_in_test.<locals>.Test.test_func   s9      f%%%$$T_555!mm#r   c                 6   K                        d           d S r   r   rK   s    r   r:   z@TestAsyncCase.test_exception_in_test.<locals>.Test.asyncTearDown   r   r   c                 6   K                        d           d S r   r   rK   s    r   r}   z=TestAsyncCase.test_exception_in_test.<locals>.Test.on_cleanup   r   r   Nr   r   s   r   rl   r      sy        , , , , ,$ $ $ $ $
/ / / / /) ) ) ) ) ) )r   rl   rW   r8   r9   r:   r   r   r   rN   r   r8   r9   r8   r9   r   r   r   s       @r   test_exception_in_testz$TestAsyncCase.test_exception_in_test   s   	) 	) 	) 	) 	) 	) 	)83 	) 	) 	) tK  !S!S!STTTfmA&q)4000mV]1%5a%8999tK  3444	:JJLLL II89999  	 	 	D	 	,!7888!B!B!BCCCCCr   c                     G fddt           j                  }g  |d          }|                                }|                     g d           |                     |j        d         d         |           |                     d|j        d         d                    g  |d          }|                     |j                   	 |	                                 | 
                    d           n# t          $ r Y nw xY w|                     g d	           |                                 |                     g d           d S )
Nc                   8    e Zd Z fdZ fdZ fdZ fdZdS )7TestAsyncCase.test_exception_in_tear_down.<locals>.Testc                 6   K                        d           d S r{   r   rK   s    r   r8   zBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncSetUp   r   r   c                 j   K                        d           |                     | j                   d S r   )r   rI   r}   rK   s    r   rW   zATestAsyncCase.test_exception_in_tear_down.<locals>.Test.test_func   s5      f%%%$$T_55555r   c                 N   K                        d           t                      r   r   r   rK   s    r   r:   zETestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncTearDown   s#      o...!mm#r   c                 6   K                        d           d S r   r   rK   s    r   r}   zBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.on_cleanup   r   r   Nr   r   s   r   rl   r      sy        , , , , ,6 6 6 6 6$ $ $ $ $) ) ) ) ) ) )r   rl   rW   r   r   r   rN   r   )r8   r9   r:   r   r   s       @r   test_exception_in_tear_downz)TestAsyncCase.test_exception_in_tear_down   s   	) 	) 	) 	) 	) 	) 	)83 	) 	) 	) tK  !S!S!STTTfmA&q)4000mV]1%5a%8999tK  3444	:JJLLL II89999  	 	 	D	 	!H!H!HIII!S!S!STTTTTr   c                     G fddt           j                  }g  |d          }|                                }|                     g d           |                     |j        d         d         |           |                     d|j        d         d                    |                     d|j        d         d                    g  |d          }|                     |j                   	 |	                                 | 
                    d	           n# t          $ r Y nw xY w|                     g d
           |                                 |                     g d           d S )Nc                   B    e Zd Z fdZ fdZ fdZ fdZ fdZdS );TestAsyncCase.test_exception_in_tear_clean_up.<locals>.Testc                 6   K                        d           d S r{   r   rK   s    r   r8   zFTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncSetUp  r   r   c                    K                        d           |                     | j                   |                     | j                   d S r   )r   rI   rH   rJ   rK   s    r   rW   zETestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.test_func  sM      f%%%$$T%5666$$T%566666r   c                 6   K                        d           d S r   r   rK   s    r   r:   zITestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncTearDown	  r   r   c                 P   K                        d           t          d          )NrA   z
some errorr   rK   s    r   rH   zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup1  s'      j)))!,///r   c                 P   K                        d           t          d          )Nr@   zother errorr   rK   s    r   rJ   zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup2  s'      j)))!-000r   N)r   r	   r
   r8   rW   r:   rH   rJ   r   s   r   rl   r      s        , , , , ,7 7 7 7 7
/ / / / /0 0 0 0 01 1 1 1 1 1 1r   rl   rW   )r8   r9   r:   r@   rA   r   zMyException: other errorrN   zMyException: some errorr   )r8   r9   r:   r@   r   r   s       @r   test_exception_in_tear_clean_upz-TestAsyncCase.test_exception_in_tear_clean_up   s   	1 	1 	1 	1 	1 	1 	183 	1 	1 	1( tK  !`!`!`aaafmA&q)40000&-2B12EFFF/q1A!1DEEEtK  3444	:JJLLL II89999  	 	 	D	 	!T!T!TUUU!`!`!`aaaaas   2D 
D)(D)c                     G d d           G fddt           j                  }|                     t                    5 } |d                                           d d d            n# 1 swxY w Y   |                     dt          |j                             |                     dt          |j                             |                     |j	        t                     |                     t                    5 } |d                                           d d d            n# 1 swxY w Y   |                     dt          |j                             |                     dt          |j                             |                     |j	        t                     |                     t                    5 } |d                                           d d d            n# 1 swxY w Y   |                     dt          |j                             |                     dt          |j                             |                     |j	        t                     d S )	Nc                       e Zd Zd ZdS )GTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Nothingc                 
    |d u S r   r   )r   os     r   __eq__zNTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Nothing.__eq__,  s    Dy r   N)r   r	   r
   r   r   r   r   Nothingr   +  s#        ! ! ! ! !r   r   c                   &    e Zd Zd Zd Z fdZdS )DTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Testc                 
   K   dS NrN   r   r   s    r   test1zJTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Test.test1/  s      qr   c                   K   dW V  d S r   r   r   s    r   test2zJTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Test.test21  s      r   c                    K                S r   r   )r   r   s    r   test3zJTestAsyncCase.test_deprecation_of_return_val_from_test.<locals>.Test.test33  s      wyy r   N)r   r	   r
   r   r   r   )r   s   r   rl   r   .  sL            ! ! ! ! ! ! !r   rl   r   z3It is deprecated to return a value that is not Noner   r   )rm   rn   assertWarnsDeprecationWarningro   r   strwarningrE   filename__file__)r   rl   wr   s      @r   (test_deprecation_of_return_val_from_testz6TestAsyncCase.test_deprecation_of_return_val_from_test)  s   	! 	! 	! 	! 	! 	! 	! 	!	! 	! 	! 	! 	! 	! 	!83 	! 	! 	! 011 	 QDMM	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 KSQRQZ^^\\\gs19~~...X...011 	 QDMM	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 KSQRQZ^^\\\gs19~~...X...011 	 QDMM	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 KSQRQZ^^\\\gs19~~...X.....s6   A--A14A1D,,D03D0G++G/2G/c                     g  G fddt           j                  } |d          }|                                 |                     g d           d S )Nc                   *    e Zd Zd Z fdZ fdZdS ):TestAsyncCase.test_cleanups_interleave_order.<locals>.Testc                    K   |                      | j        d           |                      | j        d           |                      | j        d           |                      | j        d           d S )NrN   rT   rY   r[   )rI   on_sync_cleanupon_async_cleanupr   s    r   rW   zDTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.test_funcL  sp      $$T%91===$$T%:A>>>$$T%91===$$T%:A>>>>>r   c                 <   K                        d|            d S )Nzsync_cleanup r   r   valrL   s     r   r   zJTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.on_sync_cleanupR  s(      3c3344444r   c                 <   K                        d|            d S )Nzasync_cleanup r   r   s     r   r   zKTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.on_async_cleanupU  s(      4s4455555r   N)r   r	   r
   rW   r   r   r   s   r   rl   r   K  sV        ? ? ?5 5 5 5 56 6 6 6 6 6 6r   rl   rW   )zasync_cleanup 4zsync_cleanup 3zasync_cleanup 2zsync_cleanup 1)rm   rn   ro   rE   )r   rl   r9   rL   s      @r   test_cleanups_interleave_orderz,TestAsyncCase.test_cleanups_interleave_orderH  s    	6 	6 	6 	6 	6 	6 	683 	6 	6 	6 tK  


 "4 "4 "4 	5 	5 	5 	5 	5r   c                    g  G fddt           j                  } |d          }|                                }|                     |                                            |d          }|                                 |                     ddg            |d          }|                                }|                     |                                           d S )Nc                   *    e Zd Z fdZ fdZd ZdS )ATestAsyncCase.test_base_exception_from_async_method.<locals>.Testc                 N   K                        d           t                      )N	test_base)r   BaseExceptionrK   s    r   r   zKTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_baseb  s#      k***#oo%r   c                 6   K                        d           d S )Ntest_no_errr   rK   s    r   r   zMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_no_errg  s      m,,,,,r   c                 ,   K   t          j                    r   )r   CancelledErrorr   s    r   test_cancelzMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_cancelj  s      ,...r   N)r   r	   r
   r   r   r   r   s   r   rl   r   a  sV        ( ( ( ( (
- - - - -/ / / / /r   rl   r   r   r   )rm   rn   ro   assertFalsewasSuccessfulrE   r   rl   r9   outputrL   s       @r   %test_base_exception_from_async_methodz3TestAsyncCase.test_base_exception_from_async_method_  s    
	/ 
	/ 
	/ 
	/ 
	/ 
	/ 
	/83 
	/ 
	/ 
	/ tK  --//000tM""


+}!=>>>tM""--//00000r   c                     d G fddt           j                  } |d          }|                                }|                                d S )NFc                       e Zd Z fdZdS );TestAsyncCase.test_cancellation_hanging_tasks.<locals>.Testc                 N   K   fd}t          j         |                       d S )Nc                  n   K   	 t          j        d           d {V  d S # t           j        $ r d  w xY w)NrN   T)r   sleepr   	cancelleds   r   coroz[TestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_task.<locals>.coro}  sZ      %mA..........."1   $(	s   ! 4)r   create_task)r   r   r   s     r   test_leaking_taskzMTestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_task|  s?           #DDFF+++++r   N)r   r	   r
   r   r   s   r   rl   r   {  s.        
, 
, 
, 
, 
, 
, 
,r   rl   r   )rm   rn   ro   
assertTrue)r   rl   r9   r   r   s       @r   test_cancellation_hanging_tasksz-TestAsyncCase.test_cancellation_hanging_tasksy  sv    		, 	, 	, 	, 	, 	, 	,83 	, 	, 	, t'((	"""""r   c                     g  G  fddt           j                  } |d          }|                                }                     |                                |                                g d           d S )Nc                       e Zd Z fdZdS )2TestAsyncCase.test_enterAsyncContext.<locals>.Testc                    K   |                      j        d           t          d          }                    |                     |           d {V d           |                      j        d                               d           d S )NrA   *   r@   r9   )rI   r   r   rE   enterAsyncContext)slfcmrL   r   s     r   rW   z<TestAsyncCase.test_enterAsyncContext.<locals>.Test.test_func  s      ##FM:>>>FB''  s'<'<R'@'@!@!@!@!@!@!@"EEE##FM:>>>f%%%%%r   Nr   r	   r
   rW   )rL   r   s   r   rl   r     s3        & & & & & & & &r   rl   rW   )r   r9   r@   r!   rA   )rm   rn   ro   r   r   rE   r   s   `   @r   test_enterAsyncContextz$TestAsyncCase.test_enterAsyncContext  s    	& 	& 	& 	& 	& 	& 	& 	&83 	& 	& 	& tK  ,,..777!R!R!RSSSSSr   c                       G  fddt           j                  } |d          }|                                }                     |                                           d S )Nc                       e Zd Z fdZdS )=TestAsyncCase.test_enterAsyncContext_arg_errors.<locals>.Testc                 *  K                        t          d          5  |                     t                                 d {V  d d d            n# 1 swxY w Y                        t          d          5  |                     t	                                 d {V  d d d            n# 1 swxY w Y                        t          d          5  |                     t                                 d {V  d d d            d S # 1 swxY w Y   d S )Nzasynchronous context manager)assertRaisesRegex	TypeErrorr   r&   r(   r-   )r   r   s    r   rW   zGTestAsyncCase.test_enterAsyncContext_arg_errors.<locals>.Test.test_func  s     ++I7UVV E E//0A0C0CDDDDDDDDDE E E E E E E E E E E E E E E++I7UVV > >//
=========> > > > > > > > > > > > > > >++I7UVV = =//	<<<<<<<<<= = = = = = = = = = = = = = = = = =s5   (AAA9(B--B14B1(DDDNr   r   s   r   rl   r     s.        = = = = = = =r   rl   rW   )rm   rn   ro   r   r   )r   rl   r9   r   s   `   r   !test_enterAsyncContext_arg_errorsz/TestAsyncCase.test_enterAsyncContext_arg_errors  s|    	= 	= 	= 	= 	= 	= 	=83 	= 	= 	= tK  ,,../////r   c                 H    G fddt           j                  }g  |d          }|                                }|                     g d           |                     d|j        d         d                    g  |d          }|                     |j                   	 |                                 | 	                    d           n# t          $ r Y nw xY w|                     d	d
g           |                                 |                     g d           d S )Nc                   8    e Zd Z fdZ fdZ fdZ fdZdS )8TestAsyncCase.test_debug_cleanup_same_loop.<locals>.Testc                    K   d }t          j         |                      }|                     | j        |                               d           d S )Nc                  >   K   t          j        d           d {V  d S )Nr   )r   r   r   r   r   r   zQTestAsyncCase.test_debug_cleanup_same_loop.<locals>.Test.asyncSetUp.<locals>.coro  s.      !-***********r   r8   )r   ensure_futurerI   r   r   )r   r   futrL   s      r   r8   zCTestAsyncCase.test_debug_cleanup_same_loop.<locals>.Test.asyncSetUp  s\      + + ++DDFF33$$T\3777l+++++r   c                 N   K                        d           t                      r   r   rK   s    r   rW   zBTestAsyncCase.test_debug_cleanup_same_loop.<locals>.Test.test_func  s#      f%%%!mm#r   c                 6   K                        d           d S r   r   rK   s    r   r:   zFTestAsyncCase.test_debug_cleanup_same_loop.<locals>.Test.asyncTearDown  r   r   c                    K   	 t          j        |g           d {V                      d           d S #  dd l}|                                  xY w)Nr   r   )r   waitr   	traceback	print_exc)r   r  r  rL   s      r   r   z@TestAsyncCase.test_debug_cleanup_same_loop.<locals>.Test.cleanup  sr      !,u---------MM),,,,,$$$$'')))s	   07 AN)r   r	   r
   r8   rW   r:   r   r   s   r   rl   r    sy        , , , , ,$ $ $ $ $/ / / / /      r   rl   rW   r   r   r   rN   r   r8   r9   r   )rm   rn   ro   rE   r   rp   r4   r   rs   r   r   rt   r   s       @r   test_debug_cleanup_same_loopz*TestAsyncCase.test_debug_cleanup_same_loop  s_   	 	 	 	 	 	 	83 	 	 	2 tK  !S!S!STTTmV]1%5a%8999tK  3444	:JJLLL II89999  	 	 	D	 	,!7888!B!B!BCCCCCs   $C 
CCc                     t          j        d             G d dt          j                  } |d          }|                                }|                     |                                           d S )Nc                       e Zd Zd Zd ZdS ):TestAsyncCase.test_setup_get_event_loop.<locals>.TestCase1c                 P    t          j                                                     d S r   )r   get_event_loop_policyget_event_loopr   s    r   r6   z@TestAsyncCase.test_setup_get_event_loop.<locals>.TestCase1.setUp  s#    -//>>@@@@@r   c                 
   K   d S r   r   r   s    r   
test_demo1zETestAsyncCase.test_setup_get_event_loop.<locals>.TestCase1.test_demo1  s      r   N)r   r	   r
   r6   r  r   r   r   	TestCase1r    s5        A A A    r   r  r  )r   set_event_looprm   rn   ro   r   r   )r   r  r9   ru   s       r   test_setup_get_event_loopz'TestAsyncCase.test_setup_get_event_loop  s     	t$$$	 	 	 	 	8 	 	 	 y&&,,../////r   )r   r	   r
   maxDiffr6   rv   r   r   r   r   r   r   r   r   r   r   r  r  r   r   r   r2   r2   +   s       G, , ,
]0 ]0 ]0~#< #< #<J"D "D "DH"U "U "UH(b (b (bT/ / />5 5 5.1 1 14# # #&T T T 0 0 0+D +D +DZ0 0 0 0 0r   r2   __main__)r   contextvarsrm   r9   r   requires_working_socket	Exceptionr   r   r   r&   r(   r-   
ContextVarr/   TestCaser2   r   mainr   r   r   <module>r"     s                t , , , ,	 	 	 	 	) 	 	 	( ( (
% 
% 
% 
% 
% 
% 
% 
%	 	 	 	 	 	 	 	              
 kUB///z0 z0 z0 z0 z0H% z0 z0 z0x zHMOOOOO r   