File: //usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/test_protocol.cpython-310.pyc
o
�bXH � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
mZmZm
Z
ddlmZmZmZmZmZmZ ddlmZmZ dd lmZ dd
lmZmZ ddlmZ G dd
� d
e�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd� de�Z#dS )z)
Tests for L{twisted.internet.protocol}.
� )�BytesIO)�implementer)�verifyObject)�CancelledError)� IConsumer�ILoggingContext� IProtocol�IProtocolFactory)�
ClientCreator�ConsumerToProtocolAdapter�Factory�FileWrapper�Protocol�ProtocolToConsumerAdapter)�LogLevel�globalLogPublisher)�Failure)�MemoryReactorClock�StringTransport)�TestCasec @ 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 )#�ClientCreatorTestsz?
Tests for L{twisted.internet.protocol.ClientCreator}.
c C sD G dd� dt �}t� }t||�}|||�}|�d�}| �||� dS )a
Helper for implementing a test to verify that one of the I{connect}
methods of L{ClientCreator} passes the right arguments to the right
reactor method.
@param check: A function which will be invoked with a reactor and a
L{ClientCreator} instance and which should call one of the
L{ClientCreator}'s I{connect} methods and assert that all of its
arguments except for the factory are passed on as expected to the
reactor. The factory should be returned.
c @ � e Zd ZdS )z:ClientCreatorTests._basicConnectTest.<locals>.SomeProtocolN��__name__�
__module__�__qualname__� r r �E/usr/lib/python3/dist-packages/twisted/internet/test/test_protocol.py�SomeProtocol5 � r N)r r r
�
buildProtocol�assertIsInstance)�self�checkr �reactor�cc�factory�protocolr r r �_basicConnectTest( s
z$ClientCreatorTests._basicConnectTestc � � fdd�}� � |� dS )z�
L{ClientCreator.connectTCP} calls C{reactor.connectTCP} with the host
and port information passed to it, and with a factory which will
construct the protocol passed to L{ClientCreator.__init__}.
c sX |� dddd� | j�� \}}}}}� �|d� � �|d� � �|d� � �|d� |S )N�example.com�� �� )z1.2.3.4i�&