%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����dZddlZddlZddlmZddlmZmZmZddl	m
Z
ddlmZm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZGd�dej8�ZGd�dej8�ZGd�dej>�Z Gd�dejB�Z"Gd�dej8�Z#Gd�dejB�Z$Gd�dejB�Z%Gd�d�Z&Gd�de&ejN�Z(Gd �d!�Z)Gd"�d#ejBe)�Z*Gd$�d%e)�Z+Gd&�d'�Z,Gd(�d)e&ejZ�Z.Gd*�d+ejBe+e,�Z/Gd,�d-e&ej`�Z1Gd.�d/ejBe+e,�Z2Gd0�d1e&ejf�Z4Gd2�d3ejBe+e,�Z5Gd4�d5�Z6Gd6�d7ej8�Z7Gd8�d9ejB�Z8Gd:�d;ejr�Z:y)<z,
Test cases for L{twisted.protocols.basic}.
�N)�BytesIO)�List�Optional�Type)�verifyObject)�protocol�task)�	IProducer)�connectionDone)�basic)�	iterbytes)�Failure)�
proto_helpers)�unittestc�&�eZdZdZdZd�Zd�Zd�Zy)�FlippingLineTesterzT
    A line receiver that flips between line and raw data modes after one byte.
    �
c��g|_y�N)�lines��selfs �C/usr/lib/python3/dist-packages/twisted/protocols/test/test_basic.py�__init__zFlippingLineTester.__init__!s	����
�c�Z�|jj|�|j�y)z&
        Set the mode to raw.
        N)r�append�
setRawMode�r�lines  r�lineReceivedzFlippingLineTester.lineReceived$s ��	
�
�
���$�����rc�,�|j|dd�y)z,
        Set the mode back to line.
        �N)�setLineMode�r�datas  r�rawDataReceivedz"FlippingLineTester.rawDataReceived+s��	
����a�b��"rN)�__name__�
__module__�__qualname__�__doc__�	delimiterrr!r'�rrrrs����I���#rrc�8�eZdZdZdZdZd
d�Zd�Zd�Zd�Z	d	�Z
y)�
LineTestera�
    A line receiver that parses data received and make actions on some tokens.

    @type delimiter: C{bytes}
    @ivar delimiter: character used between received lines.
    @type MAX_LENGTH: C{int}
    @ivar MAX_LENGTH: size of a line when C{lineLengthExceeded} will be called.
    @type clock: L{twisted.internet.task.Clock}
    @ivar clock: clock simulating reactor callLater. Pass it to constructor if
        you want to use the pause/rawpause functionalities.
    r�@Nc��||_y)z@
        If given, use a clock to make callLater calls.
        N)�clock)rr2s  rrzLineTester.__init__Bs����
rc��g|_y�z;
        Create/clean data received on connection.
        N��receivedrs r�connectionMadezLineTester.connectionMadeH�����
rc���|jj|�|dk(r|j�y|dk(r7|j�|jjd|j�y|dk(rb|j�|j�|jjd�|jjd|j�y|dk(r|j�y|dddk(rt|dd�|_	y|jd	�r|jj|d
�y|jd�r|jj�yy)z|
        Receive line and make some action for some tokens: pause, rawpause,
        stop, len, produce, unproduce.
        r�pauser�rawpause�stopN�slen �produceF�	unproduce)r6rr�pauseProducingr2�	callLater�resumeProducing�
stopProducing�int�length�
startswith�	transport�registerProducer�unregisterProducerrs  rr!zLineTester.lineReceivedNs��
	
�
�
���T�"��3�;��O�O��
�X�
����!��J�J� � ��D�$8�$8�9�
�[�
 ����!��O�O���M�M� � ��%��J�J� � ��D�$8�$8�9�
�W�_���� �
�"�1�X��
 ��d�1�2�h�-�D�K�
�_�_�Z�
(��N�N�+�+�D�%�8�
�_�_�\�
*��N�N�-�-�/�+rc��|d|j||jd}}|jt|�z
|_|jd|z|jd<|jdk(r|j|�yy)zj
        Read raw data, until the quantity specified by a previous 'len' line is
        reached.
        N���r)rE�lenr6r$)rr&�rests   rr'zLineTester.rawDataReceivedgsr��
�-�D�K�K�(�$�t�{�{�}�*=�d���k�k�C��I�-��� �M�M�"�-��4��
�
�b���;�;�!�����T�"�rc�~�t|�|jdzkDr"|j||jdzd�yy)z<
        Adjust line mode when long lines received.
        r#N)rL�
MAX_LENGTHr$rs  r�lineLengthExceededzLineTester.lineLengthExceededrs=���t�9�t����*�*����T�$�/�/�A�"5�"7�8�9�+rr)r(r)r*r+r,rOrr7r!r'rPr-rrr/r/2s,��
��I��J���0�2	#�:rr/c�$�eZdZdZdZdZd�Zd�Zy)�LineOnlyTesterz)
    A buffering line only receiver.
    rr0c��g|_yr4r5rs rr7zLineOnlyTester.connectionMade�r8rc�:�|jj|�y)z%
        Save received data.
        N�r6rrs  rr!zLineOnlyTester.lineReceived�s��	
�
�
���T�"rN)r(r)r*r+r,rOr7r!r-rrrRrRzs����I��J��#rrRc��eZdZdZdZgd�Zd�ZdZgd�ZedgzZ	d�Z
d	Zgd
�Zgd�Z
d�Zd
Zgd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�LineReceiverTestsz\
    Test L{twisted.protocols.basic.LineReceiver}, using the C{LineTester}
    wrapper.
    s�len 10

0123456789len 5

1234
len 20
foo 123

0123456789
012345678len 0
foo 5

1234567890123456789012345678901234567890123456789012345678901234567890
len 1

a)
slen 10�
0123456789�len 5s1234
slen 20sfoo 123s0123456789
012345678slen 0sfoo 5rs67890slen 1�ac��tdd�D]�}tj�}t�}|j	tj|��tt|j�|zdz�D]+}|j||z|dz|z}|j|��-|j|j|j���y)zl
        Test buffering for different packet size, checking received matches
        expected data.
        r#�
