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: //lib/python3/dist-packages/twisted/pair/test/__pycache__/test_ethernet.cpython-38.pyc
U


W[��@sbddlmZddlmZddlmZmZddlmZeej	�Gdd�d��Z
Gdd�dej�Zd	S)
�)�unittest)�
components)�ethernet�raw)�implementerc@seZdZdd�Zdd�ZdS)�
MyProtocolcCst|�|_dS)N)�list�	expecting)�selfr	�r�A/usr/lib/python3/dist-packages/twisted/pair/test/test_ethernet.py�__init__szMyProtocol.__init__cKs>|jstd��|j�d�}|||fks:td|||ff��dS)Nz(Got a packet when not expecting anymore.rzExpected %r, got %r)r	�AssertionError�pop)r
�data�kwZexpectrrr�datagramReceiveds��zMyProtocol.datagramReceivedN)�__name__�
__module__�__qualname__r
rrrrrr
src@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
EthernetTestscCsRt��}tdddddd�fg�}|�d|�|jddd�|jrNtd	|j��dS�
N�foobarr�123456�987654���partial�dest�sourceZprotocol�123456987654foobar�r�5Should not expect any more packets, but still want %r�r�EthernetProtocolr�addProtorr	r�r
�proto�p1rrr�testPacketParsings ��
��zEthernetTests.testPacketParsingcCspt��}tdddddd�fddd	d
dd�fg�}|�d|�|jddd�|jd
dd�|jrltd|j��dS)Nrrrrrr�quux��012345�abcdefr r!�012345abcdefquuxr"r#r&rrr�testMultiplePackets-s2������z!EthernetTests.testMultiplePacketscCs�t��}tdddddd�fg�}tdddddd�fg�}|�d|�|�d|�|jddd�|jrrtd	|j��|jr�td	|j��dSrr#�r
r'r(Zp2rrr�testMultipleSameProtosKs8�������z$EthernetTests.testMultipleSameProtoscCs<t��}tg�}|�d|�|jddd�|jddd�dS)Nir rr!r.r+)rr$rr%rr&rrr�testWrongProtoNotSeenns��z#EthernetTests.testWrongProtoNotSeencCs�t��}tdddddd�fddd	d
dd�fg�}|�d|�tddd	d
dd�fdddddd�fg�}|�d|�|jddd
�|jddd
�|jddd
�|jddd
�|jr�td|j��|jr�td|j��dS)Nrrrrrrr*r+r,r-ir r!s012345abcdefquuxs123456987654foobarr.r"r#r0rrr�testDemuxingxsb������������zEthernetTests.testDemuxingcCs<t��}z|�dd�Wntjk
r.Yn
Xtd��dS)z2Adding a wrong level protocol raises an exception.�*Z	silliness�2addProto must raise an exception for bad protocolsN)rr$r%rZCannotAdaptr�r
�errr�testAddingBadProtos_WrongLevel�sz,EthernetTests.testAddingBadProtos_WrongLevelc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)z=Adding a protocol with a negative number raises an exception.���)z'Added protocol must be positive or zeroNr5�rr$r%r�	TypeError�argsrr6rrr�testAddingBadProtos_TooSmall�s
z*EthernetTests.testAddingBadProtos_TooSmallc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)�<Adding a protocol with a number >=2**16 raises an exception.i�z"Added protocol must fit in 16 bitsNr5r:r6rrr�testAddingBadProtos_TooBig�s
z(EthernetTests.testAddingBadProtos_TooBigc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)r>ir?Nr5r:r6rrr�testAddingBadProtos_TooBig2�s
z)EthernetTests.testAddingBadProtos_TooBig2N)rrrr)r/r1r2r3r8r=r@rArrrrrs#
6
rN)
Z
twisted.trialrZtwisted.pythonrZtwisted.pairrrZzope.interfacerZIRawPacketProtocolrZTestCaserrrrr�<module>s