
    dY                     N    d dl Z d dlZd dlZd dlZddlmZ  G d de          ZdS )    N   )TestCasec                        e Zd Zd f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 fd	Z fdZd Z xZS )IsolatedAsyncioTestCaserunTestc                     t                                          |           d | _        t          j                    | _        d S N)super__init___asyncioRunnercontextvarscopy_context_asyncioTestContext)self
methodName	__class__s     %  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/unittest/async_case.pyr   z IsolatedAsyncioTestCase.__init__#   s:    $$$"#.#;#=#=       c                 
   K   d S r	    r   s    r   
asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp(         r   c                 
   K   d S r	   r   r   s    r   asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown+   r   r   c                (     | j         |g|R i | d S r	   )
addCleanupr   funcargskwargss       r   addAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup.   s)     	$1&11111r   c                    K   t          |          }	 |j        }|j        }n/# t          $ r" t	          d|j         d|j         d          dw xY w ||           d{V }|                     ||ddd           |S )zEnters the supplied asynchronous context manager.

        If successful, also adds its __aexit__ method as a cleanup
        function and returns the result of the __aenter__ method.
        '.zC' object does not support the asynchronous context manager protocolN)type
__aenter__	__aexit__AttributeError	TypeError
__module____qualname__r"   )r   cmclsenterexitresults         r   enterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext=   s       2hh	'NE=DD 	' 	' 	' U U U1A U U U  "&'	' uRyyT2tT4888s	   " ,Ac                     | j                                          | j                            | j                   |                     | j                   d S r	   )r   get_loopr   runsetUp
_callAsyncr   r   s    r   
_callSetUpz"IsolatedAsyncioTestCase._callSetUpQ   sL     	$$&&& $$TZ000(((((r   c                 t    |                      |          "t          j        d| dt          d           d S d S )NzFIt is deprecated to return a value that is not None from a test case ()   )
stacklevel)_callMaybeAsyncwarningswarnDeprecationWarning)r   methods     r   _callTestMethodz'IsolatedAsyncioTestCase._callTestMethodY   sd    ''3M 2(.2 2 23ERSU U U U U U 43r   c                 x    |                      | j                   | j                            | j                   d S r	   )r7   r   r   r5   tearDownr   s    r   _callTearDownz%IsolatedAsyncioTestCase._callTearDown^   s6    *+++ $$T]33333r   c                 (     | j         |g|R i | d S r	   )r=   )r   functionr    r!   s       r   _callCleanupz$IsolatedAsyncioTestCase._callCleanupb   s+    X777777777r   c                    | j         
J d            t          j        |          sJ |d            | j                              ||i || j                  S )N!asyncio runner is not initializedz is not an async functioncontextr   inspectiscoroutinefunctionr5   r   r   s       r   r7   z"IsolatedAsyncioTestCase._callAsynce   sz    "..0S...*400VVT2V2V2VVVV"&&D$!&!!, ' 
 
 	
r   c                    | j         
J d            t          j        |          r'| j                              ||i || j                  S  | j        j        |g|R i |S )NrJ   rK   rM   r   s       r   r=   z'IsolatedAsyncioTestCase._callMaybeAsyncm   s    "..0S...&t,, 	G&**d%f%%0 +   
 04+/FtFFFvFFFr   c                 `    | j         
J d            t          j        d          }|| _         d S )Nz%asyncio runner is already initializedT)debug)r   asyncioRunnerr   runners     r   _setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerw   s:    "**,S***d+++$r   c                 <    | j         }|                                 d S r	   )r   closerU   s     r   _tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner|   s    $r   Nc                     |                                   	 t                                          |          |                                  S # |                                  w xY wr	   )rW   r
   r5   rZ   )r   r1   r   s     r   r5   zIsolatedAsyncioTestCase.run   sZ      """	*77;;v&&''))))D''))))s    A A"c                     |                                   t                                                       |                                  d S r	   )rW   r
   rR   rZ   )r   r   s    r   rR   zIsolatedAsyncioTestCase.debug   s>      """##%%%%%r   c                 @    | j         |                                  d S d S r	   )r   rZ   r   s    r   __del__zIsolatedAsyncioTestCase.__del__   s+    *''))))) +*r   )r   r	   )__name__r+   r,   r   r   r   r"   r2   r8   rB   rE   rH   r7   r=   rW   rZ   r5   rR   r^   __classcell__)r   s   @r   r   r   	   s=       4> > > > > >
    2 2 2  () ) )U U U
4 4 48 8 8
 
 
G G G% % %
  * * * * * *& & & & &
* * * * * * *r   r   )rS   r   rN   r>   caser   r   r   r   r   <module>rb      s|                E* E* E* E* E*h E* E* E* E* E*r   