← Back
Editing: test_team.cpython-38.pyc
U W[>% � @ s� d Z ddlmZmZmZ ddlmZ ddlmZm Z ddl mZ ddlm Z ddlmZmZmZmZ G d d � d eed��ZG dd � d e�ZdS )z& Tests for L{twisted._threads._team}. � )�absolute_import�division�print_function)�SynchronousTestCase)�call�get)�proxyForInterface)�Failure� )�IWorker�Team�createMemoryWorker�AlreadyQuitc s( e Zd ZdZdd� Z� fdd�Z� ZS )�ContextualWorkerz: A worker implementation that supplies a context. c K s || _ || _dS )z: Create with a real worker and a context. N)�_realWorker�_context)�selfZ realWorkerZctx� r �A/usr/lib/python3/dist-packages/twisted/_threads/test/test_team.py�__init__ s zContextualWorker.__init__c s t t� ��� �fdd�� dS )z� Perform the given work with the context given to __init__. @param work: the work to pass on to the real worker. c s t � j��S �N)r r r �r Zworkr r �<lambda>% � z%ContextualWorker.do.<locals>.<lambda>N)�superr �dor �� __class__r r r s zContextualWorker.do)�__name__� __module__�__qualname__�__doc__r r � __classcell__r r r r r s r r c @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"S )#� TeamTestsz Tests for L{Team} c sl t � \}� _t|dd�� _g � _g � _g � _g � _dd� � _� fdd�}g � _ � fdd�}t |||�� _d S ) zl Set up a L{Team} with inspectable, synchronous workers that can be single-stepped. �coordinator��workerc S s dS )NFr r r r r r 9 r z!TeamTests.setUp.<locals>.<lambda>c sz �� � rd S t� \} ��j��� �j��� t| t�j�d�� �j�� � �j�� � � j �� ���fdd�}|� _ � S )Nr% c s"