Ë
    ojó§  ã                   ó  — d Z ddlZddlZddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZm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 ddlmZ ddlmZ  G d„ dej8                  «      Z G d„ dej8                  «      Z G d„ dej>                  «      Z  G d„ dejB                  «      Z" G d„ dej8                  «      Z# G d„ dejB                  «      Z$ G d„ dejB                  «      Z% G d„ d«      Z& G d„ de&ejN                  «      Z( G d „ d!«      Z) G d"„ d#ejB                  e)«      Z* G d$„ d%e)«      Z+ G d&„ d'«      Z, G d(„ d)e&ejZ                  «      Z. G d*„ d+ejB                  e+e,«      Z/ G d,„ d-e&ej`                  «      Z1 G d.„ d/ejB                  e+e,«      Z2 G d0„ d1e&ejf                  «      Z4 G d2„ d3ejB                  e+e,«      Z5 G d4„ d5«      Z6 G d6„ d7ej8                  «      Z7 G d8„ d9ejB                  «      Z8 G d:„ d;ejr                  «      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                   ó&   — e Zd ZdZdZd„ Zd„ Zd„ Zy)Ú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__zFlippingLineTester.__init__!   s	   € Øˆ�
ó    c                 óZ   — | j                   j                  |«       | j                  «        y)z&
        Set the mode to raw.
        N)r   ÚappendÚ
setRawMode©r   Úlines     r   ÚlineReceivedzFlippingLineTester.lineReceived$   s    € ð 	�
‰
×Ñ˜$ÔØ�‰Õr   c                 ó,   — | j                  |dd «       y)z,
        Set the mode back to line.
        é   N)ÚsetLineMode©r   Údatas     r   ÚrawDataReceivedz"FlippingLineTester.rawDataReceived+   s   € ð 	×Ñ˜˜a˜b˜Õ"r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	delimiterr   r!   r'   © r   r   r   r      s   „ ñð €Iòòó#r   r   c                   ó8   — e Zd ZdZdZdZd
d„Zd„ Zd„ Zd„ 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)r   r2   s     r   r   zLineTester.__init__B   s   € ð ˆ�
r   c                 ó   — g | _         y©z;
        Create/clean data received on connection.
        N©Úreceivedr   s    r   ÚconnectionMadezLineTester.connectionMadeH   ó   € ð ˆ�r   c                 óÄ  — | j                   j                  |«       |dk(  r| j                  «        y|dk(  r7| j                  «        | j                  j                  d| j                  «       y|dk(  rb| j                  «        | j                  «        | j                   j                  d«       | j                  j                  d| j                  «       y|dk(  r| j                  «        y|dd dk(  rt        |dd «      | _	        y|j                  d	«      r| j                  j                  | d
«       y|j                  d«      r| j                  j                  «        yy)z|
        Receive line and make some action for some tokens: pause, rawpause,
        stop, len, produce, unproduce.
        r   ó   pauser   ó   rawpauseó   stopNé   s   len ó   produceFó	   unproduce)r6   r   r   ÚpauseProducingr2   Ú	callLaterÚresumeProducingÚstopProducingÚintÚlengthÚ
startswithÚ	transportÚregisterProducerÚunregisterProducerr   s     r   r!   zLineTester.lineReceivedN   s  € ð
 	�‰×Ñ˜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×-Ñ-Õ/ð +r   c                 óú   — |d| j                    || j                   d }}| j                   t        |«      z
  | _         | j                  d   |z   | j                  d<   | j                   dk(  r| j                  |«       yy)zj
        Read raw data, until the quantity specified by a previous 'len' line is
        reached.
        Néÿÿÿÿr   )rE   Úlenr6   r$   )r   r&   Úrests      r   r'   zLineTester.rawDataReceivedg   sr   € ð
 ˜-˜DŸK™KÐ(¨$¨t¯{©{¨}Ð*=ˆdˆØ—k‘k¤C¨£IÑ-ˆŒØ ŸM™M¨"Ñ-°Ñ4ˆ�‰�bÑØ�;‰;˜!ÒØ×Ñ˜TÕ"ð r   c                 ó~   — t        |«      | j                  dz   kD  r"| j                  || j                  dz   d «       yy)z<
        Adjust line mode when long lines received.
        r#   N)rL   Ú
MAX_LENGTHr$   r   s     r   ÚlineLengthExceededzLineTester.lineLengthExceededr   s=   € ô ˆt‹9�t—‘¨Ñ*Ò*Ø×Ñ˜T $§/¡/°AÑ"5Ð"7Ð8Õ9ð +r   r   )r(   r)   r*   r+   r,   rO   r   r7   r!   r'   rP   r-   r   r   r/   r/   2   s,   „ ñ
ð €IØ€Jóòò0ò2	#ó:r   r/   c                   ó$   — e Zd ZdZdZdZd„ Zd„ Zy)ÚLineOnlyTesterz)
    A buffering line only receiver.
    r   r0   c                 ó   — g | _         yr4   r5   r   s    r   r7   zLineOnlyTester.connectionMade‚   r8   r   c                 ó:   — | j                   j                  |«       y)z%
        Save received data.
        N©r6   r   r   s     r   r!   zLineOnlyTester.lineReceivedˆ   s   € ð 	�‰×Ñ˜TÕ"r   N)r(   r)   r*   r+   r,   rO   r7   r!   r-   r   r   rR   rR   z   s   „ ñð €IØ€Jòó#r   rR   c                   ó¢   — e Zd ZdZdZg d¢Zd„ ZdZg d¢Zedgz   Z	d„ Z
d	Zg d
¢Zg d¢Zd„ ZdZg d¢Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú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)s   len 10ó
   0123456789ó   len 5s   1234
s   len 20s   foo 123s   0123456789
012345678s   len 0s   foo 5r   s   67890s   len 1ó   ac                 óš  — t        dd«      D ]¼  }t        j                  «       }t        «       }|j	                  t        j                  |«      «       t        t        | j                  «      |z  dz   «      D ]+  }| j                  ||z  |dz   |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_bufferzLineReceiverTests.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ñ	6r   s!   twiddle1
twiddle2
pause
twiddle3
)ó   twiddle1ó   twiddle2r:   ó   twiddle3c                 ó6  — t        dd«      D �]	  }t        j                  «       }t        j                  «       }t        |«      }|j                  t        j                  |«      «       t        t        | j                  «      |z  dz   «      D ]+  }| j                  ||z  |dz   |z   }|j                  |«       Œ- | j                  | j                  |j                  «       |j                  d«       | j                  | j                   |j                  «       �Œ y)zo
        Test pause inside data receiving. It uses fake clock to see if
        pausing/resuming work.
        r#   r\   r   N)r]   r   r^   r	   ÚClockr/   r_   r   r`   rL   ÚpauseBufrb   rc   ÚpauseOutput1r6   ÚadvanceÚpauseOutput2©r   rf   rg   r2   rh   ri   rj   s          r   Útest_pausingzLineReceiverTests.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×.Ñ.°·
±
Ö;ñ
	<r   s/   twiddle1
twiddle2
len 5
rawpause
12345twiddle3
)rl   rm   rY   r;   r   )rl   rm   rY   r;   s   12345rn   c                 ó6  — t        dd«      D �]	  }t        j                  «       }t        j                  «       }t        |«      }|j                  t        j                  |«      «       t        t        | j                  «      |z  dz   «      D ]+  }| j                  ||z  |dz   |z   }|j                  |«       Œ- | j                  | j                  |j                  «       |j                  d«       | j                  | j                   |j                  «       �Œ y)z7
        Test pause inside raw date receiving.
        r#   r\   r   N)r]   r   r^   r	   rp   r/   r_   r   r`   rL   ÚrawpauseBufrb   rc   ÚrawpauseOutput1r6   rs   ÚrawpauseOutput2ru   s          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·:±:Ö>ñ
	?r   s"   twiddle1
twiddle2
stop
more
stuff
)rl   rm   r<   c                 óš  — t        dd«      D ]¼  }t        j                  «       }t        «       }|j	                  t        j                  |«      «       t        t        | j                  «      |z  dz   «      D ]+  }| j                  ||z  |dz   |z   }|j                  |«       Œ- | j                  | j                  |j                  «       Œ¾ y)z-
        Test stop inside producing.
        r#   r\   N)r]   r   r^   r/   r_   r   r`   rL   Ústop_bufrb   rc   Ústop_outputr6   re   s         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Õ:ñ	;r   c                 óæ   — t        «       }t        j                  «       }|j                  t	        j
                  |«      «       |j                  d«       | j                  |j                  g d¢«       y)z6
        Test produce/unproduce in receiving.
        s&   produce
hello world
unproduce
goodbye
)r>   s   hello worldr?   ó   goodbyeN)	r/   r   r^   r_   r   r`   rb   rc   r6   )r   rh   rg   s      r   Útest_lineReceiverAsProducerz-LineReceiverTests.test_lineReceiverAsProducer  sW   € ô ‹LˆÜ×0Ñ0Ó2ˆØ	×Ñœ×-Ñ-¨aÓ0Ô1Ø	�‰ÐDÔEØ×ÑØ�J‰JÒNõ	
r   c                 ól  —  G d„ dt         j                  «      } |«       } |j                  d«       | j                  |j                  d«       | j                  |j
                  d«        |j                  d«       | j                  |j                  d«       | 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                   ó   — e Zd Zd„ Zy)ú@LineReceiverTests.test_clearLineBuffer.<locals>.ClearingReceiverc                 ó<   — || _         | j                  «       | _        y r   )r    ÚclearLineBufferrM   r   s     r   r!   zMLineReceiverTests.test_clearLineBuffer.<locals>.ClearingReceiver.lineReceived  s   € Ø �”	Ø ×0Ñ0Ó2�•	r   N)r(   r)   r*   r!   r-   r   r   ÚClearingReceiverr…     s   „ ó3r   rˆ   s   foo
bar
bazó   foos   bar
bazs   quux
s   quuxr   N)r   ÚLineReceiverrb   rc   r    rM   )r   rˆ   r   s      r   Útest_clearLineBufferz&LineReceiverTests.test_clearLineBuffer  s‘   € ô	3œu×1Ñ1ô 	3ñ
 $Ó%ˆØˆ×ÑÐ2Ô3Ø×Ñ˜Ÿ™¨Ô/Ø×Ñ˜Ÿ™¨Ô6ð 	ˆ×Ñ˜kÔ*Ø×Ñ˜Ÿ™¨Ô0Ø×Ñ˜Ÿ™¨Õ,r   c                 ó4  — t        «       }t        j                  «       }|j                  t	        j
                  |«      «       t        j                  «       }|j                  d|z  «       | j                  d|z  dj                  |j                  «      «       y)zC
        Test switching modes many times on the same data.
        s   x
xó   xr   N)r   r   r^   r_   r   r`   ÚsysÚgetrecursionlimitrb   rc   Újoinr   )r   ÚprotorG   Úlimits       r   Útest_stackRecursionz%LineReceiverTests.test_stackRecursion*  st   € ô #Ó$ˆÜ!×8Ñ8Ó:ˆ	Ø×ÑœX×1Ñ1°)Ó<Ô=Ü×%Ñ%Ó'ˆØ×Ñ˜7 U™?Ô+Ø×Ñ˜ ™ s§x¡x°·±Ó'<Õ=r   c                 óô   — t        j                  «       }t        j                  «       }|j	                  |«       |j                  d|j                  dz   z  dz   «       | 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_   rb   rO   Ú
assertTrueÚdisconnecting©r   r‘   rG   s      r   Útest_maximumLineLengthz(LineReceiverTests.test_maximumLineLength5  óc   € ô
 ×"Ñ"Ó$ˆÜ!×1Ñ1Ó3ˆ	Ø×Ñ˜YÔ'Ø×Ñ˜4 5×#3Ñ#3°aÑ#7Ñ8¸8ÑCÔDØ�‰˜	×/Ñ/Õ0r   c                 óò  — t        «       }d|_        t        j                  «       }|j	                  |«       d|j                  dz
  z  }|j                  |«       |j                  |j                  dd «       |j                  |j                  dd |z   «       | j                  |j                  «       | j                  t        |j                  «      d«       | j                  ||j                  d   «       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#   NrK   r   )r/   rO   r   r˜   r_   rb   r,   ÚassertFalserš   rc   rL   r6   )r   r‘   rg   r    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Õ1r   c                 óB  — t        j                  «       }d|_        t        j                  «       }|j                  |«       |j                  d|j                  z  |j                  dt        |j                  «      dz
   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,   r   r˜   r_   rb   rO   rL   rŸ   rš   r›   s      r   Ú(test_notQuiteMaximumLineLengthUnfinishedz:LineReceiverTests.test_notQuiteMaximumLineLengthUnfinishedV  s‰   € ô ×"Ñ"Ó$ˆð "ˆŒÜ!×1Ñ1Ó3ˆ	Ø×Ñ˜YÔ'Ø×ÑØ�E×$Ñ$Ñ$¨¯©Ð8R¼#¸e¿o¹oÓ:NÐQRÑ:RÐ(SÑSô	
ð 	×Ñ˜×0Ñ0Õ1r   c                 óô   — t        j                  «       }d„ |_        t        j                  «       }|j                  |«       |j                  «        |j                  d«      }| j                  |t        «       y)zf
        C{LineReceiver.dataReceived} forwards errors returned by
        C{rawDataReceived}.
        c                 ó   — t        d«      S )NÚoops)ÚRuntimeError©r&   s    r   ú<lambda>z5LineReceiverTests.test_rawDataError.<locals>.<lambda>o  s   € ¬\¸&Ó-A€ r   s   dataN)
r   rŠ   r'   r   r˜   r_   r   rb   ÚassertIsInstancer¦   )r   r‘   rG   Úwhys       r   Útest_rawDataErrorz#LineReceiverTests.test_rawDataErrori  sb   € ô
 ×"Ñ"Ó$ˆÙ AˆÔÜ!×1Ñ1Ó3ˆ	Ø×Ñ˜YÔ'Ø×ÑÔØ× Ñ  Ó)ˆØ×Ñ˜c¤<Õ0r   c                 ón   — t        j                  «       }| j                  t        |j                  d«       y)z‰
        When L{LineReceiver.rawDataReceived} is not overridden in a
        subclass, calling it raises C{NotImplementedError}.
        ÚfooN)r   rŠ   ÚassertRaisesÚNotImplementedErrorr'   ©r   r‘   s     r   Ú"test_rawDataReceivedNotImplementedz4LineReceiverTests.test_rawDataReceivedNotImplementedv  s+   € ô
 ×"Ñ"Ó$ˆØ×ÑÔ-¨u×/DÑ/DÀeÕLr   c                 ón   — t        j                  «       }| j                  t        |j                  d«       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ÕIr   N)r(   r)   r*   r+   ra   rd   rk   rq   rr   rt   rv   rx   ry   rz   r{   r}   r~   r   r‚   r‹   r“   rœ   r    r¢   r«   r±   r³   r-   r   r   rW   rW   �   s�   „ ñð
