ó
    ×›‘hñ7  ã                   ór  • S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
JrJr  SSKJr  SSKJrJr  SSKJr   " S	 S
\R(                  5      r " S S\5      r " S S5      r " S S\\R0                  5      r " S S\\R0                  5      r " S S\\R0                  5      r " S S\R0                  5      rg)z.
Test case for L{twisted.protocols.loopback}.
é    )Úimplementer)ÚdeferÚ
interfacesÚreactor)ÚDeferred)ÚIAddressÚIPullProducerÚIPushProducer)ÚProtocol)ÚbasicÚloopback)Úunittestc                   ó,   • \ rS rSrS rS rS rS rSrg)ÚSimpleProtocolé   c                 óT   • [         R                  " 5       U l        / U l        / U l        g ©N)r   r   ÚconnÚlinesÚconnLost©Úselfs    Ú^C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_loopback.pyÚ__init__ÚSimpleProtocol.__init__   s   € Ü—N’NÓ$ˆŒ	ØˆŒ
Øˆ�ó    c                 ó:   • U R                   R                  S 5        g r   )r   Úcallbackr   s    r   ÚconnectionMadeÚSimpleProtocol.connectionMade   s   € Ø�	‰	×Ñ˜4Õ r   c                 ó:   • U R                   R                  U5        g r   )r   Úappend©r   Úlines     r   ÚlineReceivedÚSimpleProtocol.lineReceived   s   € Ø�
‰
×Ñ˜$Õr   c                 ó:   • U R                   R                  U5        g r   )r   r"   )r   Úreasons     r   ÚconnectionLostÚSimpleProtocol.connectionLost   s   € Ø�‰×Ñ˜VÕ$r   )r   r   r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r%   r)   Ú__static_attributes__© r   r   r   r      s   † òò
!ò õ%r   r   c                   ó   • \ rS rSrSrS rSrg)ÚDoomProtocolé#   r   c                 ó  • U =R                   S-  sl         U R                   S:  a  U R                  SU R                   4-  5        [        R                  X5        U R                  S   S:X  a  U R
                  R                  5         g g )Né   é   s   Hello %déÿÿÿÿó   Hello 3)ÚiÚsendLiner   r%   r   Ú	transportÚloseConnectionr#   s     r   r%   ÚDoomProtocol.lineReceived&   sf   € Ø�Š�!‰�Ø�6‰6�A‹:ð �M‰M˜+¨¯©¨	Ñ1Ô2Ü×#Ñ# DÔ/Ø�:‰:�b‰>˜ZÓ'Ø�N‰N×)Ñ)Õ+ð (r   r0   N)r+   r,   r-   r.   r9   r%   r/   r0   r   r   r2   r2   #   s   † Ø	€Aõ,r   r2   c                   ó    • \ rS rSrS rS rSrg)ÚLoopbackTestCaseMixiné1   c                 óì   ^ ^^• [        5       m[        5       mU4S jnTR                  R                  U5        UUU 4S jn[        R                  " T R
                  TT5      nUR                  U5        U$ )Nc                 ó\   >• TR                  S5        TR                  R                  5         g )Nó   THIS IS LINE ONE!)r:   r;   r<   ©ÚresultÚss    €r   Ú	sendALineÚ<LoopbackTestCaseMixin.testRegularFunction.<locals>.sendALine6   s    ø€ Ø�J‰JÐ+Ô,Ø�K‰K×&Ñ&Õ(r   c                 óÔ   >• TR                  TR                  S/5        TR                  [        TR                  5      S5        TR                  [        TR                  5      S5        g )NrC   r5   ©ÚassertEqualr   Úlenr   ©ÚignoredÚcrF   r   s    €€€r   ÚcheckÚ8LoopbackTestCaseMixin.testRegularFunction.<locals>.check<   sK   ø€ Ø×Ñ˜QŸW™WÐ';Ð&<Ô=Ø×ÑœS §¡›_¨aÔ0Ø×ÑœS §¡›_¨aÕ0r   )r   r   ÚaddCallbackr   ÚmaybeDeferredÚloopbackFunc©r   rG   rP   ÚdrO   rF   s   `   @@r   ÚtestRegularFunctionÚ)LoopbackTestCaseMixin.testRegularFunction2   s^   ú€ ÜÓˆÜÓˆõ	)ð 	
�‰×Ñ˜9Ô%÷	1ô
 ×Ò × 1Ñ 1°1°aÓ8ˆØ	�‰�eÔØˆr   c                 óì   ^ ^^• [        5       m[        5       mU4S jnTR                  R                  U5        UUU 4S jn[        R                  " T R
                  TT5      nUR                  U5        U$ )Nc                 ó(   >• TR                  S5        g )Nó	   DOOM LINE)r:   rD   s    €r   rG   Ú=LoopbackTestCaseMixin.testSneakyHiddenDoom.<locals>.sendALineI   s   ø€ Ø�J‰J�|Õ$r   c                 ó  >• TR                  TR                  / SQ5        TR                  TR                  / SQ5        TR                  [        TR                  5      S5        TR                  [        TR                  5      S5        g )N)ó   Hello 1ó   Hello 2r8   )r[   r^   r_   r8   r5   rJ   rM   s    €€€r   rP   Ú9LoopbackTestCaseMixin.testSneakyHiddenDoom.<locals>.checkN   sb   ø€ Ø×Ñ˜QŸW™WÒ&JÔKØ×ÑØ—‘ÒKôð ×ÑœS §¡›_¨aÔ0Ø×ÑœS §¡›_¨aÕ0r   )r2   r   rR   r   rS   rT   rU   s   `   @@r   ÚtestSneakyHiddenDoomÚ*LoopbackTestCaseMixin.testSneakyHiddenDoomE   s\   ú€ Ü‹NˆÜ‹Nˆõ	%ð 	
�‰×Ñ˜9Ô%÷	1ô ×Ò × 1Ñ 1°1°aÓ8ˆØ	�‰�eÔØˆr   r0   N)r+   r,   r-   r.   rW   ra   r/   r0   r   r   r?   r?   1   s   † òõ&r   r?   c                   ó¬   • \ rS rSr\" \R                  5      rS rS r	S r
S rSS jrS rS rS	 rS
 rSS jrS rS rS rS rS rS rS rS rSrg)ÚLoopbackAsyncTestsé[   c                 óÖ   •  " S S[         5      nU" 5       nU" 5       n[        R                  " X#5        U R                  UR                  5        U R                  UR                  5        g)ze
Test that the client and server protocol both have makeConnection
invoked on them by loopbackAsync.
c                   ó   • \ rS rSrSrS rSrg)Ú<LoopbackAsyncTests.test_makeConnection.<locals>.TestProtocoléd   Nc                 ó   • Xl         g r   ©r;   ©r   r;   s     r   ÚmakeConnectionÚKLoopbackAsyncTests.test_makeConnection.<locals>.TestProtocol.makeConnectiong   ó   € Ø!*•r   rk   )r+   r,   r-   r.   r;   rm   r/   r0   r   r   ÚTestProtocolrh   d   s   † ØˆIõ+r   rp   N)r   r   ÚloopbackAsyncÚassertIsNotNoner;   )r   rp   ÚserverÚclients       r   Útest_makeConnectionÚ&LoopbackAsyncTests.test_makeConnection^   sT   € ô	+œ8ô 	+ñ “ˆÙ“ˆÜ×Ò˜vÔ.Ø×Ñ˜V×-Ñ-Ô.Ø×Ñ˜V×-Ñ-Õ.r   c                 ó  ^ ^•  " S S[         5      nU(       a"  U" 5       n[        5       =oTl        [        5       nO![        5       nU" 5       n[        5       =oVl        [        R                  " XF5        UU 4S jnUR                  U5      $ )z:
Test one of the permutations of client/server host/peer.
c                   ó   • \ rS rSrS rSrg)Ú6LoopbackAsyncTests._hostpeertest.<locals>.TestProtocoléu   c                 óf   • [         R                  " X5        U R                  R                  U5        g r   )r   rm   ÚonConnectionr   rl   s     r   rm   ÚELoopbackAsyncTests._hostpeertest.<locals>.TestProtocol.makeConnectionv   s$   € Ü×'Ò'¨Ô8Ø×!Ñ!×*Ñ*¨9Õ5r   r0   N)r+   r,   r-   r.   rm   r/   r0   r   r   rp   ry   u   s   † õ6r   rp   c                 ór   >• [        U T5      " 5       nTR                  [        R                  " U5      5        g r   )ÚgetattrÚ
assertTruer   Ú
providedBy)r;   ÚhostÚgetr   s     €€r   Ú	connectedÚ3LoopbackAsyncTests._hostpeertest.<locals>.connected…   s)   ø€ Ü˜9 cÔ*Ó,ˆDØ�O‰OœH×/Ò/°Ó5Õ6r   )r   r   r|   r   rq   rR   )r   rƒ   Ú
testServerrp   rs   rV   rt   r„   s   ``      r   Ú_hostpeertestÚ LoopbackAsyncTests._hostpeertestp   sn   ù€ ô
	6œ8ô 	6ö
 Ù!“^ˆFÜ&.£jÐ0ˆAÔ#Ü“Z‰Fä“ZˆFÙ!“^ˆFÜ&.£jÐ0ˆAÔ#ä×Ò˜vÔ.ö	7ð �}‰}˜YÓ'Ð'r   c                 ó&   • U R                  SS5      $ )zl
Test that the server gets a transport with a properly functioning
implementation of L{ITransport.getHost}.
ÚgetHostT©r‡   r   s    r   Útest_serverHostÚ"LoopbackAsyncTests.test_serverHost‹   s   € ð
 ×!Ñ! )¨TÓ2Ð2r   c                 ó&   • U R                  SS5      $ )z7
Like C{test_serverHost} but for L{ITransport.getPeer}
ÚgetPeerTr‹   r   s    r   Útest_serverPeerÚ"LoopbackAsyncTests.test_serverPeer’   s   € ð ×!Ñ! )¨TÓ2Ð2r   c                 ó&   • U R                  SS5      $ )zl
Test that the client gets a transport with a properly functioning
implementation of L{ITransport.getHost}.
rŠ   Fr‹   )r   rƒ   s     r   Útest_clientHostÚ"LoopbackAsyncTests.test_clientHost˜   s   € ð
 ×!Ñ! )¨UÓ3Ð3r   c                 ó&   • U R                  SS5      $ )z8
Like C{test_clientHost} but for L{ITransport.getPeer}.
r�   Fr‹   r   s    r   Útest_clientPeerÚ"LoopbackAsyncTests.test_clientPeerŸ   s   € ð ×!Ñ! )¨UÓ3Ð3r   c                 óþ   ^•  " S S[         5      n " U4S jS[         5      nU(       a  U" 5       nU" 5       n[        5       =ovl        OU" 5       n[        5       =oul        U" 5       n[        R                  " XV5        U$ )z™
Test one of the permutations of write/writeSequence client/server.

@param write: The name of the method to test, C{"write"} or
    C{"writeSequence"}.
c                   ó   • \ rS rSrSrS rSrg)Ú9LoopbackAsyncTests._greetingtest.<locals>.GreeteeProtocolé­   r   c                 ó†   • U =R                   U-  sl         U R                   S:X  a  U R                  R                  S 5        g g ©Nó   bytes)ÚbytesÚreceivedr   ©r   rŸ   s     r   ÚdataReceivedÚFLoopbackAsyncTests._greetingtest.<locals>.GreeteeProtocol.dataReceived°   s3   € Ø—
’
˜eÑ#•
Ø—:‘: Ó)Ø—M‘M×*Ñ*¨4Õ0ð *r   r0   N©r+   r,   r-   r.   rŸ   r¢   r/   r0   r   r   ÚGreeteeProtocolrš   ­   s   † ØˆEõ1r   r¥   c                   ó"   >• \ rS rSrU 4S jrSrg)Ú9LoopbackAsyncTests._greetingtest.<locals>.GreeterProtocoléµ   c                 ó„   >• TS:X  a  U R                   R                  S5        g U R                   R                  SS/5        g )NÚwriterž   s   byts   es)r;   rª   ÚwriteSequence©r   rª   s    €r   r   ÚHLoopbackAsyncTests._greetingtest.<locals>.GreeterProtocol.connectionMade¶   s3   ø€ Ø˜GÓ#Ø—N‘N×(Ñ(¨Õ2à—N‘N×0Ñ0°&¸%°ÕAr   r0   N©r+   r,   r-   r.   r   r/   ©rª   s   €r   ÚGreeterProtocolr§   µ   s   ø† ÷Bð Br   r°   )r   r   r    r   rq   )r   rª   r†   r¥   r°   rs   rt   rV   s    `      r   Ú_greetingtestÚ LoopbackAsyncTests._greetingtest¥   sm   ø€ ô	1œhô 	1÷	Bœhô 	Bö Ù$Ó&ˆFÙ$Ó&ˆFÜ"*£*Ð,ˆA•á$Ó&ˆFÜ"*£*Ð,ˆA”Ù$Ó&ˆFä×Ò˜vÔ.Øˆr   c                 ó&   • U R                  SS5      $ )zl
Test that on a connection where the client speaks first, the server
receives the bytes sent by the client.
rª   F©r±   r   s    r   Útest_clientGreetingÚ&LoopbackAsyncTests.test_clientGreetingÈ   s   € ð
 ×!Ñ! '¨5Ó1Ð1r   c                 ó&   • U R                  SS5      $ )zb
Like C{test_clientGreeting}, but use C{writeSequence} instead of
C{write} to issue the greeting.
r«   Fr´   r   s    r   Útest_clientGreetingSequenceÚ.LoopbackAsyncTests.test_clientGreetingSequenceÏ   s   € ð
 ×!Ñ! /°5Ó9Ð9r   c                 ó&   • U R                  SS5      $ )zl
