
    2hh}                         S SK r S SKrS SKJr  S SKJr  S r " S S\R                  5      r\S:X  a  \R                  " 5         gg)    N)
ContextVar)mockc                  0    [         R                  " S 5        g N)asyncioset_event_loop_policy     G/opt/python-3.13.8/usr/lib/python3.13/test/test_asyncio/test_threads.pytearDownModuler   
   s    !!$'r
   c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
ToThreadTests   c                 ~   #    [         R                  " [        SS/5      I S h  vN nU R                  US5        g  N7f)N(      *   )r   	to_threadsumassertEqual)selfresults     r   test_to_threadToThreadTests.test_to_thread   s3     ((r1g66$ 7s   !=;=c                    #    S nU R                  [        S5         [        R                  " U5      I S h  vN   S S S 5        g  N! , (       d  f       g = f7f)Nc                      [        S5      e)Ntest)RuntimeErrorr	   r
   r   raise_runtime=ToThreadTests.test_to_thread_exception.<locals>.raise_runtime   s    v&&r
   r   )assertRaisesRegexr   r   r   )r   r   s     r   test_to_thread_exception&ToThreadTests.test_to_thread_exception   sC     	' ##L&9##M222 :92 :9s+   AAAA	AA
AAc                    #    [         R                  " 5       n[        R                  " U5      I S h  vN   UR	                  5         g  N7fr   )r   Mockr   r   assert_called_oncer   funcs     r   test_to_thread_once!ToThreadTests.test_to_thread_once   s5     yy{%%%! 	&   /A	AA	c                   ^#    / mU4S jn/ n[        S5       H*  n[        R                  " U5      nUR                  U5        M,     [        R                  " U6 I S h  vN   U R                  [        T5      S5        g  N 7f)Nc                  (   > T R                  S5        g )N   )append)callss   r   r(   5ToThreadTests.test_to_thread_concurrent.<locals>.func"   s    LLOr
   
   )ranger   r   r/   gatherr   r   )r   r(   futs_futr0   s        @r   test_to_thread_concurrent'ToThreadTests.test_to_thread_concurrent    sn     	 rA##D)CKK  nnd###UR( 	$s   AB A>!B c                    #    [         R                  " 5       n[        R                  " USSS9I S h  vN   UR	                  SSS9  g  N7f)Nr   T)	something)r   r%   r   r   assert_called_once_withr'   s     r   test_to_thread_args_kwargs(ToThreadTests.test_to_thread_args_kwargs-   s@     yy{f===$$Vt$< 	>r+   c                    ^#    [        S5      mU4S jnTR                  S5        [        R                  " U5      I S h  vN nU R	                  US5        g  N7f)Ntest_ctxc                  $   > T R                  5       $ r   )get)r@   s   r   get_ctx9ToThreadTests.test_to_thread_contextvars.<locals>.get_ctx8   s    <<>!r
   parrot)r   setr   r   r   )r   rC   r   r@   s      @r   test_to_thread_contextvars(ToThreadTests.test_to_thread_contextvars5   sK     j)	" 	X((11* 2s   <AA Ar	   N)__name__
__module____qualname____firstlineno__r   r"   r)   r8   r=   rG   __static_attributes__r	   r
   r   r   r      s     %3")=	+r
   r   __main__)
r   unittestcontextvarsr   r   r   IsolatedAsyncioTestCaser   rI   mainr	   r
   r   <module>rS      sC      " (0+H44 0+f zMMO r
   