N)
�ranger�StringIOWithoutClosingr/�makeConnectionr�FileWrapperrL�buffer�dataReceived�assertEqual�outputr6�r�packet_size�t�a�i�ss      r�test_bufferzLineReceiverTests.test_buffer�s���
!��B�<�	6�K��4�4�6�A���A�
���X�1�1�!�4�5��3�t�{�{�+�{�:�Q�>�?�
"���K�K��K��1�q�5�K�2G�H�����q�!�
"�
���T�[�[�!�*�*�5�	6rs!twiddle1
twiddle2
pause
twiddle3
)�twiddle1�twiddle2r:�twiddle3c�6�tdd�D�]	}tj�}tj�}t|�}|j
tj|��tt|j�|zdz�D]+}|j||z|dz|z}|j|��-|j|j|j�|jd�|j|j |j���y)zo
        Test pause inside data receiving. It uses fake clock to see if
        pausing/resuming work.
        r#r\rN)r]rr^r	�Clockr/r_rr`rL�pauseBufrbrc�pauseOutput1r6�advance�pauseOutput2�rrfrgr2rhrirjs       r�test_pausingzLineReceiverTests.test_pausing�s���
!��B�<�
	<�K��4�4�6�A��J�J�L�E��5�!�A�
���X�1�1�!�4�5��3�t�}�}�-��<�q�@�A�
"���M�M�!�k�/�Q��U�k�4I�J�����q�!�
"�
���T�.�.��
�
�;��M�M�!�����T�.�.��
�
�;�
	<rs/twiddle1
twiddle2
len 5
rawpause
12345twiddle3
)rlrmrYr;r)rlrmrYr;s12345rnc�6�tdd�D�]	}tj�}tj�}t|�}|j
tj|��tt|j�|zdz�D]+}|j||z|dz|z}|j|��-|j|j|j�|jd�|j|j |j���y)z7
        Test pause inside raw date receiving.
        r#r\rN)r]rr^r	rpr/r_rr`rL�rawpauseBufrbrc�rawpauseOutput1r6rs�rawpauseOutput2rus       r�test_rawPausingz!LineReceiverTests.test_rawPausing�s���!��B�<�
	?�K��4�4�6�A��J�J�L�E��5�!�A�
���X�1�1�!�4�5��3�t�/�/�0�K�?�!�C�D�
"���$�$�Q��_��A���7L�M�����q�!�
"�
���T�1�1�1�:�:�>��M�M�!�����T�1�1�1�:�:�>�
	?rs"twiddle1
twiddle2
stop
more
stuff
)rlrmr<c��tdd�D]�}tj�}t�}|j	tj|��tt|j�|zdz�D]+}|j||z|dz|z}|j|��-|j|j|j���y)z-
        Test stop inside producing.
        r#r\N)
r]rr^r/r_rr`rL�stop_bufrbrc�stop_outputr6res      r�test_stopProducingz$LineReceiverTests.test_stopProducing�s���!��B�<�	;�K��4�4�6�A���A�
���X�1�1�!�4�5��3�t�}�}�-��<�q�@�A�
"���M�M�!�k�/�Q��U�k�4I�J�����q�!�
"�
���T�-�-�q�z�z�:�	;rc���t�}tj�}|jt	j
|��|j
d�|j|jgd��y)z6
        Test produce/unproduce in receiving.
        s&produce
hello world
unproduce
goodbye
)r>shello worldr?�goodbyeN)	r/rr^r_rr`rbrcr6)rrhrgs   r�test_lineReceiverAsProducerz-LineReceiverTests.test_lineReceiverAsProducersW��
�L���0�0�2��	����-�-�a�0�1�	���D�E����
�J�J�N�	
rc�l�Gd�dtj�}|�}|jd�|j|jd�|j|j
d�|jd�|j|jd�|j|j
d�y	)
z�
        L{LineReceiver.clearLineBuffer} removes all buffered data and returns
        it as a C{bytes} and can be called from beneath C{dataReceived}.
        c��eZdZd�Zy)�@LineReceiverTests.test_clearLineBuffer.<locals>.ClearingReceiverc�<�||_|j�|_yr)r �clearLineBufferrMrs  rr!zMLineReceiverTests.test_clearLineBuffer.<locals>.ClearingReceiver.lineReceiveds�� ��	� �0�0�2��	rN)r(r)r*r!r-rr�ClearingReceiverr�s��
3rr�s
foo
bar
baz�foosbar
bazsquux
squuxrN)r�LineReceiverrbrcr rM)rr�rs   r�test_clearLineBufferz&LineReceiverTests.test_clearLineBuffers���	3�u�1�1�	3�
$�%������2�3��������/�������
�6�	����k�*��������0��������,rc�4�t�}tj�}|jt	j
|��t
j�}|jd|z�|jd|zdj|j��y)zC
        Test switching modes many times on the same data.
        sx
