
    Yf                         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
n# e$ r dZ
Y nw xY w G d d	          Z G d
 dej                  ZdS )z+
Tests for L{twisted.internet.serialport}.
    )ConnectionDone)Protocol)Failure)unittest)
serialportNc                       e Zd ZdZd Zd ZdS )	DoNothingz.
    Object with methods that do nothing.
    c                     d S N )selfargskwargss      W/var/www/html/env/lib/python3.11/site-packages/twisted/internet/test/test_serialport.py__init__zDoNothing.__init__   s        c                     d S )Nc                      d S r   r   )r   r   s     r   <lambda>z'DoNothing.__getattr__.<locals>.<lambda>   s    t 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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                 l    G d dt           j                  }g  G fddt                    } | |            dt                                }|                     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                       e Zd ZeZd ZdS )@SerialPortTests.test_connectionMadeLost.<locals>.DummySerialPortc                     d S 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dS )?SerialPortTests.test_connectionMadeLost.<locals>.SerialProtocolc                 2                         d           d S )NconnectionMadeappend)r   eventss    r   r(   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionMade;   s    ./////r   c                 6                         d|f           d S )NconnectionLostr)   )r   reasonr+   s     r   r-   zNSerialPortTests.test_connectionMadeLost.<locals>.SerialProtocol.connectionLost>   s!    /899999r   N)r   r   r   r(   r-   )r+   s   r   SerialProtocolr&   :   sG        0 0 0 0 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 	 	 	 	: 	: 	: 	: 	: 	: 	:X 	: 	: 	: ~~//Y[[III"2!3444 N$$%%A"25Eq4I!JKKKKKr   )r   r   r   r   r   skipr6   r   r   r   r   r   !   s?          6L L L L 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 1 1 1 1 1 . . . . . . * * * * * * " " " " " ":::::: JJ    JJJ	, 	, 	, 	, 	, 	, 	, 	,'L 'L 'L 'L 'Lh' 'L 'L 'L 'L 'Ls   % //