← Back
Editing: test_stdio.cpython-38.pyc
U W[1 � @ sp d Z ddlmZmZ ddlmZ ddlmZ ddlm Z e� � sLddlmZ G dd� de�Z e� �e �� � d S ) z& Tests for L{twisted.internet.stdio}. � )�absolute_import�division)�platform)�ReactorBuilder)�Protocol)� StandardIOc @ s\ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Ze� � rXdZdS )�StdioFilesTestszI L{StandardIO} supports reading and writing to filesystem files. c C s4 | � � }t|d��� t|d�| _| �| jj� d S )N�wbzrb+)�mktemp�open�close� extraFile� addCleanup)�self�path� r �B/usr/lib/python3/dist-packages/twisted/internet/test/test_stdio.py�setUp s zStdioFilesTests.setUpc s� | � � � G � fdd�dt�}| �� }t|d��}|�d� W 5 Q R X t|d��0}|� }t||�� | j�� � d� | �� � W 5 Q R X | � |j d� dS )zc Adding a filesystem file reader to a reactor will make sure it is polled. c s e Zd ZdZ� fdd�ZdS )z4StdioFilesTests.test_addReader.<locals>.DataProtocol� c s$ | j |7 _ | j dkr � �� d S )N� hello!)�data�stop)r r ��reactorr r �dataReceived( s zAStdioFilesTests.test_addReader.<locals>.DataProtocol.dataReceivedN)�__name__� __module__�__qualname__r r r r r r �DataProtocol&