x�xrN)rrr^r_rr`�sys�getrecursionlimitrbrc�joinr)r�protorG�limits    r�test_stackRecursionz%LineReceiverTests.test_stackRecursion*st��#�$��!�8�8�:�	�
���X�1�1�)�<�=��%�%�'��
���7�U�?�+�������s�x�x����'<�=rc���tj�}tj�}|j	|�|jd|jdzzdz�|j|j�y�zx
        C{LineReceiver} disconnects the transport if it receives a line longer
        than its C{MAX_LENGTH}.
        r�r#�
rN�	rr�r�StringTransportr_rbrO�
assertTrue�
disconnecting�rr�rGs   r�test_maximumLineLengthz(LineReceiverTests.test_maximumLineLength5�c��
�"�"�$��!�1�1�3�	�
���Y�'�
���4�5�#3�#3�a�#7�8�8�C�D����	�/�/�0rc���t�}d|_tj�}|j	|�d|jdz
z}|j|�|j|jdd�|j|jdd|z�|j|j�|jt|j�d�|j||jd�y)a~
        C{LineReceiver} doesn't disconnect the transport when it
        receives a finished line as long as its C{MAX_LENGTH}, when
        the second-to-last packet ended with a pattern that could have
        been -- and turns out to have been -- the start of a
        delimiter, and that packet causes the total input to exceed
        C{MAX_LENGTH} + len(delimiter).
        r=r�r#NrKr)r/rOrr�r_rbr,�assertFalser�rcrLr6)rr�rgr s    r�&test_maximumLineLengthPartialDelimiterz8LineReceiverTests.test_maximumLineLengthPartialDelimiter@s����������)�)�+��
���Q���u�'�'�!�+�,��
���4� �
���5�?�?�3�B�/�0�
���5�?�?�2�3�/�$�6�7�������)�����U�^�^�,�a�0�����u�~�~�a�0�1rc�B�tj�}d|_tj�}|j|�|j
d|jz|jdt|j�dz
z�|j|j�y)aO
        C{LineReceiver} doesn't disconnect the transport it if
        receives a non-finished line whose length, counting the
        delimiter, is longer than its C{MAX_LENGTH} but shorter than
        its C{MAX_LENGTH} + len(delimiter). (When the first part that
        exceeds the max is the beginning of the delimiter.)
        s
r�Nr#)rr�r,rr�r_rbrOrLr�r�r�s   r�(test_notQuiteMaximumLineLengthUnfinishedz:LineReceiverTests.test_notQuiteMaximumLineLengthUnfinishedVs����"�"�$��"���!�1�1�3�	�
���Y�'�
���
�E�$�$�
$����8R�#�e�o�o�:N�QR�:R�(S�S�	
�	
����0�0�1rc���tj�}d�|_tj�}|j|�|j
�|jd�}|j|t�y)zf
        C{LineReceiver.dataReceived} forwards errors returned by
        C{rawDataReceived}.
        c��td�S)N�oops)�RuntimeError�r&s r�<lambda>z5LineReceiverTests.test_rawDataError.<locals>.<lambda>os��\�&�-A�rsdataN)
rr�r'rr�r_rrb�assertIsInstancer�)rr�rG�whys    r�test_rawDataErrorz#LineReceiverTests.test_rawDataErrorisb��
�"�"�$�� A���!�1�1�3�	�
���Y�'�
����� � ��)�����c�<�0rc�n�tj�}|jt|jd�y)z�
        When L{LineReceiver.rawDataReceived} is not overridden in a
        subclass, calling it raises C{NotImplementedError}.
        �fooN)rr��assertRaises�NotImplementedErrorr'�rr�s  r�"test_rawDataReceivedNotImplementedz4LineReceiverTests.test_rawDataReceivedNotImplementedvs+��
�"�"�$�����-�u�/D�/D�e�Lrc�n�tj�}|jt|jd�y)z�
        When L{LineReceiver.lineReceived} is not overridden in a subclass,
        calling it raises C{NotImplementedError}.
        r�N)rr�r�r�r!r�s  r�test_lineReceivedNotImplementedz1LineReceiverTests.test_lineReceivedNotImplemented~s+��
�"�"�$�����-�u�/A�/A�5�IrN)r(r)r*r+rardrkrqrrrtrvrxryrzr{r}r~rr�r�r�r�r�r�r�r�r�r-rrrWrW�s����
�F�$�F� 6�8�H�7�L��;�-�/�L�<�"J�K�L�O��O�?� :�H�5�K�;�

�-�,	>�	1�2�,2�&1�M�JrrWc�"�eZdZdZd�Zd�Zd�Zy)�ExcessivelyLargeLineCatcherz�
    Helper for L{LineReceiverLineLengthExceededTests}.

    @ivar longLines: A L{list} of L{bytes} giving the values
        C{lineLengthExceeded} has been called with.
    c��g|_yr)�	longLinesrs rr7z*ExcessivelyLargeLineCatcher.connectionMade�s	����rc��y)z/
        Disregard any received lines.
        Nr-rs  rr!z(ExcessivelyLargeLineCatcher.lineReceived�s�rc�:�|jj|�y)zF
        Record any data that exceeds the line length limits.
        N)r�rr%s  rrPz.ExcessivelyLargeLineCatcher.lineLengthExceeded�s��	
�����d�#rN)r(r)r*r+r7r!rPr-rrr�r��s�����
$rr�c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�#LineReceiverLineLengthExceededTestszO
    Tests for L{twisted.protocols.basic.LineReceiver.lineLengthExceeded}.
    c��t�|_d|j_tj�|_|jj
|j
�y)N�)r�r�rOrr�rGr_rs r�setUpz)LineReceiverLineLengthExceededTests.setUp�s>��0�2��
� !��
�
��&�6�6�8����
�
�!�!�$�.�.�1rc���d|jjdzdzz}|jj|�|j|g|jj�y)z�
        If more bytes than C{LineReceiver.MAX_LENGTH} arrive containing no line
        delimiter, all of the bytes are passed as a single string to
        L{LineReceiver.lineLengthExceeded}.
        r��N)r�rOrbrcr��r�	excessives  r�test_longUnendedLinez8LineReceiverLineLengthExceededTests.test_longUnendedLine�sP���D�J�J�1�1�A�5��9�:�	��
�
���	�*����)��d�j�j�&:�&:�;rc��d|jjdzdzz}|jjd|jjz|z�|j	|g|jj
�y)a*
        If L{LineReceiver.dataReceived} is called with bytes representing a
        short line followed by bytes that exceed the length limit without a
        line delimiter, L{LineReceiver.lineLengthExceeded} is called with all
        of the bytes following the short line's delimiter.
        r�r�N)r�rOrbr,rcr�r�s  r�test_longLineAfterShortLinez?LineReceiverLineLengthExceededTests.test_longLineAfterShortLine�sd���D�J�J�1�1�A�5��9�:�	��
�
����t�z�z�';�';� ;�i� G�H����)��d�j�j�&:�&:�;rc��|jjjd|jjdzdzzgdz�}|jj	|�|j|g|jj�y)a
        If L{LineReceiver.dataReceived} is called with more than
        C{LineReceiver.MAX_LENGTH} bytes containing a line delimiter somewhere
        not in the first C{MAX_LENGTH} bytes, the entire byte string is passed
        to L{LineReceiver.lineLengthExceeded}.
        r�r�N)r�r,r�rOrbrcr�r�s  r�test_longLineWithDelimiterz>LineReceiverLineLengthExceededTests.test_longLineWithDelimiter�sr���J�J�(�(�-�-�
�T�Z�Z�*�*�Q�.��2�
3�4�q�8�
�	�	
�
�
���	�*����)��d�j�j�&:�&:�;rc��d|jjdzdzz|jjzdz}|jj|�|j	|g|jj
�y)a
        If L{LineReceiver.dataReceived} is called with more than
        C{LineReceiver.MAX_LENGTH} bytes containing multiple line delimiters
        somewhere not in the first C{MAX_LENGTH} bytes, the entire byte string
        is passed to L{LineReceiver.lineLengthExceeded}.
        r�r�N)r�rOr,rbrcr�r�s  r�test_multipleLongLinesz:LineReceiverLineLengthExceededTests.test_multipleLongLines�se���T�Z�Z�2�2�Q�6��:�;�d�j�j�>R�>R�R�VW�W�	��
�
���	�*����)��d�j�j�&:�&:�;rc���tj�}tj�}|j	|�|jd|jdzzdz�|j|j�yr�r�r�s   rr�z:LineReceiverLineLengthExceededTests.test_maximumLineLength�r�rc��tj�}tj�}|j	|�|jd|jt|j�zz�|j|j�y)z�
        C{LineReceiver} disconnects the transport it if receives a non-finished
        line longer than its C{MAX_LENGTH}.
        r�N)rr�rr�r_rbrOrLr,r�r�r�s   r�test_maximumLineLengthRemainingzCLineReceiverLineLengthExceededTests.test_maximumLineLengthRemaining�sg��
�"�"�$��!�1�1�3�	�
���Y�'�
���4�5�#3�#3�c�%�/�/�6J�#J�K�L����	�/�/�0rN)r(r)r*r+r�r�r�r�r�r�r�r-rrr�r��s*���2�<�	<�<�	<�	1�	1rr�c�&�eZdZdZdZd�Zd�Zd�Zy)�LineOnlyReceiverTestsz@
    Tests for L{twisted.protocols.basic.LineOnlyReceiver}.
    s7foo
    bleakness
    desolation
    plastic forks
    c�(�tj�}t�}|j|�t	|j
�D]}|j
|��|j|j|j
jd�dd�y)zW
        Test buffering over line protocol: data received should match buffer.
        rNrK)
rr�rRr_r
rarbrcr6�split)rrgrh�cs    rrkz!LineOnlyReceiverTests.test_buffer�sv��
�)�)�+�����	������4�;�;�'�	�A�
�N�N�1��	�������T�[�[�%6�%6�u�%=�c�r�%B�Crc��t�}tj�}|j|�|j	d|j
t
|j�zdzzdz�|j|j�y)z�
        C{LineOnlyReceiver} disconnects the transport if it receives a
        line longer than its C{MAX_LENGTH} + len(delimiter).
        r�r#r�N)
rRrr�r_rbrOrLr,r�r�r�s   r�!test_greaterThanMaximumLineLengthz7LineOnlyReceiverTests.test_greaterThanMaximumLineLengthsp��
� ��!�1�1�3�	�
���Y�'�
����E�$�$�s�5�?�?�';�;�a�?�@�8�K�	
�	
���	�/�/�0rc�n�tj�}|jt|jd�y)z�
        When L{LineOnlyReceiver.lineReceived} is not overridden in a subclass,
        calling it raises C{NotImplementedError}.
        r�N)r�LineOnlyReceiverr�r�r!r�s  rr�z5LineOnlyReceiverTests.test_lineReceivedNotImplementeds+��
�&�&�(�����-�u�/A�/A�5�IrN)r(r)r*r+rarkr�r�r-rrr�r��s����F�	D�1�Jrr�c�4�eZdZd�Zd�ZdZdZefdeddfd�Z	y)	�	TestMixinc��g|_yrr5rs rr7zTestMixin.connectionMades	����
rc�:�|jj|�yrrU�rrjs  r�stringReceivedzTestMixin.stringReceiveds���
�
���Q�r�2r�reason�returnNc��d|_y)Nr#)�closed)rr�s  r�connectionLostzTestMixin.connectionLost#s	����r)
r(r)r*r7r�rOr�rrr�r-rrr�r�s.��� ��J�
�F�/=��W��$�rr�c��eZdZd�Zy)�
TestNetstringc�p�|jj|�|jj|�yr)r6rrG�writer�s  rr�zTestNetstring.stringReceived(s&���
�
���Q�������Q�rN)r(r)r*r�r-rrr�r�'s�� rr�c�B�eZdZUgZeeeed<dZded<d�Z	d�Z
y)�LPTestCaseMixin�illegalStringsN�!Optional[Type[protocol.Protocol]]rc�p�tj�}|j�}|j|�|S)z�
        Return a new instance of C{self.protocol} connected to a new instance
        of L{proto_helpers.StringTransport}.
        )rr�rr_)rrgrhs   r�getProtocolzLPTestCaseMixin.getProtocol1s0��

�)�)�+���M�M�O��	������rc���|jD]X}|j�}t|�D]}|j|��|j	|j
j��Zy)zO
        Assert that illegal strings cause the transport to be closed.
        N)r�r�r
rbr�rGr��rrj�rr�s    r�test_illegalzLPTestCaseMixin.test_illegal;s\���$�$�	7�A�� � �"�A��q�\�
"�����q�!�
"��O�O�A�K�K�5�5�6�		7r)r(r)r*r�rr�bytes�__annotations__rr�r�r-rrr�r�-s*��,.�N�H�T�%�[�)�.�48�H�1�8��7rr�c��eZdZdZgd�Zgd�ZeZd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�NetstringReceiverTestszA
    Tests for L{twisted.protocols.basic.NetstringReceiver}.
    )�hello�worldshowsaresyou123s:todaysaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)s9999999999999999999999sabcs4:abcdes751:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab,c��tj�|_t�|_|jj|j�yr)rr�rGr��netstringReceiverr_rs rr�zNetstringReceiverTests.setUpVs4��&�6�6�8���!.�������-�-�d�n�n�=rc���tdd�D]�}tj�}t�}d|_|j|�|jD]}|j|��|j�}tt|�|zdz�D]$}|||z|dz|z}|s�|j|��&|j|j|j���y)zI
        Strings can be received in chunks of different lengths.
        r#r\i�N)
r]rr�r�rOr_�strings�
sendString�valuerLrbrcr6)rrfrgrhrj�outris       rrkz"NetstringReceiverTests.test_buffer[s���!��B�<�	7�K��-�-�/�A���A��A�L�
���Q���\�\�
 �����Q��
 ��'�'�)�C��3�s�8�{�2�Q�6�7�
&����K��1�q�5�K�*?�@����N�N�1�%�
&�
���Q�Z�Z����6�	7rc��|jjd�|j|jjdg�y)zE
        Empty netstrings (with length '0') can be received.
        s0:,rN�r�rbrcr6rs r�test_receiveEmptyNetstringz1NetstringReceiverTests.test_receiveEmptyNetstringms6��	
���+�+�F�3�����/�/�8�8�3�%�@rc��|jjd�|j|jjdg�y)z;
        One-character netstrings can be received.
        �1:a,rZNr�rs r�test_receiveOneCharacterz/NetstringReceiverTests.test_receiveOneCharacterts6��	
���+�+�G�4�����/�/�8�8�4�&�Arc��|jjd�|j|jjdg�y)z;
        Two-character netstrings can be received.
        s2:ab,�abNr�rs r�test_receiveTwoCharactersz0NetstringReceiverTests.test_receiveTwoCharacters{s6��	
���+�+�H�5�����/�/�8�8�5�'�Brc��|jjd�|j|jjdg�y)z�
        Netstrings with embedded netstrings. This test makes sure that
        the parser does not become confused about the ',' and ':'
        characters appearing inside the data portion of the netstring.
        s4:1:a,,rNr�rs r�test_receiveNestedNetstringz2NetstringReceiverTests.test_receiveNestedNetstring�s6��	
���+�+�J�7�����/�/�8�8�7�)�Drc��|jjd�|j|jj�y)zL
        Netstrings containing more data than expected are refused.
        s2:aaa,N�r�rbr�rGr�rs r�test_moreDataThanSpecifiedz1NetstringReceiverTests.test_moreDataThanSpecified�s.��	
���+�+�I�6�������4�4�5rc��|jjd�|j|jj�y)z�
        Netstrings that should be empty according to their length
        specification are refused if they contain data.
        s0:a,Nr	rs r�$test_moreDataThanSpecifiedBorderCasez;NetstringReceiverTests.test_moreDataThanSpecifiedBorderCase��.��
	
���+�+�G�4�������4�4�5rc��|jjd�|j|jj�y)z`
        Netstrings without leading digits that specify the length
        are refused.
        s:aaa,Nr	rs r�test_missingNumberz)NetstringReceiverTests.test_missingNumber��.��
	
