+
    üÐj·  ã                   óÆ   € R t ^ RIHt ^ RIHt ^ RIHt ]P                  ! 4       '       g   ^ RIH	t	  ! R R]4      t
]! 4       P                  ]
P                  4       4       R# )z&
Tests for L{twisted.internet.stdio}.
)ÚProtocol)ÚReactorBuilder)Úplatform)Ú
StandardIOc                   ó’   a € ] tR t^t o RtR tR tR tR tR t	R t
R tR	 t]P                  ! 4       '       d	   R
tRtV tR# RtV tR# )ÚStdioFilesTestszA
L{StandardIO} supports reading and writing to filesystem files.
c                óÆ   € V P                  4       p\        VR 4      P                  4        \        VR4      V n        V P	                  V P                  P                  4       R# )Úwbzrb+N)ÚmktempÚopenÚcloseÚ	extraFileÚ
addCleanup)ÚselfÚpaths   & ÚB/usr/lib/python3/dist-packages/twisted/internet/test/test_stdio.pyÚsetUpÚStdioFilesTests.setUp   sD   € Ø�{‰{‹}ˆÜˆT�4Ó×ÑÔ Ü˜d EÓ*ˆŒØ�‰˜Ÿ™×,Ñ,Ö-ó    c           	     ó   a€ V P                  4       o ! V3R lR\        4      pV P                  4       p\        VR4      ;_uu_ 4       pVP	                  R4       RRR4       \        VR4      ;_uu_ 4       pV! 4       p\        VVP                  4       V P                  P                  4       SR7       V P                  S4       RRR4       V P                  XP                  R4       R#   + '       g   i     L˜; i  + '       g   i     LA; i)zK
Adding a filesystem file reader to a reactor will make sure it is
polled.
c                   ó2   <a € ] tR t^#t o RtV3R ltRtV tR# )Ú4StdioFilesTests.test_addReader.<locals>.DataProtocolr   c                ó€   <€ V ;P                   V,          un         V P                   R 8X  d   SP                  4        R# R# )ó   hello!N)ÚdataÚstop)r   r   Úreactors   &&€r   ÚdataReceivedÚAStdioFilesTests.test_addReader.<locals>.DataProtocol.dataReceived&   s-   ø€ Ø—	’	˜TÕ!•	ð —9‘9 	Ô)Ø—L‘L–Nñ *r   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__r   s   @€r   ÚDataProtocolr   #   s   ù‡ € ØˆD÷#ó #r   r(   r	   r   NÚrb©ÚstdinÚstdoutr   )ÚbuildReactorr   r
   r   Úwriter   Úfilenor   Ú
