File manager - Edit - /usr/lib/python3/dist-packages/twisted/test/__pycache__/testutils.cpython-310.pyc
Back
o �b: � @ sz d Z ddlmZ ddlmZ ddlmZ G dd� d�Zdd� Z G d d � d �Z G dd� d�ZG d d� d�ZG dd� d�Z dS )a� I{Private} test utilities for use throughout Twisted's test suite. Unlike C{proto_helpers}, this is no exception to the don't-use-it-outside-Twisted-we-won't-maintain-compatibility rule! @note: Maintainers be aware: things in this module should be gradually promoted to more full-featured test helpers and exposed as public API as your maintenance time permits. In order to be public API though, they need their own test cases. � )�BytesIO)�minidom)�FileWrapperc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �IOPumpz�Utility to pump data between clients and servers for protocol testing. Perhaps this is a utility worthy of being in protocol.py? c C s || _ || _|| _|| _d S )N)�client�server�clientIO�serverIO)�selfr r r r � r �8/usr/lib/python3/dist-packages/twisted/test/testutils.py�__init__ s zIOPump.__init__c C s | � � r | � � sdS dS )z,Pump until there is no more input or output.N)�pump)r r r r �flush! s �zIOPump.flushc C s� | j �d� | j�d� | j �� }| j�� }| j �d� | j�d� | j �� | j�� |D ]}| j�|� q.|D ]}| j�|� q9|sF|rHdS dS )zOMove data back and forth. Returns whether any data was moved. r � )r �seekr �read�truncater �dataReceivedr )r �cData�sData�byter r r r &