Test that on a connection where the server speaks first, the client
receives the bytes sent by the server.
rª   Tr´   r¬   s     r   Útest_serverGreetingÚ&LoopbackAsyncTests.test_serverGreetingÖ   s   € ð
 ×!Ñ! '¨4Ó0Ð0r   c                 ó&   • U R                  SS5      $ )zb
Like C{test_serverGreeting}, but use C{writeSequence} instead of
C{write} to issue the greeting.
r«   Tr´   r   s    r   Útest_serverGreetingSequenceÚ.LoopbackAsyncTests.test_serverGreetingSequenceÝ   s   € ð
 ×!Ñ! /°4Ó8Ð8r   c                 ó$  ^^^^• [        SS5       Vs/ s H	  nSU4-  PM     snm " UU4S jS[        5      n " UUU4S jS[        5      nU" 5       mU" 5       m[        5       Tl        [        R
                  " TT5        TR                  $ s  snf )Nr   é
   s   %dc                   ó$   >• \ rS rSrU U4S jrSrg)Ú;LoopbackAsyncTests._producertest.<locals>.ProducingProtocoléç   c                 ó|   >• T" [        T5      5      U l        U R                  R                  U R                  5        g r   )ÚlistÚproducerÚstartr;   )r   ÚproducerClassÚ	toProduces    €€r   r   ÚJLoopbackAsyncTests._producertest.<locals>.ProducingProtocol.connectionMadeè   s)   ø€ Ù -¬d°9«oÓ >�”Ø—‘×#Ñ# D§N¡NÕ3r   )rÇ   Nr®   )rÉ   rÊ   s   €€r   ÚProducingProtocolrÃ   ç   s   ø† ÷4ñ 4r   rÌ   c                   ó*   >• \ rS rSrSrU UU4S jrSrg)Ú;LoopbackAsyncTests._producertest.<locals>.ReceivingProtocoléì   r   c                 óª   >• U =R                   U-  sl         U R                   SR                  T5      :X  a  U R                  R                  TT45        g g )Nr   )rŸ   Újoinr    r   )r   Údatart   rs   rÊ   s     €€€r   r¢   ÚHLoopbackAsyncTests._producertest.<locals>.ReceivingProtocol.dataReceivedï   sB   ø€ Ø—
’
˜dÑ"•
Ø—:‘: §¡¨)Ó!4Ó4Ø—M‘M×*Ñ*¨F°FÐ+;Õ<ð 5r   r0   Nr¤   )rt   rs   rÊ   s   €€€r   ÚReceivingProtocolrÎ   ì   s   ø† ØˆE÷=ò =r   rÔ   )Úranger   r   r    r   rq   )r   rÉ   r9   rÌ   rÔ   rt   rs   rÊ   s    `   @@@r   Ú_producertestÚ LoopbackAsyncTests._producertestä   s   û€ Ü+0°°B¬<Ó8ª< a�U˜a˜T”\©<Ñ8ˆ	÷	4ð 	4¤ô 	4÷
	=ñ 	=¤ô 	=ñ #Ó$ˆÙ"Ó$ˆÜ"›*ˆŒä×Ò˜v vÔ.Ø�‰Ðùò) 9s   “Bc                 ó�   ^ • [        [        5       " S S5      5       nT R                  U5      nU 4S jnUR                  U5        U$ )z?
Test a push producer registered against a loopback transport.
c                   ó0   • \ rS rSrSrS rS rS rS rSr	g)	Ú:LoopbackAsyncTests.test_pushProducer.<locals>.PushProduceré   Fc                 ó   • Xl         g r   ©rÊ   ©r   rÊ   s     r   r   ÚCLoopbackAsyncTests.test_pushProducer.<locals>.PushProducer.__init__  ro   r   c                 ó   • SU l         g ©NT)Úresumedr   s    r   ÚresumeProducingÚJLoopbackAsyncTests.test_pushProducer.<locals>.PushProducer.resumeProducing  s	   € Ø#�•r   c                 óT   • Xl         UR                  U S5        U R                  5         g rá   )ÚconsumerÚregisterProducerÚ_produceAndSchedule©r   ræ   s     r   rÈ   Ú@LoopbackAsyncTests.test_pushProducer.<locals>.PushProducer.start
  s#   € Ø (”Ø×)Ñ)¨$°Ô5Ø×(Ñ(Õ*r   c                 ó  • U R                   (       aV  U R                  R                  U R                   R                  S5      5        [        R
                  " SU R                  5        g U R                  R                  5         g ©Nr   )rÊ   ræ   rª   Úpopr   Ú	callLaterrè   ÚunregisterProducerr   s    r   rè   ÚNLoopbackAsyncTests.test_pushProducer.<locals>.PushProducer._produceAndSchedule  sP   € Ø—>—>Ø—M‘M×'Ñ'¨¯©×(:Ñ(:¸1Ó(=Ô>Ü×%Ò% a¨×)AÑ)AÕBà—M‘M×4Ñ4Õ6r   )ræ   râ   rÊ   N)
r+   r,   r-   r.   râ   r   rã   rÈ   rè   r/   r0   r   r   ÚPushProducerrÚ      s   † àˆGò+ò$ò+õ
7r   rñ   c                 óZ   >• U u  pTR                  UR                  R                  S5        g )Nz0Streaming producer should not have been resumed.)ÚassertFalserÇ   râ   )Úresultsrt   rs   r   s      €r   ÚfinishedÚ6LoopbackAsyncTests.test_pushProducer.<locals>.finished  s)   ø€ Ø&ÑˆVØ×ÑØ—‘×'Ñ'ØBõr   )r   r
   rÖ   rR   )r   rñ   rV   rõ   s   `   r   Útest_pushProducerÚ$LoopbackAsyncTests.test_pushProducerû   sK   ø€ ô
 
