
    Vh                         d Z ddlmZ ddlmZ ddlmZ ddlmZ 	 ddl	m
Z eZ
 G d d	      Z G d
 dej                        Zy# e$ r dZ
Y )w xY w)z+
Tests for L{twisted.internet.serialport}.
    )ConnectionDone)Protocol)Failure)unittest)
serialportNc                       e Zd ZdZd Zd Zy)	DoNothingz.
    Object with methods that do nothing.
    c                      y N )selfargskwargss      U/home/dcms/DCMS/lib/python3.12/site-packages/twisted/internet/test/test_serialport.py__init__zDoNothing.__init__   s        c                     d S )Nc                       y r   r   )r   r   s     r   <lambda>z'DoNothing.__getattr__.<locals>.<lambda>   s    r   r   )r   attrs     r   __getattr__zDoNothing.__getattr__   s    ++r   N)__name__
__module____qualname____doc__r   r   r   r   r   r	   r	      s    ,r   r	   c                       e Zd ZdZedZd Zy)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                 (    G d dt         j                        }g  G fddt              } | |       dt                     }| j	                  dg       t        t                     }|j                  |       | j	                  dd|fg       y	)
zr
        C{connectionMade} and C{connectionLost} are called on the protocol by
        the C{SerialPort}.
        c                       e Zd ZeZd Zy)@SerialPortTests.test_connectionMadeLost.<locals>.DummySerialPortc                      y r   r   )r   s    r   _finishPortSetupzQSerialPortTests.test_connectionMadeLost.<locals>.DummySerialPort._finishPortSetup5   s    r   N)r   r   r   r	   _serialFactoryr"   r   r   r   DummySerialPortr    2   s    &Nr   r$   c                   "    e Zd Z fdZ fdZy)?SerialPortTests.test_connectionMadeLost.<locals>.SerialProtocolc                 (    j                  d       y )NconnectionMadeappend)r   eventss    r   r(   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionMade;   s    ./r   c                 ,    j                  d|f       y )NconnectionLostr)   )r   reasonr+   s     r   r-   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionLost>   s    /89r   N)r   r   r   r(   r-   )r+   s   r   SerialProtocolr&   :   s    0:r   r/    )reactorr(   r-   N)r   
SerialPortr   r	   assertEqualr   r   r-   )r   r$   r/   portfr+   s        @r   test_connectionMadeLostz'SerialPortTests.test_connectionMadeLost+   s    	j33 	 	:X 	: ~/Y[I"2!34 N$%A"25Eq4I!JKr   )r   r   r   r   r   skipr6   r   r   r   r   r   !   s     6Lr   r   )r   twisted.internet.errorr   twisted.internet.protocolr   twisted.python.failurer   twisted.trialr   twisted.internetr   _serialportImportErrorr	   TestCaser   r   r   r   <module>r@      s[    2 . * ": J	, 	,'Lh'' 'L%  Js   A AA