€Fò$€Fò 6ð 8€Hâ7€LØ ; -Ñ/€Lò<ð" J€KâL€Oò€Oò?ð  :€Hâ5€Kò;ò

ò-ò,	>ò	1ò2ò,2ò&1òMóJr   rW   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)ÚExcessivelyLargeLineCatcherz®
    Helper for L{LineReceiverLineLengthExceededTests}.

    @ivar longLines: A L{list} of L{bytes} giving the values
        C{lineLengthExceeded} has been called with.
    c                 ó   — g | _         y r   )Ú	longLinesr   s    r   r7   z*ExcessivelyLargeLineCatcher.connectionMade�  s	   € Øˆ�r   c                  ó   — y)z/
        Disregard any received lines.
        Nr-   r   s     r   r!   z(ExcessivelyLargeLineCatcher.lineReceived’  s   � r   c                 ó:   — | j                   j                  |«       y)zF
        Record any data that exceeds the line length limits.
        N)r·   r   r%   s     r   rP   z.ExcessivelyLargeLineCatcher.lineLengthExceeded—  s   € ð 	�‰×Ñ˜dÕ#r   N)r(   r)   r*   r+   r7   r!   rP   r-   r   r   rµ   rµ   ‡  s   „ ñòòó
$r   rµ   c                   ó:   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
Ú#LineReceiverLineLengthExceededTestszO
    Tests for L{twisted.protocols.basic.LineReceiver.lineLengthExceeded}.
    c                 óÀ   — t        «       | _        d| j                  _        t        j                  «       | _        | j                  j                  | j
                  «       y )Né   )rµ   r‘   rO   r   r˜   rG   r_   r   s    r   ÚsetUpz)LineReceiverLineLengthExceededTests.setUp£  s>   € Ü0Ó2ˆŒ
Ø !ˆ�
‰
ÔÜ&×6Ñ6Ó8ˆŒØ�
‰
×!Ñ! $§.¡.Õ1r   c                 óÆ   — d| j                   j                  dz  dz   z  }| j                   j                  |«       | j                  |g| j                   j                  «       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‘   rO   rb   rc   r·   ©r   Ú	excessives     r   Útest_longUnendedLinez8LineReceiverLineLengthExceededTests.test_longUnendedLine©  sP   € ð ˜DŸJ™J×1Ñ1°AÑ5¸Ñ9Ñ:ˆ	Ø�
‰
×Ñ 	Ô*Ø×Ñ˜)˜ d§j¡j×&:Ñ&:Õ;r   c                 óú   — d| j                   j                  dz  dz   z  }| j                   j                  d| j                   j                  z   |z   «       | j	                  |g| j                   j
                  «       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‘   rO   rb   r,   rc   r·   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×&:Ñ&:Õ;r   c                 ó  — | j                   j                  j                  d| j                   j                  dz  dz   z  gdz  «      }| j                   j	                  |«       | j                  |g| j                   j                  «       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�   rO   rb   rc   r·   rÁ   s     r   Útest_longLineWithDelimiterz>LineReceiverLineLengthExceededTests.test_longLineWithDelimiter¾  sr   € ð —J‘J×(Ñ(×-Ñ-Ø�T—Z‘Z×*Ñ*¨QÑ.°Ñ2Ñ3Ð4°qÑ8ó
ˆ	ð 	�
‰
×Ñ 	Ô*Ø×Ñ˜)˜ d§j¡j×&:Ñ&:Õ;r   c                 óú   — d| j                   j                  dz  dz   z  | j                   j                  z   dz  }| j                   j                  |«       | j	                  |g| j                   j
                  «       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‘   rO   r,   rb   rc   r·   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×&:Ñ&:Õ;r   c                 óô   — t        j                  «       }t        j                  «       }|j	                  |«       |j                  d|j                  dz   z  dz   «       | j                  |j                  «       yr•   r—   r›   s      r   rœ   z:LineReceiverLineLengthExceededTests.test_maximumLineLengthÖ  r�   r   c                 ó  — t        j                  «       }t        j                  «       }|j	                  |«       |j                  d|j                  t        |j                  «      z   z  «       | 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Š   r   r˜   r_   rb   rO   rL   r,   r™   rš   r›   s      r   Útest_maximumLineLengthRemainingzCLineReceiverLineLengthExceededTests.test_maximumLineLengthRemainingá  sg   € ô
 ×"Ñ"Ó$ˆÜ!×1Ñ1Ó3ˆ	Ø×Ñ˜YÔ'Ø×Ñ˜4 5×#3Ñ#3´c¸%¿/¹/Ó6JÑ#JÑKÔLØ�‰˜	×/Ñ/Õ0r   N)r(   r)   r*   r+   r¾   rÃ   rÅ   rÇ   rÉ   rœ   rÌ   r-   r   r   r»   r»   ž  s*   „ ñò2ò<ò	<ò<ò	<ò	1ó	1r   r»   c                   ó&   — e Zd ZdZdZd„ Zd„ Zd„ Zy)ÚLineOnlyReceiverTestsz@
    Tests for L{twisted.protocols.basic.LineOnlyReceiver}.
    s7   foo
    bleakness
    desolation
    plastic forks
    c                 ó(  — t        j                  «       }t        «       }|j                  |«       t	        | j
                  «      D ]  }|j                  |«       Œ | j                  |j                  | j
                  j                  d«      dd «       y)zW
        Test buffering over line protocol: data received should match buffer.
        r   NrK   )
r   r˜   rR   r_   r   ra   rb   rc   r6   Úsplit)r   rg   rh   Úcs       r   rk   z!LineOnlyReceiverTests.test_bufferø  sv   € ô ×)Ñ)Ó+ˆÜÓˆØ	×Ñ˜ÔÜ˜4Ÿ;™;Ó'ò 	ˆAØ�N‰N˜1Õð	à×Ñ˜Ÿ™ T§[¡[×%6Ñ%6°uÓ%=¸c¸rÐ%BÕCr   c                 ó  — t        «       }t        j                  «       }|j                  |«       |j	                  d|j
                  t        |j                  «      z   dz   z  dz   «       | 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)
rR   r   r˜   r_   rb   rO   rL   r,   r™   rš   r›   s      r   Ú!test_greaterThanMaximumLineLengthz7LineOnlyReceiverTests.test_greaterThanMaximumLineLength  sp   € ô
 Ó ˆÜ!×1Ñ1Ó3ˆ	Ø×Ñ˜YÔ'Ø×ÑØ�E×$Ñ$¤s¨5¯?©?Ó';Ñ;¸aÑ?Ñ@À8ÑKô	
ð 	�‰˜	×/Ñ/Õ0r   c                 ón   — t        j                  «       }| j                  t        |j                  d«       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     r   r³   z5LineOnlyReceiverTests.test_lineReceivedNotImplemented  s+   € ô
 ×&Ñ&Ó(ˆØ×ÑÔ-¨u×/AÑ/AÀ5ÕIr   N)r(   r)   r*   r+   ra   rk   rÓ   r³   r-   r   r   rÎ   rÎ   í  s   „ ñð€Fò	Dò1óJr   rÎ   c                   ó4   — e Zd Zd„ Zd„ ZdZdZefdeddfd„Z	y)	Ú	TestMixinc                 ó   — g | _         y r   r5   r   s    r   r7   zTestMixin.connectionMade  s	   € Øˆ�r   c                 ó:   — | j                   j                  |«       y r   rU   ©r   rj   s     r   ÚstringReceivedzTestMixin.stringReceived  s   € Ø�‰×Ñ˜QÕr   é2   r   ÚreasonÚreturnNc                 ó   — d| _         y )Nr#   )Úclosed)r   rÝ   s     r   ÚconnectionLostzTestMixin.connectionLost#  s	   € Øˆ�r   )
r(   r)   r*   r7   rÛ   rO   rà   r   r   rá   r-   r   r   r×   r×     s.   „ òò ð €JØ€Fà/=ñ  Wð À$ô r   r×   c                   ó   — e Zd Zd„ Zy)ÚTestNetstringc                 óp   — | j                   j                  |«       | j                  j                  |«       y r   )r6   r   rG   ÚwriterÚ   s     r   rÛ   zTestNetstring.stringReceived(  s&   € Ø�‰×Ñ˜QÔØ�‰×Ñ˜QÕr   N)r(   r)   r*   rÛ   r-   r   r   rã   rã   '  s   „ ó r   rã   c                   óB   — e Zd ZU g Zeee      ed<   dZded<   d„ Z	d„ Z
y)ÚLPTestCaseMixinÚillegalStringsNú!Optional[Type[protocol.Protocol]]r   c                 óp   — t        j                  «       }| j                  «       }|j                  |«       |S )z„
        Return a new instance of C{self.protocol} connected to a new instance
        of L{proto_helpers.StringTransport}.
        )r   r˜   r   r_   )r   rg   rh   s      r   ÚgetProtocolzLPTestCaseMixin.getProtocol1  s0   € ô
 ×)Ñ)Ó+ˆØ�M‰M‹OˆØ	×Ñ˜ÔØˆr   c                 óÒ   — | j                   D ]X  }| j                  «       }t        |«      D ]  }|j                  |«       Œ | j	                  |j
                  j                  «       ŒZ y)zO
        Assert that illegal strings cause the transport to be closed.
        N)rè   rë   r   rb   r™   rG   rš   ©r   rj   ÚrrÑ   s       r   Útest_illegalzLPTestCaseMixin.test_illegal;  s\   € ð ×$Ñ$ò 	7ˆAØ× Ñ Ó"ˆAÜ˜q“\ò "�Ø—‘˜qÕ!ð"à�O‰O˜AŸK™K×5Ñ5Õ6ñ		7r   )r(   r)   r*   rè   r   r   ÚbytesÚ__annotations__r   rë   rï   r-   r   r   rç   rç   -  s*   … Ø,.€N�H˜T %™[Ñ)Ó.Ø48€HÐ1Ó8òó7r   rç   c                   ó¨   — e Zd ZdZg d¢Zg d¢ZeZd„ Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚNetstringReceiverTestszA
    Tests for L{twisted.protocols.basic.NetstringReceiver}.
    )ó   helloó   worlds   hows   ares   you123s   :todays  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)s   9999999999999999999999s   abcs   4:abcdes7   51:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab,c                 óž   — t        j                  «       | _        t        «       | _        | j                  j                  | j                  «       y r   )r   r˜   rG   rã   ÚnetstringReceiverr_   r   s    r   r¾   zNetstringReceiverTests.setUpV  s4   € Ü&×6Ñ6Ó8ˆŒÜ!.£ˆÔØ×Ñ×-Ñ-¨d¯n©nÕ=r   c                 óÄ  — t        dd«      D ]Ñ  }t        j                  «       }t        «       }d|_        |j                  |«       | j                  D ]  }|j                  |«       Œ |j                  «       }t        t        |«      |z  dz   «      D ]$  }|||z  |dz   |z   }|sŒ|j                  |«       Œ& | j                  |j                  | j                  «       ŒÓ y)zI
        Strings can be received in chunks of different lengths.
        r#   r\   i»  N)r]   r   r˜   rã   rO   r_   ÚstringsÚ
