+
    Dfj                         R t ^ RIt^ RIHt ^ RIHt ^ RIHt  ! R R4      t	R t
 ! R R	4      t ! R
 R4      t ! R R4      t ! R R4      tR t]! 4       tR tR# )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                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )IOPumpzUtility to pump data between clients and servers for protocol testing.

Perhaps this is a utility worthy of being in protocol.py?
c                6    Wn         W n        W0n        W@n        R # )N)clientserverclientIOserverIO)selfr   r	   r
   r   s   &&&&&8/usr/lib/python3/dist-packages/twisted/test/testutils.py__init__IOPump.__init__   s          c                6    V P                  4       '       d   K  R# )z,Pump until there is no more input or output.N)pump)r   s   &r   flushIOPump.flush"   s    iikk r   c                b   V P                   P                  ^ 4       V P                  P                  ^ 4       V P                   P                  4       pV P                  P                  4       pV P                   P                  ^ 4       V P                  P                  ^ 4       V P                   P	                  4        V P                  P	                  4        V F  pV P
                  P                  V4       K   	  V F  pV P                  P                  V4       K   	  V'       g	   V'       d   ^# ^ # )z?Move data back and forth.

Returns whether any data was moved.
)r
   seekr   readtruncater	   dataReceivedr   )r   cDatasDatabytes   &   r   r   IOPump.pump'   s    
 	11""$""$11  DKK$$T* DKK$$T* Er   )r   r
   r	   r   N)
__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     
!
 r   r   c                    \        4       p\        4       pVP                  \        V4      4       V P                  \        V4      4       \        WW#4      pVP	                  4        VP	                  4        V# )z-Take two Protocol instances and connect them.)r   makeConnectionr   r   r   )r	   r   ciosior   s   &&   r   returnConnectedr+   >   sY    
)C
)C
+c*+
+c*+&#+DJJLJJLKr   c                   *   a  ] tR t^Lt o RtR tRtV tR# )XMLAssertionMixinz~
Test mixin defining a method for comparing serialized XML documents.

Must be mixed in to a L{test case<unittest.TestCase>}.
c                    V P                  \        P                  ! V4      P                  4       \        P                  ! V4      P                  4       4       R# )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   assertXMLEqual XMLAssertionMixin.assertXMLEqualS   s;     	OOE"((*COOF,C,I,I,K	
r    N)r   r   r    r!   r"   r5   r#   r$   r%   s   @r   r-   r-   L   s     
 
r   r-   c                   6   a  ] tR t^bt o RtV 3R lR ltRtV tR# )_EqualzF
A class the instances of which are equal to anything and everything.
c                &   < V ^8  d   QhRS[ RS[/#    otherreturnobjectbool)formatr&   s   "r   __annotate___Equal.__annotate__g   s      F t r   c                    R # )Tr7   r   r=   s   &&r   __eq___Equal.__eq__g   s    r   r7   Nr   r   r    r!   r"   rG   r#   r$   r%   s   @r   r9   r9   b   s      r   r9   c                   6   a  ] tR t^kt o RtV 3R lR ltRtV tR# )	_NotEqualz6
A class the instances of which are equal to nothing.
c                &   < V ^8  d   QhRS[ RS[/# r;   r?   )rB   r&   s   "r   rC   _NotEqual.__annotate__p   s      F t r   c                    R # )Fr7   rF   s   &&r   rG   _NotEqual.__eq__p   s    r   r7   NrI   r%   s   @r   rK   rK   k   s      r   rK   c                   *   a  ] tR t^tt o RtR tRtV t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
c                   V P                  W8H  4       V P                  W8H  4       V P                  W8H  4       V P                  W8g  4       V P                  W8g  4       V P                  W8g  4       V P                  V\        4       8H  4       V P                  V\        4       8g  4       V P                  V\        4       8H  4       V P                  V\        4       8g  4       R# )a  
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assertFalser9   rK   )r   firstValueOnesecondValueOnevalueTwos   &&&&r   "assertNormalEqualityImplementation7ComparisonTestsMixin.assertNormalEqualityImplementation   s    . 	67782378891212&(23)+5645r   r7   N)r   r   r    r!   r"   rX   r#   r$   r%   s   @r   rQ   rQ   t   s      6  6r   rQ   c                     Rp Rp \         P                   ! \         P                  4      p V P                  R4       RpV '       d   V P	                  4        V#   \         d     L'i ; i)z4Returns True if the system can bind an IPv6 address.NFT)z::1    )socketAF_INET6bindOSErrorclose)sockhas_ipv6s     r   	_has_ipv6rc      s[    DH}}V__-		* 

O  s   7A A%$A%c                 ,    \         '       g   R V n        V # )z.Does not work on systems without IPv6 support.)HAS_IPV6skip)fs   &r   skipWithoutIPv6rh      s    8AHr   )r"   r\   ior   xml.domr   r0   twisted.internet.protocolr   r   r+   r-   r9   rK   rQ   rc   re   rh   r7   r   r   <module>rl      sd   	   " 1% %P
 
,  .6 .6b" ;r   