Ë
    oj:  ã                   ó–   — d Z ddlmZ ddlmZ ddlmZ  G d„ d«      Zd„ Z	 G d„ d	«      Z
 G d
„ d«      Z G d„ d«      Z G d„ d«      Zy)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                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)ÚIOPumpzŠUtility to pump data between clients and servers for protocol testing.

    Perhaps this is a utility worthy of being in protocol.py?
    c                 ó<   — || _         || _        || _        || _        y )N)ÚclientÚserverÚclientIOÚserverIO)Úselfr	   r
   r   r   s        ú8/usr/lib/python3/dist-packages/twisted/test/testutils.pyÚ__init__zIOPump.__init__   s   € ØˆŒØˆŒØ ˆŒØ ˆ�ó    c                 óJ   — | j                  «       r	 | j                  «       rŒyy)z,Pump until there is no more input or output.N)Úpump)r   s    r   ÚflushzIOPump.flush!   s   € à�i‰iŒkØð �i‰i�kr   c                 ó>  — | j                   j                  d«       | j                  j                  d«       | j                   j                  «       }| j                  j                  «       }| j                   j                  d«       | j                  j                  d«       | j                   j	                  «        | j                  j	                  «        |D ]  }| j
                  j                  |«       Œ |D ]  }| j                  j                  |«       Œ |s|ryy)zOMove data back and forth.

        Returns whether any data was moved.
        r   é   )r   Úseekr   ÚreadÚtruncater
   ÚdataReceivedr	   )r   ÚcDataÚsDataÚbytes       r   r   zIOPump.pump&   sÝ   € ð
 	�‰×Ñ˜1ÔØ�‰×Ñ˜1ÔØ—‘×"Ñ"Ó$ˆØ—‘×"Ñ"Ó$ˆØ�‰×Ñ˜1ÔØ�‰×Ñ˜1ÔØ�‰×ÑÔ Ø�‰×ÑÔ Øò 	+ˆDØ�K‰K×$Ñ$ TÕ*ð	+àò 	+ˆDØ�K‰K×$Ñ$ TÕ*ð	+á‘EØàr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   © r   r   r   r      s   „ ñò
!òó
r   r   c                 óò   — t        «       }t        «       }|j                  t        |«      «       | j                  t        |«      «       t        || ||«      }|j	                  «        |j	                  «        |S )z-Take two Protocol instances and connect them.)r   ÚmakeConnectionr   r   r   )r
   r	   ÚcioÚsior   s        r   ÚreturnConnectedr&   =   s]   € ä
‹)€CÜ
‹)€CØ
×Ñœ+ cÓ*Ô+Ø
×Ñœ+ cÓ*Ô+Ü�&˜& # sÓ+€Dà‡J�J„Là‡J�J„LØ€Kr   c                   ó   — e Zd ZdZd„ Zy)ÚXMLAssertionMixinzŠ
    Test mixin defining a method for comparing serialized XML documents.

    Must be mixed in to a L{test case<unittest.TestCase>}.
    c                 ó¬   — | j                  t        j                  |«      j                  «       t        j                  |«      j                  «       «       y)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Úseconds      r   ÚassertXMLEqualz XMLAssertionMixin.assertXMLEqualR   s;   € ð 	×ÑÜ�O‰O˜EÓ"×(Ñ(Ó*¬C¯O©O¸FÓ,C×,IÑ,IÓ,Kõ	
r   N)r   r   r   r    r0   r!   r   r   r(   r(   K   s   „ ñó
r   r(   c                   ó    — e Zd ZdZdedefd„Zy)Ú_EqualzN
    A class the instances of which are equal to anything and everything.
    ÚotherÚreturnc                  ó   — y)NTr!   ©r   r3   s     r   Ú__eq__z_Equal.__eq__f   s   € Ør   N©r   r   r   r    ÚobjectÚboolr7   r!   r   r   r2   r2   a   s   „ ñð˜Fð  tô r   r2   c                   ó    — e Zd ZdZdedefd„Zy)Ú	_NotEqualz>
    A class the instances of which are equal to nothing.
    r3   r4   c                  ó   — y)NFr!   r6   s     r   r7   z_NotEqual.__eq__o   s   € Ør   Nr8   r!   r   r   r<   r<   j   s   „ ñð˜Fð  tô r   r<   c                   ó   — e Zd ZdZd„ Zy)Ú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
    c                 óÔ  — | j                  ||k(  «       | j                  ||k(  «       | j                  ||k(  «       | j                  ||k7  «       | j                  ||k7  «       | j                  ||k7  «       | j                  |t        «       k(  «       | j                  |t        «       k7  «       | j                  |t        «       k(  «       | j                  |t        «       k7  «       y)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ÚassertFalser2   r<   )r   ÚfirstValueOneÚsecondValueOneÚvalueTwos       r   Ú"assertNormalEqualityImplementationz7ComparisonTestsMixin.assertNormalEqualityImplementation�   sÀ   € ð. 	�‰˜¨Ñ6Ô7Ø�‰˜¨Ñ7Ô8Ø×Ñ˜¨(Ñ2Ô3Ø×Ñ˜¨-Ñ7Ô8Ø×Ñ˜¨.Ñ8Ô9Ø�‰˜¨Ñ1Ô2Ø�‰˜¬«Ñ1Ô2Ø×Ñ˜¬&«(Ñ2Ô3Ø×Ñ˜¬)«+Ñ5Ô6Ø�‰˜¬«Ñ4Õ5r   N)r   r   r   r    rF   r!   r   r   r?   r?   s   s   „ ñó 6r   r?   N)r    Úior   Úxml.domr   r+   Útwisted.internet.protocolr   r   r&   r(   r2   r<   r?   r!   r   r   ú<module>rJ      sM   ðñ	õ Ý "å 1÷%ñ %òP÷
ñ 
÷,ñ ÷ñ ÷.6ò .6r   