sendStringÚvaluerL   rb   rc   r6   )r   rf   rg   rh   rj   Úoutri   s          r   rk   z"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ñ	7r   c                 óˆ   — | j                   j                  d«       | j                  | j                   j                  dg«       y)zE
        Empty netstrings (with length '0') can be received.
        s   0:,r   N©r÷   rb   rc   r6   r   s    r   Útest_receiveEmptyNetstringz1NetstringReceiverTests.test_receiveEmptyNetstringm  s6   € ð 	×Ñ×+Ñ+¨FÔ3Ø×Ñ˜×/Ñ/×8Ñ8¸3¸%Õ@r   c                 óˆ   — | j                   j                  d«       | j                  | j                   j                  dg«       y)z;
        One-character netstrings can be received.
        ó   1:a,rZ   Nrþ   r   s    r   Útest_receiveOneCharacterz/NetstringReceiverTests.test_receiveOneCharactert  s6   € ð 	×Ñ×+Ñ+¨GÔ4Ø×Ñ˜×/Ñ/×8Ñ8¸4¸&ÕAr   c                 óˆ   — | j                   j                  d«       | j                  | j                   j                  dg«       y)z;
        Two-character netstrings can be received.
        s   2:ab,ó   abNrþ   r   s    r   Útest_receiveTwoCharactersz0NetstringReceiverTests.test_receiveTwoCharacters{  s6   € ð 	×Ñ×+Ñ+¨HÔ5Ø×Ñ˜×/Ñ/×8Ñ8¸5¸'ÕBr   c                 óˆ   — | j                   j                  d«       | j                  | j                   j                  dg«       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.
        s   4:1:a,,r  Nrþ   r   s    r   Útest_receiveNestedNetstringz2NetstringReceiverTests.test_receiveNestedNetstring‚  s6   € ð 	×Ñ×+Ñ+¨JÔ7Ø×Ñ˜×/Ñ/×8Ñ8¸7¸)ÕDr   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)zL
        Netstrings containing more data than expected are refused.
        s   2:aaa,N©r÷   rb   r™   rG   rš   r   s    r   Útest_moreDataThanSpecifiedz1NetstringReceiverTests.test_moreDataThanSpecified‹  s.   € ð 	×Ñ×+Ñ+¨IÔ6Ø�‰˜Ÿ™×4Ñ4Õ5r   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)zƒ
        Netstrings that should be empty according to their length
        specification are refused if they contain data.
        s   0:a,Nr	  r   s    r   Ú$test_moreDataThanSpecifiedBorderCasez;NetstringReceiverTests.test_moreDataThanSpecifiedBorderCase’  ó.   € ð
 	×Ñ×+Ñ+¨GÔ4Ø�‰˜Ÿ™×4Ñ4Õ5r   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)z`
        Netstrings without leading digits that specify the length
        are refused.
        s   :aaa,Nr	  r   s    r   Útest_missingNumberz)NetstringReceiverTests.test_missingNumberš  ó.   € ð
 	×Ñ×+Ñ+¨HÔ5Ø�‰˜Ÿ™×4Ñ4Õ5r   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)zg
        Netstrings without a colon between length specification and
        data are refused.
        s   3aaa,Nr	  r   s    r   Útest_missingColonz(NetstringReceiverTests.test_missingColon¢  r  r   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)zY
        Netstrings that have no leading digits nor a colon are
        refused.
        s   aaa,Nr	  r   s    r   Útest_missingNumberAndColonz1NetstringReceiverTests.test_missingNumberAndColonª  r  r   c                 ó„   — | j                   j                  d«       | j                  | j                  j                  «       y)zA
        Netstrings consisting only of data are refused.
        s   aaaNr	  r   s    r   Útest_onlyDataz$NetstringReceiverTests.test_onlyData²  s.   € ð 	×Ñ×+Ñ+¨FÔ3Ø�‰˜Ÿ™×4Ñ4Õ5r   c                 ó  — | j                   j                  d«       | j                   j                  d«       | j                  | j                   j                  dg«       | j	                  | j                   j                  «       «       y)z=
        Netstrings can be received in two portions.
        s   4:aas   aa,s   aaaaN)r÷   rb   rc   r6   r™   Ú_payloadCompleter   s    r   Útest_receiveNetstringPortions_1z6NetstringReceiverTests.test_receiveNetstringPortions_1¹  se   € ð 	×Ñ×+Ñ+¨GÔ4Ø×Ñ×+Ñ+¨FÔ3Ø×Ñ˜×/Ñ/×8Ñ8¸7¸)ÔDØ�‰˜×.Ñ.×?Ñ?ÓAÕBr   c                 ó–   — dD ]  }| j                   j                  |«       Œ | j                  | j                   j                  dg«       y)zŽ
        Netstrings can be received in more than two portions, even if
        the length specification is split across two portions.
        )ó   1s   0:01234s   56789ó   ,rX   Nrþ   ©r   Úparts     r   Útest_receiveNetstringPortions_2z6NetstringReceiverTests.test_receiveNetstringPortions_2Â  sE   € ð
 7ò 	6ˆDØ×"Ñ"×/Ñ/°Õ5ð	6à×Ñ˜×/Ñ/×8Ñ8¸=¸/ÕJr   c                 ó–   — dD ]  }| j                   j                  |«       Œ | j                  | j                   j                  dg«       y)zE
        Netstrings can be received one character at a time.
        )ó   2ó   :rZ   ó   br  r  Nrþ   r  s     r   Útest_receiveNetstringPortions_3z6NetstringReceiverTests.test_receiveNetstringPortions_3Ë  sE   € ð 3ò 	6ˆDØ×"Ñ"×/Ñ/°Õ5ð	6à×Ñ˜×/Ñ/×8Ñ8¸5¸'ÕBr   c                 ó`  — | j                   j                  d«       | j                  | j                   j                  «       «       | j	                  | j                   j
                  dg«       | j                   j                  d«       | j	                  | j                   j
                  ddg«       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.
        s   1:a,1rZ   s   :b,r#  N)r÷   rb   r™   r  rc   r6   r   s    r   Útest_receiveTwoNetstringsz0NetstringReceiverTests.test_receiveTwoNetstringsÓ  s…   € ð 	×Ñ×+Ñ+¨HÔ5Ø�‰˜×.Ñ.×?Ñ?ÓAÔBØ×Ñ˜×/Ñ/×8Ñ8¸4¸&ÔAØ×Ñ×+Ñ+¨FÔ3Ø×Ñ˜×/Ñ/×8Ñ8¸4À¸,ÕGr   c                 óò   — | j                   j                  dz   }| j                   j                  dj                  t	        |«      dd|z  f«      «       | j                  | j                  j                  «       y)zs
        Netstrings with a length specification exceeding the specified
        C{MAX_LENGTH} are refused.
        r#   r   r"  rZ   N)r÷   rO   rb   r�   rð   r™   rG   rš   )r   ÚtooLongs     r   Útest_maxReceiveLimitz+NetstringReceiverTests.test_maxReceiveLimitß  sa   € ð
 ×(Ñ(×3Ñ3°aÑ7ˆØ×Ñ×+Ñ+Ø�H‰H”e˜G“n d¨D°7©NÐ;Ó<ô	
ð 	�‰˜Ÿ™×4Ñ4Õ5r   c                 ó¦   — d| j                   _        | j                   j                  «        | j                  | j                   j                  d«       y)zw
        C{_consumeLength} returns the expected length of the
        netstring, including the trailing comma.
        ó   12:é   N)r÷   Ú_remainingDataÚ_consumeLengthrc   Ú_expectedPayloadSizer   s    r   Útest_consumeLengthz)NetstringReceiverTests.test_consumeLengthê  s@   € ð
 17ˆ×ÑÔ-Ø×Ñ×-Ñ-Ô/Ø×Ñ˜×/Ñ/×DÑDÀbÕIr   c                 óÈ   — d| j                   _        d| j                   _        | j                   j                  «        | j	                  | j                   j
                  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-  rO   r.  rc   r/  r   s    r   Útest_consumeLengthBorderCase1z4NetstringReceiverTests.test_consumeLengthBorderCase1ó  sN   € ð
 17ˆ×ÑÔ-Ø,.ˆ×ÑÔ)Ø×Ñ×-Ñ-Ô/Ø×Ñ˜×/Ñ/×DÑDÀbÕIr   c                 ó°   — d| j                   _        d| j                   _        | j                  t        j
                  | j                   j                  «       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-  rO   r®   r   ÚNetstringParseErrorr.  r   s    r   Útest_consumeLengthBorderCase2z4NetstringReceiverTests.test_consumeLengthBorderCase2ý  sE   € ð 17ˆ×ÑÔ-Ø,.ˆ×ÑÔ)Ø×ÑÜ×%Ñ% t×'=Ñ'=×'LÑ'Lõ	
r   c                 ó°   — d| j                   _        d| j                   _        | j                  t        j
                  | j                   j                  «       y)z¨
        C{_consumeLength} raises a L{basic.NetstringParseError} if
        the length specification exceeds the value of C{MAX_LENGTH}
        by more than 1.
        s   1000:r5  Nr6  r   s    r   Útest_consumeLengthBorderCase3z4NetstringReceiverTests.test_consumeLengthBorderCase3	  sE   € ð 19ˆ×ÑÔ-Ø,.ˆ×ÑÔ)Ø×ÑÜ×%Ñ% t×'=Ñ'=×'LÑ'Lõ	
r   c                 ón   — t        j                  «       }| j                  t        |j                  d«       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_stringReceivedNotImplemented  s+   € ô
 ×'Ñ'Ó)ˆØ×ÑÔ-¨u×/CÑ/CÀUÕKr   N)r(   r)   r*   r+   rù   rè   rã   r   r¾   rk   rÿ   r  r  r  r
  r  r  r  r  r  r  r  r$  r&  r)  r0  r3  r8  r:  r=  r-   r   r   ró   ró   F  s–   „ ñò U€Gò€Nð €Hò>ò
7ò$AòBòCòEò6ò6ò6ò6ò6ò6òCòKòCò
Hò	6òJòJò

ò

óLr   ró   c                   ó’   — e Zd ZU dZdZded<   dZeee	      ed<   dZ
eee	      ed<   dZeee	      ed<   d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zy)ÚIntNTestCaseMixinz4
    TestCase mixin for int-prefixed protocols.
    Nré   r   rù   rè   ÚpartialStringsc           	      ó(  — | j                  «       }| j                  D ]M  }t        t        j                  |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ÚstructFormatrL   rb   rc   r6   )r   rî   rj   rÑ   s       r   Útest_receivezIntNTestCaseMixin.test_receive(  sw   € ð ×ÑÓˆØ—‘ò 	"ˆAÜœvŸ{™{¨1¯>©>¼3¸q»6ÓBÀQÑFÓGò "�Ø—‘˜qÕ!ñ"ð	"ð 	×Ñ˜Ÿ™ T§\¡\Õ2r   c                 óÀ   — | j                   D ]O  }| j                  «       }t        |«      D ]  }|j                  |«       Œ | j	                  |j
                  g «       ŒQ y)zK
        Send partial data, nothing should be definitely received.
        N)r@  rë   r   rb   rc   r6   rí   s       r   Útest_partialzIntNTestCaseMixin.test_partial2  sZ   € ð ×$Ñ$ò 	-ˆAØ× Ñ Ó"ˆAÜ˜q“\ò "�Ø—‘˜qÕ!ð"à×Ñ˜QŸZ™Z¨Õ,ñ		-r   c                 óÜ   — | j                  «       }|j                  d«       | j                  |j                  j	                  «       t        j                  |j                  d«      dz   «       y)z2
        Test sending data over protocol.
        ó   bbbbbbbbbbbbbbbbé   N)rë   rú   rc   rG   rû   rB  rC  rD  ©r   rî   s     r   Ú	test_sendzIntNTestCaseMixin.test_send<  sR   € ð ×ÑÓˆØ	�‰�YÔØ×ÑØ�K‰K×ÑÓ¤§¡¨Q¯^©^¸RÓ!@À9Ñ!Lõ	
