§
    Ètºf  ã                   óÞ   — d Z ddl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d„ Z e¦   «         Zd„ ZdS )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.
é    N)ÚBytesIO)Úminidom)ÚFileWrapperc                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚIOPumpzŠUtility to pump data between clients and servers for protocol testing.

    Perhaps this is a utility worthy of being in protocol.py?
    c                 ó>   — || _         || _        || _        || _        d S )N)ÚclientÚserverÚclientIOÚserverIO)Úselfr	   r
   r   r   s        úU/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/test/testutils.pyÚ__init__zIOPump.__init__   s"   € ØˆŒØˆŒØ ˆŒØ ˆŒˆˆó    c                 ó\   — |                       ¦   «         r	 |                       ¦   «         °dS dS )z,Pump until there is no more input or output.N)Úpump)r   s    r   ÚflushzIOPump.flush"   s;   € à�iŠi‰kŒkð 	Øð �iŠi‰kŒkð 	ð 	ð 	ð 	ð 	r   c                 ó&  — | j                              d¦  «         | j                             d¦  «         | j                              ¦   «         }| j                             ¦   «         }| j                              d¦  «         | j                             d¦  «         | j                              ¦   «          | j                             ¦   «          |D ]}| j                             |¦  «         Œ|D ]}| j                             |¦  «         Œ|s|rdS dS )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×$Ò$ TÑ*Ô*Ð*Ð*Øð 	+ð 	+ˆDØŒK×$Ò$ TÑ*Ô*Ð*Ð*Øð 	�Eð 	Ø�1à�1r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   © r   r   r   r      sK   € € € € € ðð ð
!ð !ð !ðð ð ð
ð ð ð ð r   r   c                 ó:  — t          ¦   «         }t          ¦   «         }|                     t          |¦  «        ¦  «         |                      t          |¦  «        ¦  «         t          || ||¦  «        }|                     ¦   «          |                     ¦   «          |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„L€Là‡J‚J�L„L€LØ€Kr   c                   ó   — e Zd ZdZd„ ZdS )ÚXMLAssertionMixinzŠ
    Test mixin defining a method for comparing serialized XML documents.

    Must be mixed in to a L{test case<unittest.TestCase>}.
    c                 óÂ   — |                       t          j        |¦  «                             ¦   «         t          j        |¦  «                             ¦   «         ¦  «         dS )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.assertXMLEqualS   sW   € ð 	×ÒÝŒO˜EÑ"Ô"×(Ò(Ñ*Ô*­C¬O¸FÑ,CÔ,C×,IÒ,IÑ,KÔ,Kñ	
ô 	
ð 	
ð 	
ð 	
r   N)r   r   r   r    r0   r!   r   r   r(   r(   L   s-   € € € € € ðð ð
ð 
ð 
ð 
ð 
r   r(   c                   ó"   — e Zd ZdZdedefd„ZdS )Ú_EqualzN
    A class the instances of which are equal to anything and everything.
    ÚotherÚreturnc                 ó   — dS )NTr!   ©r   r3   s     r   Ú__eq__z_Equal.__eq__g   s   € Øˆtr   N©r   r   r   r    ÚobjectÚboolr7   r!   r   r   r2   r2   b   s@   € € € € € ðð ð˜Fð  tð ð ð ð ð ð r   r2   c                   ó"   — e Zd ZdZdedefd„ZdS )Ú	_NotEqualz>
    A class the instances of which are equal to nothing.
    r3   r4   c                 ó   — dS )NFr!   r6   s     r   r7   z_NotEqual.__eq__p   s   € Øˆur   Nr8   r!   r   r   r<   r<   k   s@   € € € € € ðð ð˜Fð  tð ð ð ð ð ð r   r<   c                   ó   — e Zd ZdZd„ ZdS )Ú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                 óZ  — |                       ||k    ¦  «         |                       ||k    ¦  «         |                      ||k    ¦  «         |                      ||k    ¦  «         |                      ||k    ¦  «         |                       ||k    ¦  «         |                       |t          ¦   «         k    ¦  «         |                      |t          ¦   «         k    ¦  «         |                      |t          ¦   «         k    ¦  «         |                       |t          ¦   «         k    ¦  «         dS )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Ð7Ø�Š˜¨Ò7Ñ8Ô8Ð8Ø×Ò˜¨(Ò2Ñ3Ô3Ð3Ø×Ò˜¨-Ò7Ñ8Ô8Ð8Ø×Ò˜¨.Ò8Ñ9Ô9Ð9Ø�Š˜¨Ò1Ñ2Ô2Ð2Ø�Š˜­©¬Ò1Ñ2Ô2Ð2Ø×Ò˜­&©(¬(Ò2Ñ3Ô3Ð3Ø×Ò˜­)©+¬+Ò5Ñ6Ô6Ð6Ø�Š˜­©¬Ò4Ñ5Ô5Ð5Ð5Ð5r   N)r   r   r   r    rF   r!   r   r   r?   r?   t   s-   € € € € € ðð ð 6ð  6ð  6ð  6ð  6r   r?   c                  óÈ   — d} d}	 t          j         t           j        ¦  «        } |                      d¦  «         d}n# t          $ r Y nw xY w| r|                      ¦   «          |S )z4Returns True if the system can bind an IPv6 address.NF)z::1r   T)ÚsocketÚAF_INET6ÚbindÚOSErrorÚclose)ÚsockÚhas_ipv6s     r   Ú	_has_ipv6rO   ¥   sw   € à€DØ€HðÝŒ}�Vœ_Ñ-Ô-ˆØ�	Š	�*ÑÔÐØˆˆøÝð ð ð Øˆðøøøð ð Ø�
Š
‰ŒˆØ€Os   †5< ¼
A	ÁA	c                 ó"   — t           sd| _        | S )Nz.Does not work on systems without IPv6 support.)ÚHAS_IPV6Úskip)Úfs    r   ÚskipWithoutIPv6rT   ¹   s   € Ýð BØAˆŒØ€Hr   )r    rH   Úior   Úxml.domr   r+   Útwisted.internet.protocolr   r   r&   r(   r2   r<   r?   rO   rQ   rT   r!   r   r   ú<module>rX      s^  ðð	ð 	ð €€€Ø Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "à 1Ð 1Ð 1Ð 1Ð 1Ð 1ð%ð %ð %ð %ð %ñ %ô %ð %ðPð ð ð
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð,ð ð ð ð ñ ô ð ðð ð ð ð ñ ô ð ð.6ð .6ð .6ð .6ð .6ñ .6ô .6ð .6ðbð ð ð" ˆ9‰;Œ;€ðð ð ð ð r   