ó
    ×›‘h  ã                   ó¸   • S r SSKrSSKJr  SSKJr  SSKJr   " S S5      r	S r
 " S	 S
5      r " S S5      r " S S5      r " S S5      rS r\" 5       rS rg)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                   ó*   • \ rS rSrSrS rS rS rSrg)ÚIOPumpé   z‚Utility to pump data between clients and servers for protocol testing.

Perhaps this is a utility worthy of being in protocol.py?
c                 ó4   • Xl         X l        X0l        X@l        g )N)ÚclientÚserverÚclientIOÚserverIO)Úselfr
   r   r   r   s        ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/testutils.pyÚ__init__ÚIOPump.__init__   s   € ØŒØŒØ ŒØ �ó    c                 ó`   • U R                  5       (       a   U R                  5       (       a  M  gg)z,Pump until there is no more input or output.N)Úpump)r   s    r   ÚflushÚIOPump.flush"   s   € à�i‰i�k‰kØð �i‰i�k�kr   c                 óZ  • U R                   R                  S5        U R                  R                  S5        U R                   R                  5       nU R                  R                  5       nU R                   R                  S5        U R                  R                  S5        U R                   R	                  5         U R                  R	                  5         U H  nU R
                  R                  U5        M      U H  nU R                  R                  U5        M      U(       d  U(       a  gg)z?Move data back and forth.

Returns whether any data was moved.
r   é   )r   Úseekr   ÚreadÚtruncater   ÚdataReceivedr
   )r   ÚcDataÚsDataÚbytes       r   r   ÚIOPump.pump'   sÓ   € ð
 	�‰×Ñ˜1ÔØ�‰×Ñ˜1ÔØ—‘×"Ñ"Ó$ˆØ—‘×"Ñ"Ó$ˆØ�‰×Ñ˜1ÔØ�‰×Ñ˜1ÔØ�‰×ÑÔ Ø�‰×ÑÔ ÛˆDØ�K‰K×$Ñ$ TÖ*ñ ãˆDØ�K‰K×$Ñ$ TÖ*ñ æ–EØàr   )r
   r   r   r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   Ú__static_attributes__© r   r   r   r      s   † ñò
!òõ
r   r   c                 óî   • [        5       n[        5       nUR                  [        U5      5        U R                  [        U5      5        [        XX#5      nUR	                  5         UR	                  5         U$ )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à‡J�J„Là‡J�J„LØ€Kr   c                   ó   • \ rS rSrSrS rSrg)ÚXMLAssertionMixinéL   z~
Test mixin defining a method for comparing serialized XML documents.

Must be mixed in to a L{test case<unittest.TestCase>}.
c                 ó°   • U R                  [        R                  " U5      R                  5       [        R                  " U5      R                  5       5        g)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;   € ð 	×ÑÜ�OŠO˜EÓ"×(Ñ(Ó*¬C¯OªO¸FÓ,C×,IÑ,IÓ,Kõ	
r   r'   N)r!   r"   r#   r$   r%   r7   r&   r'   r   r   r.   r.   L   s   † ñõ
r   r.   c                   ó*   • \ rS rSrSrS\S\4S jrSrg)Ú_Equaléb   zF
A class the instances of which are equal to anything and everything.
ÚotherÚreturnc                 ó   • g)NTr'   ©r   r<   s     r   Ú__eq__Ú_Equal.__eq__g   s   € Ør   r'   N©	r!   r"   r#   r$   r%   ÚobjectÚboolr@   r&   r'   r   r   r:   r:   b   s   † ñð˜Fð  t÷ r   r:   c                   ó*   • \ rS rSrSrS\S\4S jrSrg)Ú	_NotEqualék   z6
A class the instances of which are equal to nothing.
r<   r=   c                 ó   • g)NFr'   r?   s     r   r@   Ú_NotEqual.__eq__p   s   € Ør   r'   NrB   r'   r   r   rF   rF   k   s   † ñð˜Fð  t÷ r   rF   c                   ó   • \ rS rSrSrS rSrg)ÚComparisonTestsMixinét   aš  
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                 óÈ  • U R                  X:H  5        U R                  X:H  5        U R                  X:H  5        U R                  X:g  5        U R                  X:g  5        U R                  X:g  5        U R                  U[        5       :H  5        U R                  U[        5       :g  5        U R                  U[        5       :H  5        U R                  U[        5       :g  5        g)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ÚassertFalser:   rF   )r   ÚfirstValueOneÚsecondValueOneÚvalueTwos       r   Ú"assertNormalEqualityImplementationÚ7ComparisonTestsMixin.assertNormalEqualityImplementation‚   s´   € ð. 	�‰˜Ñ6Ô7Ø�‰˜Ñ7Ô8Ø×Ñ˜Ñ2Ô3Ø×Ñ˜Ñ7Ô8Ø×Ñ˜Ñ8Ô9Ø�‰˜Ñ1Ô2Ø�‰˜¬«Ñ1Ô2Ø×Ñ˜¬&«(Ñ2Ô3Ø×Ñ˜¬)«+Ñ5Ô6Ø�‰˜¬«Ñ4Õ5r   r'   N)r!   r"   r#   r$   r%   rS   r&   r'   r   r   rK   rK   t   s   † ñõ 6r   rK   c                  óÌ   • Sn Sn [         R                   " [         R                  5      n U R                  S5        SnU (       a  U R	                  5         U$ ! [         a     N%f = f)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_ipv6r]   ¥   s[   € à€DØ€HðÜ�}Š}œVŸ_™_Ó-ˆØ�	‰	�*ÔØˆö Ø�
‰
ŒØ€Oøô ó Ùðús   †7A Á
A#Á"A#c                 ó*   • [         (       d  SU l        U $ )Nz.Does not work on systems without IPv6 support.)ÚHAS_IPV6Úskip)Úfs    r   ÚskipWithoutIPv6rb   ¹   s   € ßŠ8ØAˆŒØ€Hr   )r%   rV   Úior   Úxml.domr   r2   Útwisted.internet.protocolr   r   r,   r.   r:   rF   rK   r]   r_   rb   r'   r   r   Ú<module>rf      sd   ðñ	ó Ý Ý "å 1÷%ñ %òP÷
ñ 
÷,ñ ÷ñ ÷.6ñ .6òbñ" ‹;€ór   