a
    ze-                     @   sT   d dl Z d dlZd dlZdd ZeejdG dd dejZedkrPe	  dS )    Nc                   C   s   t d  d S )N)asyncioZset_event_loop_policy r   r   4/usr/lib/python3.9/test/test_asyncio/test_context.pytearDownModule   s    r   z,decimal is built with a thread-local contextc                   @   s   e Zd Zdd ZdS )DecimalContextTestc                    sx   dd   fdd}t | \}}| t|d d | t|d d | t|d d	 | t|d d
 d S )Nc                    sv   t  Z}||_t |t | }t| I d H  t |t |d  }||fW  d    S 1 sh0    Y  d S )N   )decimalZlocalcontextZprecZDecimalr   sleep)tZ	precisionxyctxabr   r   r   	fractions   s    
zGDecimalContextTest.test_asyncio_task_decimal_context.<locals>.fractionsc                     s2   t  dddd ddddI d H \} }| |fS )Ng?      g?   )r   Zgather)r1r2r   r   r   main   s    zBDecimalContextTest.test_asyncio_task_decimal_context.<locals>.mainr   z0.333r   z0.111z0.333333z0.111111)r   runZassertEqualstr)selfr   r   r   r   r   r   !test_asyncio_task_decimal_context   s    z4DecimalContextTest.test_asyncio_task_decimal_contextN)__name__
__module____qualname__r   r   r   r   r   r   
   s   r   __main__)
r   r   Zunittestr   Z
skipUnlessZHAVE_CONTEXTVARZTestCaser   r   r   r   r   r   r   <module>   s   