CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/testutils.cpython-310.pyc

o

�b:�@szdZddlmZddlmZddlmZGdd�d�Zdd�Z	Gd	d
�d
�Z
Gdd�d�ZGd
d�d�ZGdd�d�Z
dS)a�
I{Private} test utilities for use throughout Twisted's test suite.  Unlike
C{proto_helpers}, this is no exception to the
don't-use-it-outside-Twisted-we-won't-maintain-compatibility rule!

@note: Maintainers be aware: things in this module should be gradually promoted
    to more full-featured test helpers and exposed as public API as your
    maintenance time permits.  In order to be public API though, they need
    their own test cases.
�)�BytesIO)�minidom)�FileWrapperc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�IOPumpz�Utility to pump data between clients and servers for protocol testing.

    Perhaps this is a utility worthy of being in protocol.py?
    cCs||_||_||_||_dS)N)�client�server�clientIO�serverIO)�selfrrrr	�r�8/usr/lib/python3/dist-packages/twisted/test/testutils.py�__init__s
zIOPump.__init__cCs|��r	|��sdSdS)z,Pump until there is no more input or output.N)�pump)r
rrr�flush!s�zIOPump.flushcCs�|j�d�|j�d�|j��}|j��}|j�d�|j�d�|j��|j��|D]}|j�|�q.|D]}|j�|�q9|sF|rHdSdS)zOMove data back and forth.

        Returns whether any data was moved.
        r�)r�seekr	�read�truncater�dataReceivedr)r
�cData�sData�byterrrr&s



zIOPump.pumpN)�__name__�
__module__�__qualname__�__doc__r
rrrrrrrs
rcCsJt�}t�}|�t|��|�t|��t||||�}|��|��|S)z-Take two Protocol instances and connect them.)r�makeConnectionrrr)rr�cio�siorrrr�returnConnected=src@�eZdZdZdd�ZdS)�XMLAssertionMixinz�
    Test mixin defining a method for comparing serialized XML documents.

    Must be mixed in to a L{test case<unittest.TestCase>}.
    cCs$|�t�|���t�|����dS)z�
        Verify that two strings represent the same XML document.

        @param first: An XML string.
        @type first: L{bytes}

        @param second: An XML string that should match C{first}.
        @type second: L{bytes}
        N)�assertEqual�dom�parseString�toxml)r
�first�secondrrr�assertXMLEqualRs
�z XMLAssertionMixin.assertXMLEqualN)rrrrr(rrrrr!Ksr!c@�"eZdZdZdedefdd�ZdS)�_EqualzN
    A class the instances of which are equal to anything and everything.
    �other�returncC�dS)NTr�r
r+rrr�__eq__f�z
_Equal.__eq__N�rrrr�object�boolr/rrrrr*a�r*c@r))�	_NotEqualz>
    A class the instances of which are equal to nothing.
    r+r,cCr-)NFrr.rrrr/or0z_NotEqual.__eq__Nr1rrrrr5jr4r5c@r )�ComparisonTestsMixina�
    A mixin which defines a method for making assertions about the correctness
    of an implementation of C{==} and C{!=}.

    Use this to unit test objects which follow the common convention for C{==}
    and C{!=}:

        - The object compares equal to itself
        - The object cooperates with unrecognized types to allow them to
          implement the comparison
        - The object implements not-equal as the opposite of equal
    cCs�|�||k�|�||k�|�||k�|�||k�|�||k�|�||k�|�|t�k�|�|t�k�|�|t�k�|�|t�k�dS)aU
        Assert that C{firstValueOne} is equal to C{secondValueOne} but not
        equal to C{valueOne} and that it defines equality cooperatively with
        other types it doesn't know about.

        @param firstValueOne: An object which is expected to compare as equal
            to C{secondValueOne} and not equal to C{valueTwo}.

        @param secondValueOne: A different object than C{firstValueOne} but
            which is expected to compare equal to that object.

        @param valueTwo: An object which is expected to compare as not equal to
            C{firstValueOne}.
        N)�
assertTrue�assertFalser*r5)r
�
firstValueOne�secondValueOne�valueTworrr�"assertNormalEqualityImplementation�sz7ComparisonTestsMixin.assertNormalEqualityImplementationN)rrrrr<rrrrr6ss
r6N)r�ior�xml.domrr#�twisted.internet.protocolrrrr!r*r5r6rrrr�<module>s(		
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY