+
    üÐjÉ
  ã                   ó|   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt  ! R R]4      t	 ! R R]4      t
 ! R	 R
]4      tR# )zA
Whitebox tests for L{twisted.internet.abstract.FileDescriptor}.
)ÚverifyClass)ÚFileDescriptor)ÚIPushProducer)ÚSynchronousTestCasec                   ó@   a € ] tR t^t o RtRtR tR tR tR t	Rt
V tR# )	Ú
MemoryFilea  
A L{FileDescriptor} customization which writes to a Python list in memory
with certain limitations.

@ivar _written: A C{list} of C{bytes} which have been accepted as written.

@ivar _freeSpace: A C{int} giving the number of bytes which will be accepted
    by future writes.
Tc                ób   € \         P                  ! V \        4       R 7       . V n        ^ V n        R# )©ÚreactorN)r   Ú__init__ÚobjectÚ_writtenÚ
_freeSpace©Úselfs   &ÚK/usr/lib/python3/dist-packages/twisted/internet/test/test_filedescriptor.pyr   ÚMemoryFile.__init__   s"   € Ü×Ò ¬f«hÕ7ØˆŒØˆŽó    c                ó   € R # ©N© r   s   &r   ÚstartWritingÚMemoryFile.startWriting"   ó   € Ùr   c                ó   € R # r   r   r   s   &r   ÚstopWritingÚMemoryFile.stopWriting%   r   r   c                óÂ   € \        V P                  \        V4      4      pV'       d8   V ;P                  V,          un        V P                  P	                  VRV 4       V# )z’
Copy at most C{self._freeSpace} bytes from C{data} into C{self._written}.

@return: A C{int} indicating how many bytes were copied from C{data}.
N)Úminr   Úlenr   Úappend)r   ÚdataÚacceptLengths   && r   ÚwriteSomeDataÚMemoryFile.writeSomeData(   sH   € ô ˜4Ÿ?™?¬C°«IÓ6ˆßØ�OŠO˜|Õ+�OØ�M‰M× Ñ   m |Ð!4Ô5ØÐr   )r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	connectedr   r   r   r#   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s*   ø‡ € ñð €Iòò
ò÷
ð 
r   r   c                   ó6   a € ] tR t^5t o RtR tR tR tRtV t	R# )ÚFileDescriptorTestsz
Tests for L{FileDescriptor}.
c                óp   € \        \        4       R7      pV P                  \        VP                  R4       R# )z6
L{FileDescriptor.write} doesn't accept unicode data.
r	   ÚfooN)r   r   ÚassertRaisesÚ	TypeErrorÚwrite©r   ÚfileDescriptors   & r   Ú$test_writeWithUnicodeRaisesExceptionÚ8FileDescriptorTests.test_writeWithUnicodeRaisesException:   s(   € ô (´³Ô9ˆØ×Ñœ) ^×%9Ñ%9¸5ÖAr   c                ót   € \        \        4       R7      pV P                  \        VP                  . RO4       R# )z>
L{FileDescriptor.writeSequence} doesn't accept unicode data.
r	   N)s   fooÚbars   baz)r   r   r3   r4   ÚwriteSequencer6   s   & r   Ú,test_writeSequenceWithUnicodeRaisesExceptionÚ@FileDescriptorTests.test_writeSequenceWithUnicodeRaisesExceptionA   s,   € ô (´³Ô9ˆØ×ÑÜ�~×3Ñ3Ò5Lö	
r   c                óL   € V P                  \        \        \        4      4       R# )z6
L{FileDescriptor} should implement L{IPushProducer}.
N)Ú
assertTruer   r   r   r   s   &r   Ú$test_implementInterfaceIPushProducerÚ8FileDescriptorTests.test_implementInterfaceIPushProducerJ   s   € ð 	�‰œ¤M´>ÓBÖCr   r   N)
r%   r&   r'   r(   r)   r8   r=   rA   r+   r,   r-   s   @r   r0   r0   5   s!   ø‡ € ñòBò
÷Dð Dr   r0   c                   ó*   a € ] tR t^Qt o RtR tRtV tR# )ÚWriteDescriptorTestszF
Tests for L{FileDescriptor}'s implementation of L{IWriteDescriptor}.
c                óz   € \        4       pVP                  R4       V P                  VP                  4       4       R# )z“
When L{FileDescriptor.writeSomeData} returns C{0} to indicate no more
data can be written immediately, L{FileDescriptor.doWrite} returns
L{None}.
s   hello, worldN)r   r5   ÚassertIsNoneÚdoWrite)r   Ú
descriptors   & r   Útest_kernelBufferFullÚ*WriteDescriptorTests.test_kernelBufferFullV   s0   € ô  “\ˆ
Ø×Ñ˜Ô)Ø×Ñ˜*×,Ñ,Ó.Ö/r   r   N)r%   r&   r'   r(   r)   rI   r+   r,   r-   s   @r   rD   rD   Q   s   ø‡ € ñ÷0ð 0r   rD   N)r)   Úzope.interface.verifyr   Útwisted.internet.abstractr   Útwisted.internet.interfacesr   Útwisted.trial.unittestr   r   r0   rD   r   r   r   Ú<module>rO      sA   ðñõ
 .å 4Ý 5Ý 6ô"�ô "ôJDÐ-ô Dô80Ð.ö 0r   