���+�+�H�5�������4�4�5rc��|jjd�|j|jj�y)zg
        Netstrings without a colon between length specification and
        data are refused.
        s3aaa,Nr	rs r�test_missingColonz(NetstringReceiverTests.test_missingColon�rrc��|jjd�|j|jj�y)zY
        Netstrings that have no leading digits nor a colon are
        refused.
        saaa,Nr	rs r�test_missingNumberAndColonz1NetstringReceiverTests.test_missingNumberAndColon�r
rc��|jjd�|j|jj�y)zA
        Netstrings consisting only of data are refused.
        saaaNr	rs r�
test_onlyDataz$NetstringReceiverTests.test_onlyData�s.��	
���+�+�F�3�������4�4�5rc��|jjd�|jjd�|j|jjdg�|j	|jj��y)z=
        Netstrings can be received in two portions.
        s4:aasaa,saaaaN)r�rbrcr6r��_payloadCompleters r�test_receiveNetstringPortions_1z6NetstringReceiverTests.test_receiveNetstringPortions_1�se��	
���+�+�G�4����+�+�F�3�����/�/�8�8�7�)�D�����.�.�?�?�A�Brc��dD]}|jj|��|j|jjdg�y)z�
        Netstrings can be received in more than two portions, even if
        the length specification is split across two portions.
        )�1s0:01234s56789�,rXNr��r�parts  r�test_receiveNetstringPortions_2z6NetstringReceiverTests.test_receiveNetstringPortions_2�sE��
7�	6�D��"�"�/�/��5�	6�����/�/�8�8�=�/�Jrc��dD]}|jj|��|j|jjdg�y)zE
        Netstrings can be received one character at a time.
        )�2�:rZ�brrNr�rs  r�test_receiveNetstringPortions_3z6NetstringReceiverTests.test_receiveNetstringPortions_3�sE��3�	6�D��"�"�/�/��5�	6�����/�/�8�8�5�'�Brc�`�|jjd�|j|jj��|j	|jj
dg�|jjd�|j	|jj
ddg�y)z�
        A stream of two netstrings can be received in two portions,
        where the first portion contains the complete first netstring
        and the length specification of the second netstring.
        s1:a,1rZs:b,r#N)r�rbr�rrcr6rs r�test_receiveTwoNetstringsz0NetstringReceiverTests.test_receiveTwoNetstrings�s���	
���+�+�H�5�����.�.�?�?�A�B�����/�/�8�8�4�&�A����+�+�F�3�����/�/�8�8�4��,�Grc���|jjdz}|jjdjt	|�dd|zf��|j|jj�y)zs
        Netstrings with a length specification exceeding the specified
        C{MAX_LENGTH} are refused.
        r#rr"rZN)r�rOrbr�r�r�rGr�)r�tooLongs  r�test_maxReceiveLimitz+NetstringReceiverTests.test_maxReceiveLimit�sa��
�(�(�3�3�a�7�����+�+��H�H�e�G�n�d�D�7�N�;�<�	
�	
������4�4�5rc��d|j_|jj�|j|jjd�y)zw
        C{_consumeLength} returns the expected length of the
        netstring, including the trailing comma.
        �12:�
N)r��_remainingData�_consumeLengthrc�_expectedPayloadSizers r�test_consumeLengthz)NetstringReceiverTests.test_consumeLength�s@��
17����-����-�-�/�����/�/�D�D�b�Irc���d|j_d|j_|jj�|j	|jj
d�y)z�
        C{_consumeLength} works as expected if the length specification
        contains the value of C{MAX_LENGTH} (border case).
        r+�r,N)r�r-rOr.rcr/rs r�test_consumeLengthBorderCase1z4NetstringReceiverTests.test_consumeLengthBorderCase1�sN��
17����-�,.����)����-�-�/�����/�/�D�D�b�Irc��d|j_d|j_|jtj
|jj�y)z�
        C{_consumeLength} raises a L{basic.NetstringParseError} if
        the length specification exceeds the value of C{MAX_LENGTH}
        by 1 (border case).
        r+�N�r�r-rOr�r�NetstringParseErrorr.rs r�test_consumeLengthBorderCase2z4NetstringReceiverTests.test_consumeLengthBorderCase2�sE��17����-�,.����)�����%�%�t�'=�'=�'L�'L�	
