HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/test/__pycache__/test_stateful.cpython-38.pyc
U


W[��@stdZddlmZddlmZddlmZddlmZm	Z	m
Z
Gdd�de�ZGdd	�d	e�ZGd
d�deej
�ZdS)
z+
Test cases for twisted.protocols.stateful
�)�TestCase)�
test_basic)�StatefulProtocol)�pack�unpack�calcsizec@sPeZdZdZdZdZee�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�MyInt32StringReceiverz)
    A stateful Int32StringReceiver.
    i��z!IcCs
|jdfS�N�)�
_getHeader��self�r�</usr/lib/python3/dist-packages/twisted/test/test_stateful.py�getInitialStatesz%MyInt32StringReceiver.getInitialStatecCs|j��dS�N)�	transportZloseConnection)r
�lengthrrr�lengthLimitExceededsz)MyInt32StringReceiver.lengthLimitExceededcCs.td|�\}||jkr$|�|�dS|j|fS)N�!i)r�
MAX_LENGTHr�
_getString)r
�msgrrrrr s


z MyInt32StringReceiver._getHeadercCs|�|�|jdfSr	)�stringReceivedr�r
rrrrr(s
z MyInt32StringReceiver._getStringcCst�dS)z 
        Override this.
        N)�NotImplementedErrorrrrrr-sz$MyInt32StringReceiver.stringReceivedcCs |j�t|jt|��|�dS)zS
        Send an int32-prefixed string to the other end of the connection.
        N)r�writer�structFormat�len)r
�datarrr�
sendString4sz MyInt32StringReceiver.sendStringN)�__name__�
__module__�__qualname__�__doc__rrrZprefixLengthrrrrrr rrrrrsrc@s,eZdZdd�Zdd�ZdZdZdd�Zd	S)
�	TestInt32cCs
g|_dSr)�receivedrrrr�connectionMade=szTestInt32.connectionMadecCs|j�|�dSr)r&�append)r
�srrrrAszTestInt32.stringReceived�2rcCs
d|_dS)N�)�closed)r
�reasonrrr�connectionLostHszTestInt32.connectionLostN)r!r"r#r'rrr,r.rrrrr%<s
r%c@s0eZdZeZddgZdgZdddgZdd�Zd	S)
�
Int32Tests�asbbbbbbbbbbbbbbbbs
aaaaaasshello there�cCsT|��}d}|jdD]}|tdt|��|7}q|�|�|�|j|jd�dS)N�r
r)ZgetProtocol�stringsrrZdataReceivedZassertEqualr&)r
�rZbigr)rrr�test_bigReceiveSs
zInt32Tests.test_bigReceiveN)	r!r"r#r%Zprotocolr3ZillegalStringsZpartialStringsr5rrrrr/Ms

r/N)r$Ztwisted.trial.unittestrZtwisted.protocols.testrZtwisted.protocols.statefulrZstructrrrrr%ZIntNTestCaseMixinr/rrrr�<module>s,