”]Ó	#÷	7ð 	7ó 
$ð	7ð* ×Ñ˜|Ó,ˆõ	ð 	
�‰�hÔØˆr   c                 ó\   • [        [        5       " S S5      5       nU R                  U5      $ )z?
Test a pull producer registered against a loopback transport.
c                   ó&   • \ rS rSrS rS rS rSrg)Ú:LoopbackAsyncTests.test_pullProducer.<locals>.PullProduceri'  c                 ó   • Xl         g r   rÝ   rÞ   s     r   r   ÚCLoopbackAsyncTests.test_pullProducer.<locals>.PullProducer.__init__)  ro   r   c                 óH   • Xl         U R                   R                  U S5        g )NF)ræ   rç   ré   s     r   rÈ   Ú@LoopbackAsyncTests.test_pullProducer.<locals>.PullProducer.start,  s   € Ø (”Ø—‘×.Ñ.¨t°UÕ;r   c                 óÄ   • U R                   R                  U R                  R                  S5      5        U R                  (       d  U R                   R	                  5         g g rì   )ræ   rª   rÊ   rí   rï   r   s    r   rã   ÚJLoopbackAsyncTests.test_pullProducer.<locals>.PullProducer.resumeProducing0  s?   € Ø—‘×#Ñ# D§N¡N×$6Ñ$6°qÓ$9Ô:Ø—~—~Ø—M‘M×4Ñ4Õ6ð &r   )ræ   rÊ   N)r+   r,   r-   r.   r   rÈ   rã   r/   r0   r   r   ÚPullProducerrû   '  s   † ò+ò<õ7r   r  )r   r	   rÖ   )r   r  s     r   Útest_pullProducerÚ$LoopbackAsyncTests.test_pullProducer"  s3   € ô
 