r   c                 óÜ   — g }| j                  «       }|j                  |_        d|_        |j	                  t        j                  |j                  d«      «       | j                  |dg«       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\   r5  N)	rë   r   ÚlengthLimitExceededrO   rb   rB  rC  rD  rc   )r   rE   rî   s      r   Útest_lengthLimitExceededz*IntNTestCaseMixin.test_lengthLimitExceededF  sW   € ð ˆØ×ÑÓˆØ &§¡ˆÔØˆŒØ	�‰”v—{‘{ 1§>¡>°2Ó6Ô7Ø×Ñ˜ " Õ&r   c                 óÎ   — | j                  «       }d|_        |j                  t        j                  |j
                  d«      dz   «       | j                  |j                  g «       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\   r5  s   xxxxxxxxxxxN)rë   rO   rb   rB  rC  rD  rc   r6   rK  s     r   Útest_longStringNotDeliveredz-IntNTestCaseMixin.test_longStringNotDeliveredS  sM   € ð ×ÑÓˆØˆŒØ	�‰”v—{‘{ 1§>¡>°2Ó6¸ÑBÔCØ×Ñ˜Ÿ™ RÕ(r   c                 ón   — t        j                  «       }| j                  t        |j                  d«       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     r   r=  z3IntNTestCaseMixin.test_stringReceivedNotImplemented^  s+   € ô
 ×(Ñ(Ó*ˆØ×ÑÔ-¨u×/CÑ/CÀUÕKr   )r(   r)   r*   r+   r   rñ   rù   r   r   rð   rè   r@  rE  rG  rL  rO  rQ  r=  r-   r   r   r?  r?    sl   … ñð 59€HÐ1Ó8Ø%)€GˆX�d˜5‘kÑ"Ó)Ø,0€N�H˜T %™[Ñ)Ó0Ø,0€N�H˜T %™[Ñ)Ó0ò3ò-ò
ò'ò	)óLr   r?  c                   ó.   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú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   — t        j                  |j                  t        |«      «      |z   S )zg
        Return C{data} prefixed with message length in C{protocol.structFormat}
        form.
        )rB  rC  rD  rL   )r   r   r&   s      r   ÚmakeMessagezRecvdAttributeMixin.makeMessagen  s$   € ô
 �{‰{˜8×0Ñ0´#°d³)Ó<¸tÑCÐCr   c                 ó   ‡‡— g Š| j                  «       Šˆˆfd„}|‰_        t        j                  ‰j                  d«      dz   }t        j                  ‰j                  d«      dz   }‰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                  «       y r   ©r   Úrecvd)ÚreceivedStringrî   Úresults    €€r   rÛ   zKRecvdAttributeMixin.test_recvdContainsRemainingData.<locals>.stringReceived}  s   ø€ Ø�M‰M˜!Ÿ'™'Õ"r   é   ó   aaaaas   bbbbN)rë   rÛ   rB  rC  rD  rb   rc   )r   rÛ   ÚcompleteMessageÚincompleteMessagerî   r]  s       @@r   Útest_recvdContainsRemainingDataz3RecvdAttributeMixin.test_recvdContainsRemainingDatau  s€   ù€ ð
 ˆØ×ÑÓˆõ	#ð *ˆÔÜ Ÿ+™+ a§n¡n°aÓ8¸HÑEˆÜ"ŸK™K¨¯©¸Ó:¸hÑGÐà	�‰�Ð):Ñ:Ô;Ø×Ñ˜Ð"3Ð!4Õ5r   c                 ó  ‡‡‡	— | j                  «       Šg Š	d}| j                  ‰|«      Šˆˆˆ	fd„}|‰_        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.
        s   cccccc                 ó:   •— ‰s‰‰_         ‰j                  | «       y r   )r[  r   )r\  ÚmessageCrî   r]  s    €€€r   rÛ   z=RecvdAttributeMixin.test_recvdChanged.<locals>.stringReceived‘  s   ø€ ÙØ"�”Ø�M‰M˜.Õ)r   r_  s   bbbbbN)rë   rW  rÛ   rb   rc   )
r   ÚpayloadCrÛ   ÚpayloadAÚpayloadBÚmessageAÚmessageBre  rî   r]  s
          @@@r   Útest_recvdChangedz%RecvdAttributeMixin.test_recvdChanged‡  s’   ú€ ð
 ×ÑÓˆØˆØˆØ×#Ñ# A xÓ0ˆö	*ð
 *ˆÔØˆØˆØ×#Ñ# A xÓ0ˆØ×#Ñ# A xÓ0ˆØ	�‰�x (Ñ*Ô+Ø×Ñ˜ (¨HÐ!5Õ6r   c                 óª  ‡‡‡— | j                  «       Šg }dŠ| j                  D ]4  }|j                  | j                  ‰|«      «       |j                  ‰«       Œ6 g Šˆˆˆfd„}|‰_        ‰j                  dj                  |«      «       ‰j                  d«       | j                  ‰| j                  «       | j                  ‰j                  d«       y)z¹
        Data already parsed by L{IntNStringReceiver.dataReceived} is not
        reparsed if C{stringReceived} consumes some of the
        L{IntNStringReceiver.recvd} buffer.
        s       c                 ób   •— ‰j                  | «       ‰j                  t        ‰«      d  ‰_        y r   )r   r[  rL   )r\  ÚSWITCHr‘   r]  s    €€€r   rÛ   z:RecvdAttributeMixin.test_switching.<locals>.stringReceived­  s%   ø€ Ø�M‰M˜.Ô)ØŸ+™+¤c¨&£k mÐ4ˆE�Kr   r   ó   N)	rë   rù   r   rW  rÛ   rb   r�   rc   r[  )r   Úmixrj   rÛ   rn  r‘   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Õ.r   c                 ó  ‡‡— | j                  «       Šd}t        |«      dz
  ‰_        | j                  ‰|«      }g Šˆˆfd„}|‰_        ‰j                  |«       | j                  ‰d   t        |«      «       | 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.
        s   too longr#   c                 ó^   •— ‰j                  | «       ‰j                  ‰j                  «       y r   rZ  )rE   r‘   r]  s    €€r   rN  zPRecvdAttributeMixin.test_recvdInLengthLimitExceeded.<locals>.lengthLimitExceededÇ  s   ø€ Ø�M‰M˜&Ô!Ø�M‰M˜%Ÿ+™+Õ&r   r   N)rë   rL   rO   rW  rN  rb   rc   )r   ÚDATAÚmessagerN  r‘   r]  s       @@r   Útest_recvdInLengthLimitExceededz3RecvdAttributeMixin.test_recvdInLengthLimitExceededº  sˆ   ù€ ð × Ñ Ó"ˆØˆÜ˜t›9 q™=ˆÔØ×"Ñ" 5¨$Ó/ˆàˆõ	'ð %8ˆÔ!Ø×Ñ˜7Ô#Ø×Ñ˜ ™¤C¨£IÔ.Ø×Ñ˜ ™ GÕ,r   N)	r(   r)   r*   r+   rW  rb  rk  rq  rv  r-   r   r   rU  rU  g  s!   „ ñòDò6ò$7ò./ó8-r   rU  c                   ó   — e Zd ZdZy)Ú	TestInt32zƒ
    A L{basic.Int32StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    N©r(   r)   r*   r+   r-   r   r   rx  rx  Ñ  ó   „ òr   rx  c                   ó0   — e Zd ZdZeZddgZdgZg d¢Zd„ Z	y)Ú
Int32Testsz/
    Test case for int32-prefixed protocol
    rZ   rI  s
      aaaaaa)s      ó   hello therer   c                 óö   — | j                  «       }|j                  d«       | j                  |j                  j	                  «       d«       |j                  d«       | j                  |j                  dg«       y)z?
        Test specific behavior of the 32-bits length.
        r‰   s      foos      ubaró   ubarN©rë   rú   rc   rG   rû   rb   r6   rK  s     r   Ú	test_datazInt32Tests.test_dataã  s_   € ð ×ÑÓˆØ	�‰�VÔØ×Ñ˜Ÿ™×*Ñ*Ó,Ð.DÔEØ	�‰Ð.Ô/Ø×Ñ˜Ÿ™ g YÕ/r   N)
r(   r)   r*   r+   rx  r   rù   rè   r@  r�  r-   r   r   r|  r|  Ù  s*   „ ñð €HØ�YÐ€GØ/Ð0€NÚ;€Nó0r   r|  c                   ó   — e Zd ZdZy)Ú	TestInt16zƒ
    A L{basic.Int16StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    Nry  r-   r   r   rƒ  rƒ  î  rz  r   rƒ  c                   ó6   — e Zd ZdZeZddgZdgZg d¢Zd„ Z	d„ Z
y)	Ú
Int16Testsz/
    Test case for int16-prefixed protocol
    rZ   rI  s    aaaaaa)ó    r}  r   c                 óö   — | j                  «       }|j                  d«       | j                  |j                  j	                  «       d«       |j                  d«       | j                  |j                  dg«       y)z?
        Test specific behavior of the 16-bits length.
        r‰   s    foos    ubarr  Nr€  rK  s     r   r�  zInt16Tests.test_data   s]   € ð ×ÑÓˆØ	�‰�VÔØ×Ñ˜Ÿ™×*Ñ*Ó,¨nÔ=Ø	�‰�Ô'Ø×Ñ˜Ÿ™ g YÕ/r   c                 ó–   — | j                  «       }dd|j                  dz  z  dz   z  }| j                  t        |j                  |«       y©zA
        Send too much data: that should cause an error.
        r#  rÀ   é   r#   N©rë   ÚprefixLengthr®   ÚAssertionErrorrú   ©r   rî   ÚtooSends      r   Útest_tooLongSendzInt16Tests.test_tooLongSend
  óE   € ð ×ÑÓˆØ˜! §¡°Ñ 2Ñ3°aÑ7Ñ8ˆØ×Ñœ.¨!¯,©,¸Õ@r   N)r(   r)   r*   r+   rƒ  r   rù   rè   r@  r�  r�  r-   r   r   r…  r…  ö  s0   „ ñð €HØ�YÐ€GØ'Ð(€NÚ3€Nò0óAr   r…  c                   ó   — e Zd ZdZy)ÚTestInt8z‚
    A L{basic.Int8StringReceiver} storing received strings in an array.

    @ivar received: array holding received strings.
    Nry  r-   r   r   r“  r“    rz  r   r“  c                   ó6   — e Zd ZdZeZddgZdgZg d¢Zd„ Z	d„ Z
y)	Ú	Int8Testsz.
    Test case for int8-prefixed protocol
    rZ   rI  s     aaaaaa)ó   s   dzadzr   c                 óö   — | j                  «       }|j                  d«       | j                  |j                  j	                  «       d«       |j                  d«       | j                  |j                  dg«       y)z>
        Test specific behavior of the 8-bits length.
        r‰   s   foos   ubarr  Nr€  rK  s     r   r�  zInt8Tests.test_data%  s]   € ð ×ÑÓˆØ	�‰�VÔØ×Ñ˜Ÿ™×*Ñ*Ó,¨jÔ9Ø	�‰�{Ô#Ø×Ñ˜Ÿ™ g YÕ/r   c                 ó–   — | j                  «       }dd|j                  dz  z  dz   z  }| j                  t        |j                  |«       yr‰  r‹  rŽ  s      r   r�  zInt8Tests.test_tooLongSend/  r‘  r   N)r(   r)   r*   r+   r“  r   rù   rè   r@  r�  r�  r-   r   r   r•  r•    s0   „ ñð €HØ�YÐ€GØ'Ð(€NÚ-€Nò0óAr   r•  c                   ó0   — e Zd ZdZdZdZd„ Zd„ Zd„ Zd„ Z	y)ÚOnlyProducerTransportzm
    Transport which isn't really a transport, just looks like one to
    someone not looking very hard.
    Fc                 ó   — g | _         y r   r§   r   s    r   r   zOnlyProducerTransport.__init__A  s	   € Øˆ�	r   c                 ó   — d| _         y )NT©Úpausedr   s    r   r@   z$OnlyProducerTransport.pauseProducingD  s	   € Øˆ�r   c                 ó   — d| _         y )NFr�  r   s    r   rB   z%OnlyProducerTransport.resumeProducingG  s	   € Øˆ�r   c                 ó:   — | j                   j                  |«       y r   )r&   r   )r   rð   s     r   rå   zOnlyProducerTransport.writeJ  s   € Ø�	‰	×Ñ˜Õr   N)
r(   r)   r*   r+   rž  rš   r   r@   rB   rå   r-   r   r   rš  rš  8  s'   „ ñð
 €FØ€Mòòòó r   rš  c                   ó   — e Zd ZdZd„ Zy)ÚConsumingProtocolzC
    Protocol that really, really doesn't want any more bytes.
    c                 óZ   — | j                   j                  |«       | j                  «        y r   )rG   rå   r@   r   s     r   r!   zConsumingProtocol.lineReceivedS  s    € Ø�‰×Ñ˜TÔ"Ø×ÑÕr   N)r(   r)   r*   r+   r!   r-   r   r   r¢  r¢  N  s   „ ñór   r¢  c                   ó   — e Zd ZdZd„ Zy)ÚProducerTestszM
    Tests for L{basic._PausableMixin} and L{basic.LineReceiver.paused}.
    c                 óŽ  — t        «       }t        «       }|j                  |«       |j                  d«       | j	                  |j
                  g «       | j                  |j                  «       | j                  |j                  «       |j                  d«       | j	                  |j
                  dg«       | j                  |j                  «       | j                  |j                  «       |j                  «        | j	                  |j
                  dg«       | j                  |j                  «       | j                  |j                  «       |j                  d«       | j	                  |j
                  ddg«       | j                  |j                  «       | j                  |j                  «       |j                  «        | j	                  |j
                  g d¢«       | j                  |j                  «       | j                  |j                  «       |j                  d«       | j	                  |j
                  g d¢«       | j                  |j                  «       | j                  |j                  «       |j                  «        | j	                  |j
                  g d¢«       | j                  |j                  «       | j                  |j                  «       |j                  «        | j	                  |j
                  g d¢«       | 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.
        s   hello, s   world