runReactorÚassertEqualr   )r   r(   r   ÚfÚprotocolr   s   &    @r   Útest_addReaderÚStdioFilesTests.test_addReader   sÆ   ø€ ð
 ×#Ñ#Ó%ˆ÷		#œ8ô 		#ð �{‰{‹}ˆä�$˜×Ô Ø�G‰G�IÔ÷ ô �$˜×Ô á#“~ˆHÜØØ—h‘h“jØ—~‘~×,Ñ,Ó.Øõ	ð �O‰O˜GÔ$÷ ð 	×Ñ˜Ÿ™¨	Ö2÷ ×ú÷ ×ús   ÁC*Á6AC=Ã*C:	Ã=D	c           	     ó¨  a€ V P                  4       o ! V3R lR\        4      pV P                  4       p\        VR4      ;_uu_ 4       pV! 4       p\	        VVP                  4       V P                  P                  4       SR7       VP                  P                  R4       VP                  P                  R4       VP                  P                  4        V P                  S4       RRR4       \        VR4      ;_uu_ 4       pV P                  VP                  4       R	4       RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)
zK
Adding a filesystem file writer to a reactor will make sure it is
polled.
c                   ó.   <a € ] tR t^Gt o V3R ltRtV tR# )Ú:StdioFilesTests.test_addWriter.<locals>.DisconnectProtocolc                ó(   <€ SP                  4        R # )N)r   )r   Úreasonr   s   &&€r   ÚconnectionLostÚIStdioFilesTests.test_addWriter.<locals>.DisconnectProtocol.connectionLostH   s   ø€ Ø—‘–r   r   N)r    r!   r"   r#   r;   r$   r%   r&   s   @€r   ÚDisconnectProtocolr8   G   s   ù‡ € ÷ó r   r=   r	   ©r,   r+   r   ó   hellos   , worldNr)   s   hello, world)r-   r   r
   r   r   r/   r   Ú	transportr.   ÚloseConnectionr0   r1   Úread)r   r=   r   r2   r3   r   s   &    @r   Útest_addWriterÚStdioFilesTests.test_addWriter@   sý   ø€ ð
 ×#Ñ#Ó%ˆ÷	¤ô 	ð �{‰{‹}ˆä�$˜×Ô ñ *Ó+ˆHÜØØ—x‘x“zØ—n‘n×+Ñ+Ó-Øõ	ð ×Ñ×$Ñ$ XÔ.Ø×Ñ×$Ñ$ ZÔ0Ø×Ñ×-Ñ-Ô/à�O‰O˜GÔ$÷ ô  �$˜×Ô Ø×Ñ˜QŸV™V›X Ô7÷ Ñ÷! ×ú÷  ×Ðús   ÁBD-Ä!E Ä-D=	Å E	c           	     ó2  € V P                  4       pV P                  4       p\        VR4      P                  4        \        VR4      ;_uu_ 4       p\	        \        4       VP                  4       V P                  P                  4       VR7      pV P                  VP                  VP                  4       4       VP                  P                  4        V P                  VP                  VP                  4       4       RRR4       R#   + '       g   i     R# ; i)zY
Removing a filesystem file reader from a reactor will make sure it is
no longer polled.
r	   r)   r*   N)r-   r
   r   r   r   r   r/   r   ÚassertInÚ_readerÚ
