o
    b                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ zddl	m
Z W n ey-   dZ
Y nw eZ
G dd	 d	ZG d
d dejZdS )z+
Tests for L{twisted.internet.serialport}.
    )ConnectionDone)Protocol)Failure)unittest)
serialportNc                   @   s    e Zd ZdZdd Zdd ZdS )	DoNothingz.
    Object with methods that do nothing.
    c                 O      d S N )selfargskwargsr
   r
   G/usr/lib/python3/dist-packages/twisted/internet/test/test_serialport.py__init__      zDoNothing.__init__c                 C   s   dd S )Nc                  _   r   r	   r
   )r   r   r
   r
   r   <lambda>   s    z'DoNothing.__getattr__.<locals>.<lambda>r
   )r   attrr
   r
   r   __getattr__   s   zDoNothing.__getattr__N)__name__
__module____qualname____doc__r   r   r
   r
   r
   r   r      s    r   c                   @   s$   e Zd ZdZedu rdZdd ZdS )SerialPortTestszt
    Minimal testing for Twisted's serial port support.

    See ticket #2462 for the eventual full test suite.
    Nz%Serial port support is not available.c                    sv   G dd dt j}g  G  fdddt}|| dt d}|  dg tt }|| |  dd|fg d	S )
zr
        C{connectionMade} and C{connectionLost} are called on the protocol by
        the C{SerialPort}.
        c                   @   s   e Zd ZeZdd ZdS )z@SerialPortTests.test_connectionMadeLost.<locals>.DummySerialPortc                 S   r   r	   r
   r   r
   r
   r   _finishPortSetup4   r   zQSerialPortTests.test_connectionMadeLost.<locals>.DummySerialPort._finishPortSetupN)r   r   r   r   _serialFactoryr   r
   r
   r
   r   DummySerialPort1   s    r   c                       s$   e Zd Z fddZ fddZdS )z?SerialPortTests.test_connectionMadeLost.<locals>.SerialProtocolc                    s     d d S )NconnectionMadeappendr   eventsr
   r   r   :   s   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionMadec                    s     d|f d S )NconnectionLostr   )r   reasonr    r
   r   r"   =   s   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionLostN)r   r   r   r   r"   r
   r    r
   r   SerialProtocol9   s    r$    )reactorr   r"   N)r   
SerialPortr   r   assertEqualr   r   r"   )r   r   r$   portfr
   r    r   test_connectionMadeLost+   s   

z'SerialPortTests.test_connectionMadeLost)r   r   r   r   r   skipr+   r
   r
   r
   r   r   !   s
    r   )r   twisted.internet.errorr   twisted.internet.protocolr   twisted.python.failurer   twisted.trialr   twisted.internetr   _serialportImportErrorr   TestCaser   r
   r
   r
   r   <module>   s   