rc��d|j_d|j_|jtj
|jj�y)z�
        C{_consumeLength} raises a L{basic.NetstringParseError} if
        the length specification exceeds the value of C{MAX_LENGTH}
        by more than 1.
        s1000:r5Nr6rs r�test_consumeLengthBorderCase3z4NetstringReceiverTests.test_consumeLengthBorderCase3	sE��19����-�,.����)�����%�%�t�'=�'=�'L�'L�	
rc�n�tj�}|jt|jd�y)z�
        When L{NetstringReceiver.stringReceived} is not overridden in a
        subclass, calling it raises C{NotImplementedError}.
        r�N)r�NetstringReceiverr�r�r�r�s  r�!test_stringReceivedNotImplementedz8NetstringReceiverTests.test_stringReceivedNotImplementeds+��
�'�'�)�����-�u�/C�/C�U�KrN)r(r)r*r+r�r�r�rr�rkr�rrrr
rrrrrrrr$r&r)r0r3r8r:r=r-rrr�r�Fs����U�G��N��H�>�
7�$A�B�C�E�6�6�6�6�6�6�C�K�C�
H�	6�J�J�

�

�Lrr�c��eZdZUdZdZded<dZeee	ed<dZ
eee	ed<dZeee	ed<d�Zd	�Z
d
�Zd�Zd�Zd
�Zy)�IntNTestCaseMixinz4
    TestCase mixin for int-prefixed protocols.
    Nr�rr�r��partialStringsc	�(�|j�}|jD]M}ttj|j
t
|��|z�D]}|j|���O|j|j|j�y)z>
        Test receiving data find the same data send.
        N)
r�r�r
�struct�pack�structFormatrLrbrcr6)rr�rjr�s    r�test_receivezIntNTestCaseMixin.test_receive(sw��
��������	"�A��v�{�{�1�>�>�3�q�6�B�Q�F�G�
"�����q�!�
"�	"�	
������T�\�\�2rc��|jD]O}|j�}t|�D]}|j|��|j	|j
g��Qy)zK
        Send partial data, nothing should be definitely received.
        N)r@r�r
rbrcr6r�s    r�test_partialzIntNTestCaseMixin.test_partial2sZ���$�$�	-�A�� � �"�A��q�\�
"�����q�!�
"����Q�Z�Z��,�		-rc���|j�}|jd�|j|jj	�tj|jd�dz�y)z2
        Test sending data over protocol.
        �bbbbbbbbbbbbbbbb�N)r�r�rcrGr�rBrCrD�rr�s  r�	test_sendzIntNTestCaseMixin.test_send<sR��
�����	���Y�����
�K�K�������Q�^�^�R�!@�9�!L�	
rc���g}|j�}|j|_d|_|j	tj|jd��|j|dg�y)z�
        When a length prefix is received which is greater than the protocol's
        C{MAX_LENGTH} attribute, the C{lengthLimitExceeded} method is called
        with the received length prefix.
        r\r5N)	r�r�lengthLimitExceededrOrbrBrCrDrc)rrEr�s   r�test_lengthLimitExceededz*IntNTestCaseMixin.test_lengthLimitExceededFsW��������� &�
�
������	���v�{�{�1�>�>�2�6�7�����"��&rc���|j�}d|_|jtj|j
d�dz�|j
|jg�y)z�
        If a length prefix for a string longer than C{MAX_LENGTH} is delivered
        to C{dataReceived} at the same time as the entire string, the string is
        not passed to C{stringReceived}.
        r\r5sxxxxxxxxxxxN)r�rOrbrBrCrDrcr6rKs  r�test_longStringNotDeliveredz-IntNTestCaseMixin.test_longStringNotDeliveredSsM��
��������	���v�{�{�1�>�>�2�6��B�C�������R�(rc�n�tj�}|jt|jd�y)z�
        When L{IntNStringReceiver.stringReceived} is not overridden in a
        subclass, calling it raises C{NotImplementedError}.
        r�N)r�IntNStringReceiverr�r�r�r�s  rr=z3IntNTestCaseMixin.test_stringReceivedNotImplemented^s+��
�(�(�*�����-�u�/C�/C�U�Kr)r(r)r*r+rr�r�rrr�r�r@rErGrLrOrQr=r-rrr?r?sl���59�H�1�8�%)�G�X�d�5�k�
"�)�,0�N�H�T�%�[�)�0�,0�N�H�T�%�[�)�0�3�-�
�'�	)�Lrr?c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�RecvdAttributeMixinz�
    Mixin defining tests for string receiving protocols with a C{recvd}
    attribute which should be settable by application code, to be combined with
    L{IntNTestCaseMixin} on a L{TestCase} subclass
    c�Z�tj|jt|��|zS)zg
        Return C{data} prefixed with message length in C{protocol.structFormat}
        form.
        )rBrCrDrL)rrr&s   r�makeMessagezRecvdAttributeMixin.makeMessagens$��
�{�{�8�0�0�#�d�)�<�t�C�Crc� ���g�|j����fd�}|�_tj�jd�dz}tj�jd�dz}�j||z�|j
�|g�y)z�
        In stringReceived, recvd contains the remaining data that was passed to
        dataReceived that was not part of the current message.
        c�<���j�j�yr�r�recvd)�receivedStringr��results ��rr�zKRecvdAttributeMixin.test_recvdContainsRemainingData.<locals>.stringReceived}s����M�M�!�'�'�"r��aaaaasbbbbN)r�r�rBrCrDrbrc)rr��completeMessage�incompleteMessager�r]s    @@r�test_recvdContainsRemainingDataz3RecvdAttributeMixin.test_recvdContainsRemainingDataus����
�������	#�*��� �+�+�a�n�n�a�8�H�E��"�K�K�����:�h�G��	����):�:�;�����"3�!4�5rc����	�|j��g�	d}|j�|�����	fd�}|�_d}d}|j�|�}|j�|�}�j||z�|j	�	||g�y)z�
        In stringReceived, if recvd is changed, messages should be parsed from
        it rather than the input to dataReceived.
        scccccc�:���s��_�j|�yr)r[r)r\�messageCr�r]s ���rr�z=RecvdAttributeMixin.test_recvdChanged.<locals>.stringReceived�s����"����M�M�.�)rr_sbbbbbN)r�rWr�rbrc)
r�payloadCr��payloadA�payloadB�messageA�messageBrer�r]s
       @@@r�test_recvdChangedz%RecvdAttributeMixin.test_recvdChanged�s����

����������#�#�A�x�0��	*�
*��������#�#�A�x�0���#�#�A�x�0��	���x�(�*�+�����(�H�!5�6rc�����|j��g}d�|jD]4}|j|j�|��|j���6g����fd�}|�_�jdj
|���jd�|j�|j�|j�jd�y)z�
        Data already parsed by L{IntNStringReceiver.dataReceived} is not
        reparsed if C{stringReceived} consumes some of the
        L{IntNStringReceiver.recvd} buffer.
        sc�b���j|��jt��d�_yr)rr[rL)r\�SWITCHr�r]s ���rr�z:RecvdAttributeMixin.test_switching.<locals>.stringReceived�s%����M�M�.�)��+�+�c�&�k�m�4�E�Krr�N)	r�r�rrWr�rbr�rcr[)r�mixrjr�rnr�r]s    @@@r�test_switchingz"RecvdAttributeMixin.test_switching�s����� � �"����$�����	�A��J�J�t�'�'��q�1�2��J�J�v��	���	5� .���
���3�8�8�C�=�)�	���7�#��������.�������g�.rc����|j��d}t|�dz
�_|j�|�}g���fd�}|�_�j|�|j
�dt|��|j
�d|�y)z�
        The L{IntNStringReceiver.recvd} buffer contains all data not yet
        processed by L{IntNStringReceiver.dataReceived} if the
        C{lengthLimitExceeded} event occurs.
        stoo longr#c�^���j|��j�j�yrrZ)rEr�r]s ��rrNzPRecvdAttributeMixin.test_recvdInLengthLimitExceeded.<locals>.lengthLimitExceeded�s����M�M�&�!��M�M�%�+�+�&rrN)r�rLrOrWrNrbrc)r�DATA�messagerNr�r]s    @@r�test_recvdInLengthLimitExceededz3RecvdAttributeMixin.test_recvdInLengthLimitExceeded�s����� � �"�����t�9�q�=����"�"�5�$�/����	'�%8��!�
���7�#�������C��I�.�������G�,rN)	r(r)r*r+rWrbrkrqrvr-rrrUrUgs!���D�6�$7�./�8-rrUc��eZdZdZy)�	TestInt32z�
    A L{basic.Int32StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    N�r(r)r*r+r-rrrxrx����rrxc�0�eZdZdZeZddgZdgZgd�Zd�Z	y)�
Int32Testsz/
    Test case for int32-prefixed protocol
    rZrIs
aaaaaa)s�hello thererc��|j�}|jd�|j|jj	�d�|jd�|j|jdg�y)z?
        Test specific behavior of the 32-bits length.
        r�sfoosubar�ubarN�r�r�rcrGr�rbr6rKs  r�	test_datazInt32Tests.test_data�s_��
�����	���V��������*�*�,�.D�E�	���.�/�������g�Y�/rN)
r(r)r*r+rxrr�r�r@r�r-rrr|r|�s*����H��Y��G�/�0�N�;�N�0rr|c��eZdZdZy)�	TestInt16z�
    A L{basic.Int16StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    Nryr-rrr�r��rzrr�c�6�eZdZdZeZddgZdgZgd�Zd�Z	d�Z
y)	�
Int16Testsz/
    Test case for int16-prefixed protocol
    rZrIsaaaaaa)�r}rc��|j�}|jd�|j|jj	�d�|jd�|j|jdg�y)z?
        Test specific behavior of the 16-bits length.
        r�sfoosubarrNr�rKs  rr�zInt16Tests.test_datas]��
�����	���V��������*�*�,�n�=�	����'�������g�Y�/rc��|j�}dd|jdzzdzz}|jt|j|�y�zA
        Send too much data: that should cause an error.
        r#r��r#N�r��prefixLengthr��AssertionErrorr��rr��tooSends   r�test_tooLongSendzInt16Tests.test_tooLongSend
�E��
������!����� 2�3�a�7�8�����.�!�,�,��@rN)r(r)r*r+r�rr�r�r@r�r�r-rrr�r��s0����H��Y��G�'�(�N�3�N�0�Arr�c��eZdZdZy)�TestInt8z�
    A L{basic.Int8StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    Nryr-rrr�r�rzrr�c�6�eZdZdZeZddgZdgZgd�Zd�Z	d�Z
y)	�	Int8Testsz.
    Test case for int8-prefixed protocol
    rZrIsaaaaaa)�sdzadzrc��|j�}|jd�|j|jj	�d�|jd�|j|jdg�y)z>
        Test specific behavior of the 8-bits length.
        r�sfoosubarrNr�rKs  rr�zInt8Tests.test_data%s]��
�����	���V��������*�*�,�j�9�	���{�#�������g�Y�/rc��|j�}dd|jdzzdzz}|jt|j|�yr�r�r�s   rr�zInt8Tests.test_tooLongSend/r�rN)r(r)r*r+r�rr�r�r@r�r�r-rrr�r�s0����H��Y��G�'�(�N�-�N�0�Arr�c�0�eZdZdZdZdZd�Zd�Zd�Zd�Z	y)�OnlyProducerTransportzm
    Transport which isn't really a transport, just looks like one to
    someone not looking very hard.
    Fc��g|_yrr�rs rrzOnlyProducerTransport.__init__As	����	rc��d|_y)NT��pausedrs rr@z$OnlyProducerTransport.pauseProducingDs	����rc��d|_y)NFr�rs rrBz%OnlyProducerTransport.resumeProducingGs	����rc�:�|jj|�yr)r&r)rr�s  rr�zOnlyProducerTransport.writeJs���	�	����rN)
r(r)r*r+r�r�rr@rBr�r-rrr�r�8s'���
�F��M���� rr�c��eZdZdZd�Zy)�ConsumingProtocolzC
    Protocol that really, really doesn't want any more bytes.
    c�Z�|jj|�|j�yr)rGr�r@rs  rr!zConsumingProtocol.lineReceivedSs �������T�"����rN)r(r)r*r+r!r-rrr�r�Ns���rr�c��eZdZdZd�Zy)�
ProducerTestszM
    Tests for L{basic._PausableMixin} and L{basic.LineReceiver.paused}.
    c��t�}t�}|j|�|jd�|j	|j
