Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_context.cpython-311.pyc |
�
�Ke�z � � � d dl Zd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
d dlmZ n
# e
$ r dZY nw xY wd� Z G d� dej � � Z G d� d� � Z G d � d
e� � Z G d� d� � Z G d
� de� � Z G d� de� � Z ej edu d� � G d� dej � � � � Zedk r ej � � dS dS )� N)�threading_helper��hamtc �F � � t j � � � � fd�� � }|S )z*Needed to make reftracking test mode work.c �L �� t j � � } |j �g| �R i |��S �N��contextvars�Context�run)�args�kwargs�ctx�funcs ��;/usr/local/apps/python3/lib/python3.11/test/test_context.py�wrapperz!isolated_context.<locals>.wrapper s3 �� ��!�#�#���s�w�t�-�d�-�-�-�f�-�-�-� )� functools�wraps)r r s ` r �isolated_contextr s8 �� ��_�T���.� .� .� .� ��.� �Nr c �0 � e Zd Zd� Zed� � � Zd� Zd� Zd� Zd� Z d� Z
d� Zd � Zed
� � � Z
d� Zd� Zd
� Zed� � � Zed� � � Zed� � � Zed� � � Zed� � � Zd� Ze ej � � d� � � � � ZdS )�ContextTestc �P � | � t d� � 5 t j � � d d d � � n# 1 swxY w Y | � t d� � 5 t j d� � d d d � � n# 1 swxY w Y t j d� � }| � |j d� � | � t � � 5 d|_ d d d � � n# 1 swxY w Y | � t |� � t d� � � � d S )Nztakes exactly 1z
must be a str� �aaa�bbb)
�assertRaisesRegex� TypeErrorr
�
ContextVar�assertEqual�name�assertRaises�AttributeError�assertNotEqual�hash)�self�cs r �test_context_var_new_1z"ContextTest.test_context_var_new_1 s� � �
�
#�
#�I�/@�
A�
A� %� %��"�$�$�$� %� %� %� %� %� %� %� %� %� %� %���� %� %� %� %� �
#�
#�I��
?�
?� &� &��"�1�%�%�%� &� &� &� &� &� &� &� &� &� &� &���� &� &� &� &�
�"�5�)�)��������'�'�'�
�
�
�~�
.�
.� � ��A�F� � � � � � � � � � � ���� � � � �
���D��G�G�T�%�[�[�1�1�1�1�1s3 �<�A �A �"B�B�
B�C+�+C/�2C/c � � t j d� � }| � dt |� � � � t j dd�� � }| � dt |� � � � g }t j d|�� � }|� |� � | � dt |� � � � | � dt |� � � � |� d� � }| � t |� � t |� � � � | � dt |� � � � |� |� � | � dt |� � � � d S )N�a�{ ��default�123z...r z used )r
r �assertIn�repr�append�set�assertNotIn�reset)r&