”]Ó	#÷	7ð 	7ó 
$ð	7ð ×!Ñ! ,Ó/Ð/r   c                 óÀ   ^ ^•  " S S[         5      n " S S[         5      nU" 5       nU" 5       m[        R                  " TU5      nUU 4S jnUR                  U5        U$ )zš
L{loopback.loopbackAsync} does not call a protocol's C{dataReceived}
method while that protocol's transport's C{write} method is higher up
on the stack.
c                   ó   • \ rS rSrS rSrg)Ú9LoopbackAsyncTests.test_writeNotReentrant.<locals>.Serveri>  c                 ó:   • U R                   R                  S5        g r�   )r;   rª   r¡   s     r   r¢   ÚFLoopbackAsyncTests.test_writeNotReentrant.<locals>.Server.dataReceived?  s   € Ø—‘×$Ñ$ XÕ.r   r0   N)r+   r,   r-   r.   r¢   r/   r0   r   r   ÚServerr  >  s   † õ/r   r
  c                   ó*   • \ rS rSrSrS rS rS rSrg)Ú9LoopbackAsyncTests.test_writeNotReentrant.<locals>.ClientiB  Fc                 óF   • [         R                  " SU R                  5        g rì   )r   rî   Úgor   s    r   r   ÚHLoopbackAsyncTests.test_writeNotReentrant.<locals>.Client.connectionMadeE  s   € Ü×!Ò! ! T§W¡WÕ-r   c                 óH   • U R                   R                  S5        SU l        g )Nó   fooT)r;   rª   Úreadyr   s    r   r  Ú<LoopbackAsyncTests.test_writeNotReentrant.<locals>.Client.goH  s   € Ø—‘×$Ñ$ VÔ,Ø!�•
r   c                 óZ   • U R                   U l        U R                  R                  5         g r   )r  ÚwasReadyr;   r<   r¡   s     r   r¢   ÚFLoopbackAsyncTests.test_writeNotReentrant.<locals>.Client.dataReceivedL  s   € Ø $§
¡
�”Ø—‘×-Ñ-Õ/r   )r  r  N)	r+   r,   r-   r.   r  r   r  r¢   r/   r0   r   r   ÚClientr  B  s   † ØˆEò.ò"õ0r   r  c                 ó<   >• TR                  TR                  5        g r   )r€   r  )rN   rt   r   s    €€r   Ú
cbFinishedÚ=LoopbackAsyncTests.test_writeNotReentrant.<locals>.cbFinishedT  s   ø€ Ø�O‰O˜FŸO™OÕ,r   )r   r   rq   rR   )r   r
  r  rs   rV   r  rt   s   `     @r   Útest_writeNotReentrantÚ)LoopbackAsyncTests.test_writeNotReentrant7  sU   ù€ ô	/”Xô 	/ô	0”Xô 	0ñ “ˆÙ“ˆÜ×"Ò" 6¨6Ó2ˆö	-ð 	
�‰�jÔ!Øˆr   c                 óÚ  ^ ^^^• / mU4S jn[        5       m[        5       m[        R                  " TTU5      nT R                  T/ 5        TR                  R                  S5        TR                  R                  S5        TR                  R                  S5        TR                  R                  S5        TR                  R                  5         UUU U4S jnUR                  U5        U$ )z¼
The callable passed as the value for the C{pumpPolicy} parameter to
L{loopbackAsync} is called with a L{_LoopbackQueue} of pending bytes
and a protocol to which they should be delivered.
c                 óŒ   >• / nU (       a(  UR                  U R                  5       5        U (       a  M(  TR                  X45        g r   )r"   rƒ   )ÚqueueÚtargetrŸ   Ú	pumpCallss      €r   ÚdummyPolicyÚ7LoopbackAsyncTests.test_pumpPolicy.<locals>.dummyPolicyb  s4   ø€ ØˆEÞØ—‘˜UŸY™Y›[Ô)÷ �%à×Ñ˜f˜_Õ-r   r  ó   baró   bazó   quuxc                 ó>   >• TR                  TT/ SQ4TSS/4/5        g )N)r%  r&  Nr  r$  )rK   )rN   rt   r!  r   rs   s    €€€€r   Ú
cbCompleteÚ6LoopbackAsyncTests.test_pumpPolicy.<locals>.cbCompletet  s.   ø€ Ø×ÑØð Ò1Ð2°V¸fÀfÐ=MÐ4NÐOõ	r   )r   r   rq   rK   r;   rª   r<   rR   )r   r"  rõ   r(  rt   r!  rs   s   `   @@@r   Útest_pumpPolicyÚ"LoopbackAsyncTests.test_pumpPolicyZ  sÄ   û€ ð ˆ	õ	.ô “ˆÜ“ˆä×)Ò)¨&°&¸+ÓFˆØ×Ñ˜ BÔ'à×Ñ×Ñ˜vÔ&Ø×Ñ×Ñ˜vÔ&Ø×Ñ×Ñ˜vÔ&Ø×Ñ×Ñ˜wÔ'Ø×Ñ×'Ñ'Ô)÷	ð 	ð 	×Ñ˜ZÔ(Øˆr   c                 ó"  • / n[        5       nUR                  Ul        [        R                  " 5       nUR                  S5        UR                  S5        UR                  S5        [        R                  " X25        U R                  USS/5        g)z‡
L{identityPumpPolicy} is a pump policy which calls the target's
C{dataReceived} method one for each string in the queue passed to it.
r  r$  N)r   r"   r¢   r   Ú_LoopbackQueueÚputÚidentityPumpPolicyrK   ©r   rŸ   rt   r  s       r   Útest_identityPumpPolicyÚ*LoopbackAsyncTests.test_identityPumpPolicy  sp   € ð
 ˆÜ“ˆØ#Ÿl™lˆÔÜ×'Ò'Ó)ˆØ�	‰	�&ÔØ�	‰	�&ÔØ�	‰	�$Œä×#Ò# EÔ2à×Ñ˜ ¨Ð 0Õ1r   c                 ó   • / n[        5       nUR                  Ul        [        R                  " 5       nUR                  S5        UR                  S5        UR                  S5        [        R                  " X25        U R                  US/5        g)z 