g�|j
|j�|j
|j�|jd�|j	|j
dg�|j|j�|j|j�|j�|j	|j
dg�|j
|j�|j
|j�|jd�|j	|j
ddg�|j|j�|j|j�|j�|j	|j
gd��|j|j�|j|j�|jd�|j	|j
gd��|j|j�|j|j�|j�|j	|j
gd��|j|j�|j|j�|j�|j	|j
gd��|j
|j�|j
|j�y	)
a?
        When L{basic.LineReceiver} is paused, it doesn't deliver lines to
        L{basic.LineReceiver.lineReceived} and delivers them immediately upon
        being resumed.

        L{ConsumingProtocol} is a L{LineReceiver} that pauses itself after
        every line, and writes that line to its transport.
        shello, sworld
�hello, worldshello
world
r�)r�r�r�s	goodbye
)r�r�r�r�N)
r�r�r_rbrcr&r�r�r�rB)r�prgs   r�test_pauseResumezProducerTests.test_pauseResume]sN��
���!�#��	�����	
���z�"��������$�������"�������"�	
���|�$�������/�!2�3�������!�������!�	
����������/�!2�3�������"�������"�	
���,�-�������/�8�!<�=�������!�������!�	
����������!F�G�������!�������!�	
���~�&�������!F�G�������!�������!�	
����������!R�S�������!�������!�	
����������!R�S�������"�������"rN)r(r)r*r+r�r-rrr�r�Xs
���A#rr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�FileSenderTestsz(
    Tests for L{basic.FileSender}.
    c�j�tj�}|jtt|��y)zP
        L{basic.FileSender} implements the L{IPullProducer} interface.
        N)r�
FileSenderr�rr
)r�senders  r�test_interfacezFileSenderTests.test_interface�s%���!�!�#������Y��7�8rc��td�}tj�}tj�}|j||�|j
|j|�|j|j�y)z�
        When L{basic.FileSender.beginFileTransfer} is called, it registers
        itself with provided consumer, as a non-streaming producer.
        �Test contentN)
rrr�rr��beginFileTransferrc�producerr��	streaming)r�source�consumerr�s    r�test_producerRegisteredz'FileSenderTests.test_producerRegistered�sd��
��)�� �0�0�2���!�!�#��� � ���2�����*�*�F�3�����+�+�,rc��td�}tj�}tj�}|j||�}|j
�|j
�|j|j�|jd|j|��|jd|j��y)z�
        L{basic.FileSender} sends the content of the given file using a
        C{IConsumer} interface via C{beginFileTransfer}. It returns a
        L{Deferred} which fires with the last byte sent.
        r��tN)rrr�rr�r�rB�assertIsNoner�rc�successResultOfr��rr�r�r��ds     r�
test_transferzFileSenderTests.test_transfer�s�����)�� �0�0�2���!�!�#���$�$�V�X�6����� ���� ����(�+�+�,�����t�3�3�A�6�7�����(�.�.�*:�;rc�^�td�}tj�}tj�}d|_|j
||�}|j�|jd|j��|j�|jd|j��|j�|jd|j��|j�|jd|j|��|jd|j��y)zj
        L{basic.FileSender} reads at most C{CHUNK_SIZE} every time it resumes
        producing.
        r�r=sTestsTest conr�N)rrr�rr��
CHUNK_SIZEr�rBrcr�r�r�s     r�test_transferMultipleChunksz+FileSenderTests.test_transferMultipleChunks�s���
��)�� �0�0�2���!�!�#������$�$�V�X�6����� �����(�.�.�"2�3���� �����h�n�n�&6�7���� �����(�.�.�*:�;���� �����t�3�3�A�6�7�����(�.�.�*:�;rc�X�d�}td�}tj�}tj�}|j|||�}|j
�|j
�|jd|j|��|jd|j��y)z�
        L{basic.FileSender.beginFileTransfer} takes a C{transform} argument
        which allows to manipulate the data on the fly.
        c�"�|j�Sr)�swapcase)�chunks r�	transformz=FileSenderTests.test_transferWithTransform.<locals>.transform�s���>�>�#�#rr��TstEST CONTENTN)
rrr�rr�r�rBrcr�r�)rr�r�r�r�r�s      r�test_transferWithTransformz*FileSenderTests.test_transferWithTransform�s���	$���)�� �0�0�2���!�!�#���$�$�V�X�y�A����� ���� �����t�3�3�A�6�7�����(�.�.�*:�;rc�D�td�}tj�}tj�}|j||�}|j
�|j|�}|jt�|jdt|j��y)z�
        The C{Deferred} returned by L{basic.FileSender.beginFileTransfer} fails
        with an C{Exception} if C{stopProducing} when the transfer is not
        complete.
        r�z#Consumer asked us to stop producingN)
rrr�rr�r�rC�failureResultOf�trap�	Exceptionrc�strr�)rr�r�r�r��failures      r�test_abortedTransferz$FileSenderTests.test_abortedTransfer�s~����)�� �0�0�2���!�!�#���$�$�V�X�6�������&�&�q�)�����Y�����>��G�M�M�@R�SrN)
r(r)r*r+r�r�r�r�r�r�r-rrr�r��s&���9�
-�<�$<�.<�(Trr�);r+rBr��ior�typingrrr�zope.interface.verifyr�twisted.internetrr	�twisted.internet.interfacesr
�twisted.internet.protocolr�twisted.protocolsr�twisted.python.compatr
�twisted.python.failurer�twisted.testr�
twisted.trialrr�rr/r�rR�SynchronousTestCaserWr�r�r�r�r<r�r�r�r?rU�Int32StringReceiverrxr|�Int16StringReceiverr�r��Int8StringReceiverr�r�r�r�r��TestCaser�r-rr�<module>r�s����
�
��'�'�.�+�1�4�#�+�*�&�"�#��+�+�#�0E:��#�#�E:�P#�U�+�+�#�*uJ��4�4�uJ�p$�%�"4�"4�$�.L1�(�*F�*F�L1�^)J�H�8�8�)J�X�� �I�u�6�6� �7�7�2UL�X�9�9�?�UL�pFL��FL�Rg-�g-�T�	�5�4�4��0��-�-�/@�BU�0�*�	�5�4�4��A��-�-�/@�BU�A�:�y�%�2�2��A��,�,�.?�AT�A�: � �,��*�*��F#�H�0�0�F#�RdT�h�'�'�dTr

Zerion Mini Shell 1.0