getReadersÚstopReadingÚassertNotIn©r   r   r   r2   Ústdios   &    r   Útest_removeReaderÚ!StdioFilesTests.test_removeReader`   sÃ   € ð
 ×#Ñ#Ó%ˆà�{‰{‹}ˆÜˆT�4Ó×ÑÔ ä�$˜×Ô äÜ“
Ø—h‘h“jØ—~‘~×,Ñ,Ó.Øô	ˆEð �M‰M˜%Ÿ-™-¨×);Ñ);Ó)=Ô>Ø�M‰M×%Ñ%Ô'Ø×Ñ˜UŸ]™]¨G×,>Ñ,>Ó,@ÔA÷ ××Òús   ÁB,DÄD	c                óö  € V P                  4       p\        V P                  4       R4      ;V n        p\	        4       p\        W2P                  4       V P                  P                  4       VR7      pVP                  P                  R4       V P                  VP                  VP                  4       4       VP                  P                  4        V P                  VP                  VP                  4       4       R# )zY
Removing a filesystem file writer from a reactor will make sure it is
no longer polled.
r	   r>   r?   N)r-   r   r
   r2   r   r   r/   r   r@   r.   rF   Ú_writerÚ
getWritersÚstopWritingrJ   )r   r   r2   r3   rL   s   &    r   Útest_removeWriterÚ!StdioFilesTests.test_removeWriterv   s¹   € ð
 ×#Ñ#Ó%ˆô ˜$Ÿ+™+›-¨Ó.Ð.ˆŒ�ô “:ˆÜØŸX™X›Z¨t¯~©~×/DÑ/DÓ/FÐPWô
ˆð 	×Ñ× Ñ  Ô*Ø�‰�e—m‘m W×%7Ñ%7Ó%9Ô:Ø�‰×!Ñ!Ô#Ø×Ñ˜Ÿ™¨×(:Ñ(:Ó(<Ö=r   c                óÆ  € V P                  4       pV P                  4       p\        VR4      P                  4        \        VR4      ;V n        p\        \        4       VP                  4       V P                  P                  4       VR7      pVP                  4       pV P                  VP                  V4       V P                  VP                  VP                  4       4       R# )zS
Calling C{removeAll} on a reactor includes descriptors that are
filesystem files.
r	   r)   r*   N)r-   r
   r   r   r2   r   r   r/   r   Ú	removeAllrF   rG   rJ   rH   )r   r   r   r2   rL   Úremoveds   &     r   Útest_removeAllÚStdioFilesTests.test_removeAllŠ   s±   € ð
 ×#Ñ#Ó%ˆà�{‰{‹}ˆÜˆT�4Ó×ÑÔ ô ˜$ Ó%Ð%ˆŒ�ô Ü‹JØ—(‘(“*Ø—>‘>×(Ñ(Ó*Øô	
ˆð ×#Ñ#Ó%ˆØ�‰�e—m‘m WÔ-Ø×Ñ˜Ÿ™¨×(:Ñ(:Ó(<Ö=r   c           	     óª  € V P                  4       pV P                  4       p\        VR4      P                  4        \        VR4      ;_uu_ 4       p\	        \        4       VP                  4       V P                  P                  4       VR7      pV P                  VP                  VP                  4       4       RRR4       R#   + '       g   i     R# ; i)zG
C{reactor.getReaders} includes descriptors that are filesystem files.
r	   r)   r*   N)r-   r
   r   r   r   r   r/   r   rF   rG   rH   rK   s   &    r   Útest_getReadersÚStdioFilesTests.test_getReaders£   s˜   € ð ×#Ñ#Ó%ˆà�{‰{‹}ˆÜˆT�4Ó×ÑÔ ô �$˜×Ô äÜ“
Ø—h‘h“jØ—~‘~×,Ñ,Ó.Øô	ˆEð �M‰M˜%Ÿ-™-¨×);Ñ);Ó)=Ô>÷ ××Òús   ÁA(CÃC	c                ó¾  € V P                  4       p\        V P                  4       R4      ;V n        p\	        \        4       VP                  4       V P                  P                  4       VR7      pV P                  VP                  VP                  4       4       VP                  P                  4        V P                  VP                  VP                  4       4       R# )zG
C{reactor.getWriters} includes descriptors that are filesystem files.
r	   r>   N)r-   r   r
   r2   r   r   r/   r   rJ   rP   rQ   ÚstartWritingrF   )r   r   r2   rL   s   &   r   Útest_getWritersÚStdioFilesTests.test_getWriters·   s¤   € ð ×#Ñ#Ó%ˆô ˜$Ÿ+™+›-¨Ó.Ð.ˆŒ�ô Ü‹JØ—8‘8“:Ø—.‘.×'Ñ'Ó)Øô	
ˆð 	×Ñ˜Ÿ™¨×(:Ñ(:Ó(<Ô=Ø�‰×"Ñ"Ô$Ø�‰�e—m‘m W×%7Ñ%7Ó%9Ö:r   zoStandardIO does not accept stdout as an argument to Windows. Testing redirection to a file is therefore harder.)r   r2   N)r    r!   r"   r#   Ú__doc__r   r4   rC   rM   rS   rX   r[   r_   r   Ú	isWindowsÚskipr$   r%   )r'   s   @r   r   r      sV   ø‡ € ñò.ò"3òH8ò@Bò,>ò(>ò2?ò(;ð( ×Ò×ÒðAö 	õ r   r   N)ra   Útwisted.internet.protocolr   Ú#twisted.internet.test.reactormixinsr   Útwisted.python.runtimer   rb   Útwisted.internet.stdior   r   ÚglobalsÚupdateÚmakeTestCaseClassesr   r   r   Ú<module>rk      sQ   ðñõ
 /Ý >Ý +à×Ò×ÒÝ1ô~
�nô ~
ñB ƒ	× Ñ �×4Ñ4Ó6Ö 7r   