ó   hello, worlds   hello
world
rô   )r§  rô   rõ   s	   goodbye
)r§  rô   rõ   r�   N)
r¢  rš  r_   rb   rc   r&   rŸ   rž  r™   rB   )r   Úprg   s      r   Útest_pauseResumezProducerTests.test_pauseResume]  sN  € ô ÓˆÜ!Ó#ˆØ	×Ñ˜Ôð 	
�‰�zÔ"Ø×Ñ˜Ÿ™ Ô$Ø×Ñ˜Ÿ™Ô"Ø×Ñ˜Ÿ™Ô"ð 	
�‰�|Ô$Ø×Ñ˜Ÿ™ /Ð!2Ô3Ø�‰˜Ÿ™Ô!Ø�‰˜Ÿ™Ô!ð 	
×ÑÔØ×Ñ˜Ÿ™ /Ð!2Ô3Ø×Ñ˜Ÿ™Ô"Ø×Ñ˜Ÿ™Ô"ð 	
�‰Ð,Ô-Ø×Ñ˜Ÿ™ /°8Ð!<Ô=Ø�‰˜Ÿ™Ô!Ø�‰˜Ÿ™Ô!ð 	
×ÑÔØ×Ñ˜Ÿ™Ò!FÔGØ�‰˜Ÿ™Ô!Ø�‰˜Ÿ™Ô!ð 	
�‰�~Ô&Ø×Ñ˜Ÿ™Ò!FÔGØ�‰˜Ÿ™Ô!Ø�‰˜Ÿ™Ô!ð 	
×ÑÔØ×Ñ˜Ÿ™Ò!RÔSØ�‰˜Ÿ™Ô!Ø�‰˜Ÿ™Ô!ð 	
×ÑÔØ×Ñ˜Ÿ™Ò!RÔSØ×Ñ˜Ÿ™Ô"Ø×Ñ˜Ÿ™Õ"r   N)r(   r)   r*   r+   r©  r-   r   r   r¥  r¥  X  s   „ ñóA#r   r¥  c                   ó4   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	ÚFileSenderTestsz(
    Tests for L{basic.FileSender}.
    c                 ój   — t        j                  «       }| j                  t        t        |«      «       y)zP
        L{basic.FileSender} implements the L{IPullProducer} interface.
        N)r   Ú
FileSenderr™   r   r
   )r   Úsenders     r   Útest_interfacezFileSenderTests.test_interface¦  s%   € ô ×!Ñ!Ó#ˆØ�‰œ¤Y°Ó7Õ8r   c                 óü   — t        d«      }t        j                  «       }t        j                  «       }|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)
r   r   r˜   r   r­  ÚbeginFileTransferrc   ÚproducerrŸ   Ú	streaming)r   ÚsourceÚconsumerr®  s       r   Útest_producerRegisteredz'FileSenderTests.test_producerRegistered­  sd   € ô
 ˜Ó)ˆÜ ×0Ñ0Ó2ˆÜ×!Ñ!Ó#ˆØ× Ñ  ¨Ô2Ø×Ñ˜×*Ñ*¨FÔ3Ø×Ñ˜×+Ñ+Õ,r   c                 ó†  — t        d«      }t        j                  «       }t        j                  «       }|j                  ||«      }|j                  «        |j                  «        | j                  |j                  «       | j                  d| j                  |«      «       | j                  d|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)r   r   r˜   r   r­  r²  rB   ÚassertIsNoner³  rc   ÚsuccessResultOfrû   ©r   rµ  r¶  r®  Úds        r   Útest_transferzFileSenderTests.test_transfer¹  sš   € ô ˜Ó)ˆÜ ×0Ñ0Ó2ˆÜ×!Ñ!Ó#ˆØ×$Ñ$ V¨XÓ6ˆØ×ÑÔ à×ÑÔ Ø×Ñ˜(×+Ñ+Ô,à×Ñ˜˜t×3Ñ3°AÓ6Ô7Ø×Ñ˜¨(¯.©.Ó*:Õ;r   c                 ó^  — t        d«      }t        j                  «       }t        j                  «       }d|_        |j                  ||«      }|j                  «        | j                  d|j                  «       «       |j                  «        | j                  d|j                  «       «       |j                  «        | j                  d|j                  «       «       |j                  «        | j                  d| j                  |«      «       | j                  d|j                  «       «       y)zj
        L{basic.FileSender} reads at most C{CHUNK_SIZE} every time it resumes
        producing.
        r±  r=   s   Tests   Test conr¹  N)r   r   r˜   r   r­  Ú
CHUNK_SIZEr²  rB   rc   rû   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Ø×Ñ˜¨(¯.©.Ó*:Õ;r   c                 óX  — d„ }t        d«      }t        j                  «       }t        j                  «       }|j                  |||«      }|j                  «        |j                  «        | j                  d| j                  |«      «       | j                  d|j                  «       «       y)z�
        L{basic.FileSender.beginFileTransfer} takes a C{transform} argument
        which allows to manipulate the data on the fly.
        c                 ó"   — | j                  «       S r   )Úswapcase)Úchunks    r   Ú	transformz=FileSenderTests.test_transferWithTransform.<locals>.transformè  s   € Ø—>‘>Ó#Ð#r   r±  ó   Ts   tEST CONTENTN)
r   r   r˜   r   r­  r²  rB   rc   r»  rû   )r   rÆ  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Ø×Ñ˜¨(¯.©.Ó*:Õ;r   c                 óD  — t        d«      }t        j                  «       }t        j                  «       }|j                  ||«      }|j                  «        | j                  |«      }|j                  t        «       | j                  dt        |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)r   r   r˜   r   r­  r²  rC   ÚfailureResultOfÚtrapÚ	Exceptionrc   Ústrrû   )r   rµ  r¶  r®  r½  Úfailures         r   Útest_abortedTransferz$FileSenderTests.test_abortedTransferö  s~   € ô ˜Ó)ˆÜ ×0Ñ0Ó2ˆÜ×!Ñ!Ó#ˆØ×$Ñ$ V¨XÓ6ˆà×ÑÔà×&Ñ& qÓ)ˆØ�‰”YÔØ×ÑÐ>ÄÀGÇMÁMÓ@RÕSr   N)
r(   r)   r*   r+   r¯  r·  r¾  rÁ  rÈ  rÏ  r-   r   r   r«  r«  ¡  s&   „ ñò9ò
-ò<ò$<ò.<ó(Tr   r«  );r+   rB  rŽ   Úior   Útypingr   r   r   Úzope.interface.verifyr   Útwisted.internetr   r	   Útwisted.internet.interfacesr
   Útwisted.internet.protocolr   Útwisted.protocolsr   Útwisted.python.compatr   Útwisted.python.failurer   Útwisted.testr   Útwisted.trialr   rŠ   r   r/   rÕ   rR   ÚSynchronousTestCaserW   rµ   r»   rÎ   r×   r<  rã   rç   ró   r?  rU  ÚInt32StringReceiverrx  r|  ÚInt16StringReceiverrƒ  r…  ÚInt8StringReceiverr“  r•  rš  r¢  r¥  ÚTestCaser«  r-   r   r   ú<module>rà     sð  ðñó
 Û 
Ý ß 'Ñ 'å .ç +Ý 1Ý 4Ý #Ý +Ý *Ý &Ý "ô#˜×+Ñ+ô #ô0E:�×#Ñ#ô E:ôP#�U×+Ñ+ô #ô*uJ˜×4Ñ4ô uJôp$ %×"4Ñ"4ô $ô.L1¨(×*FÑ*Fô L1ô^)J˜H×8Ñ8ô )J÷Xñ ô �I˜u×6Ñ6ô  ÷7ñ 7ô2UL˜X×9Ñ9¸?ô ULôpFL˜ô FL÷Rg-ñ 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#ôRdT�h×'Ñ'õ dTr   