L{collapsingPumpPolicy} is a pump policy which calls the target's
C{dataReceived} only once with all of the strings in the queue passed
to it joined together.
r  r$  Ns   foobar)r   r"   r¢   r   r-  r.  ÚcollapsingPumpPolicyrK   r0  s       r   Útest_collapsingPumpPolicyÚ,LoopbackAsyncTests.test_collapsingPumpPolicy�  sm   € ð ˆÜ“ˆØ#Ÿl™lˆÔÜ×'Ò'Ó)ˆØ�	‰	�&ÔØ�	‰	�&ÔØ�	‰	�$Œä×%Ò% eÔ4à×Ñ˜  Õ,r   r0   N)rŠ   r¯   )r+   r,   r-   r.   Ústaticmethodr   rq   rT   ru   r‡   rŒ   r�   r“   r–   r±   rµ   r¸   r»   r¾   rÖ   r÷   r  r  r*  r1  r5  r/   r0   r   r   rd   rd   [   sp   † Ù × 6Ñ 6Ó7€Lò/ò$(ò63ò3ô4ò4ò!òF2ò:ô1ò9òò.%òN0ò*!òF#òJ2õ"-r   rd   c                   ó8   • \ rS rSr\" \R                  5      rSrg)ÚLoopbackTCPTestsi£  r0   N)	r+   r,   r-   r.   r7  r   ÚloopbackTCPrT   r/   r0   r   r   r9  r9  £  s   † Ù × 4Ñ 4Ó5ƒLr   r9  c                   ój   • \ rS rSr\" \R                  5      r\R                  " \
S5      c  SrSrgSrg)ÚLoopbackUNIXTestsi§  Nz-Current reactor does not support UNIX socketsr0   )r+   r,   r-   r.   r7  r   ÚloopbackUNIXrT   r   ÚIReactorUNIXr   Úskipr/   r0   r   r   r<  r<  §  s/   † Ù × 5Ñ 5Ó6€Là×Ò˜w¨Ó-Ñ5Ø>‹ò 6r   r<  c                   ó:   • \ rS rSrSr " S S\5      rS rS rSr	g)	ÚLoopbackRelayTesti®  z6
Test for L{twisted.protocols.loopback.LoopbackRelay}
c                   ó"   • \ rS rSrSrSrS rSrg)ÚLoopbackRelayTest.Receiveri³  z6
Simple Receiver class used for testing LoopbackRelay
r   c                 ó.   • U =R                   U-  sl         g)z)Accumulate received data for verificationN)rÒ   )r   rÒ   s     r   r¢   Ú'LoopbackRelayTest.Receiver.dataReceivedº  s   € à�IŠI˜ÑŽIr   r0   N)r+   r,   r-   r.   Ú__doc__rÒ   r¢   r/   r0   r   r   ÚReceiverrC  ³  s   † ñ	ð ˆõ	r   rG  c                 ó$  • U R                  5       n[        R                  " U5      nUR                  S5        UR                  S5        U R	                  UR
                  S5        UR                  5         U R	                  UR
                  S5        g)z8Test to verify that the write function works as expecteds   abcs   defr   s   abcdefN)rG  r   ÚLoopbackRelayrª   rK   rÒ   ÚclearBuffer©r   ÚreceiverÚrelays      r   Ú
