
     Ce                         d dl Z d dlmZ d dlZd dlZd dlmZmZ ed             Zd Z	d Z
d Zej        j         d             Zej        j         d	             ZdS )
    N)	MagicMock)run_hookrun_syncc                  >   K   t          j        d           d {V  dS )Ng{Gz?*   )asynciosleep     8lib/python3.11/site-packages/nbclient/tests/test_util.pysome_async_functionr   
   s-      
-

2r   c                      d } t          j                    }t          j        |           |                     |                       }||u sJ d S )Nc                  T   K   t                      dk    sJ t          j                    S Nr   )r   r   get_running_loopr
   r   r   _testz7test_nested_asyncio_with_existing_ioloop.<locals>._test   s,      "$$****')))r   )r   new_event_loopset_event_looprun_until_complete)r   loop
event_loops      r   (test_nested_asyncio_with_existing_ioloopr      sb    * * * !##D4   ((11Jr   c                  V    t          j        d            t                      dk    sJ d S r   )r   r   r   r
   r   r   "test_nested_asyncio_with_no_ioloopr      s0    4     B&&&&&&r   c                      t          j        t          j                               t          j        j                                        fdfdfd}                     |            d S )Nc                     K   t          j        t          j        d                    }                     | d            |  d {V  dS )Ng?c                 *    |                                  S N)result)fs    r   <lambda>zOtest_nested_asyncio_with_tornado.<locals>.some_async_function.<locals>.<lambda>)   s    AHHJJ r   r   )r   ensure_futurer	   
add_future)futureioloops    r   r   z=test_nested_asyncio_with_tornado.<locals>.some_async_function&   sQ      !(!6w}S7I7I!J!J&"6"6777rr   c                  2     t                                 S r   )r   )r   s   r   some_sync_functionz<test_nested_asyncio_with_tornado.<locals>.some_sync_function-   s    ,x+,,...r   c                  X   K                  d {V dk    sJ              dk    sJ d S r   r
   )r   r'   s   r   runz-test_nested_asyncio_with_tornado.<locals>.run0   sS      ((********b0000!!##r))))))r   )r   r   r   tornador%   IOLoopcurrentr   )r)   r%   r   r'   s    @@@r    test_nested_asyncio_with_tornador-       s     7133444^"**,,F    / / / / /* * * * * *
 OOCr   c                  j   K   t                      } t          |            d {V  | j        dk    sJ d S )N   )r   r   
call_count)r'   s    r   test_run_hook_syncr1   8   sK      "
%
&
&&&&&&&&(A------r   c                     K   t          t                                } t          |            d {V  | j        dk    sJ d S )N)return_valuer/   )r   r   r   r0   )hooks    r   test_run_hook_asyncr5   ?   sT      "5"7"7888D
4..?ar   )r   unittest.mockr   pytestr*   nbclient.utilr   r   r   r   r   r-   markr1   r5   r
   r   r   <module>r:      s     # # # # # #   , , , , , , , , 
  

  ' ' '
  0 . . .          r   