test_writeÚLoopbackRelayTest.test_write¾  si   € à—=‘=“?ˆÜ×&Ò& xÓ0ˆØ�‰�FÔØ�‰�FÔØ×Ñ˜Ÿ™¨Ô,Ø×ÑÔØ×Ñ˜Ÿ™¨	Õ2r   c                 ó,  • U R                  5       n[        R                  " U5      nUR                  / SQ5        UR                  / SQ5        U R	                  UR
                  S5        UR                  5         U R	                  UR
                  S5        g)z@Test to verify that the writeSequence function works as expected)s   The s   quick s   brown s   fox )s   jumps s   over s   the lazy dogr   s+   The quick brown fox jumps over the lazy dogN)rG  r   rI  r«   rK   rÒ   rJ  rK  s      r   Útest_writeSequenceÚ$LoopbackRelayTest.test_writeSequenceÈ  sp   € à—=‘=“?ˆÜ×&Ò& xÓ0ˆØ×ÑÒDÔEØ×ÑÒBÔCØ×Ñ˜Ÿ™¨Ô,Ø×ÑÔØ×Ñ˜Ÿ™Ð(VÕWr   r0   N)
r+   r,   r-   r.   rF  r   rG  rN  rQ  r/   r0   r   r   rA  rA  ®  s   † ñô	�8ô 	ò3õXr   rA  N)rF  Úzope.interfacer   Útwisted.internetr   r   r   Útwisted.internet.deferr   Útwisted.internet.interfacesr   r	   r
   Útwisted.internet.protocolr   Útwisted.protocolsr   r   Útwisted.trialr   ÚLineReceiverr   r2   r?   ÚTestCaserd   r9  r<  rA  r0   r   r   Ú<module>r\     s¦   ðñõ
 'ç 7Ñ 7Ý +ß NÑ NÝ .ß -Ý "ô%�U×'Ñ'ô %ô ,�>ô ,÷'ñ 'ôTE-Ð.°×0AÑ0Aô E-ôP
6Ð,¨h×.?Ñ.?ô 6ô?Ð-¨x×/@Ñ/@ô ?ô"X˜×)Ñ)õ "Xr   