+
    Dfj                        R t ^ RIHt ^ RIHt ^ RIHtHtHt	 ^ RI
HtHt ^ RIHt ^RIHt  ! R R]4      t ! R	 R
]4      t ! R R]4      tR# )zY
Tests for L{twisted.internet.abstract}, a collection of APIs for implementing
reactors.
)annotations)Union)examplegiven
strategies)FileDescriptorisIPv6Address)SynchronousTestCase)_FakeFDSetReactorc                  b    ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
RtR# )IPv6AddressTestszk
Tests for L{isIPv6Address}, a function for determining if a particular
string is an IPv6 address literal.
c                   V ^8  d   QhRR/#    returnNone )formats   "E/usr/lib/python3/dist-packages/twisted/internet/test/test_abstract.py__annotate__IPv6AddressTests.__annotate__   s     , ,D ,    c                :    V P                  \        R4      4       R# )z2
The empty string is not an IPv6 address literal.
 NassertFalser   selfs   &r   
test_emptyIPv6AddressTests.test_empty   s     	r*+r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     - -D -r   c                :    V P                  \        R4      4       R# )z1
A single C{":"} is not an IPv6 address literal.
:Nr   r   s   &r   
test_colonIPv6AddressTests.test_colon   s     	s+,r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   %   s     . .t .r   c                :    V P                  \        R4      4       R# )z0
C{"::1"} is the IPv6 loopback address literal.
z::1N
assertTruer   r   s   &r   test_loopbackIPv6AddressTests.test_loopback%   s     	e,-r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   +   s     6 6d 6r   c                    V P                  \        R4      4       V P                  \        R4      4       V P                  \        R4      4       R# )zn
An otherwise valid IPv6 address literal may also include a C{"%"}
followed by an arbitrary scope identifier.
zfe80::1%eth0	fe80::2%1zfe80::3%en2Nr'   r   s   &r   test_scopeIDIPv6AddressTests.test_scopeID+   s7    
 	n56k23m45r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   4   s     6 6 6r   c                    V P                  \        R4      4       V P                  \        R4      4       V P                  \        R4      4       R# )z^
An otherwise invalid IPv6 address literal is still invalid with a
trailing scope identifier.
z%eth0z:%eth0
hello%eth0Nr   r   s   &r   test_invalidWithScopeID(IPv6AddressTests.test_invalidWithScopeID4   s=    
 	w/0x01|45r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   =   s     
7 
7d 
7r   c                
   V P                  \        R4      4       V P                  \        R4      4       V P                  \        R4      4       V P                  \        R4      4       V P                  \        R4      4       R# )zA
L{isIPv6Address} evaluates ASCII-encoded bytes as well as text.
s	   fe80::2%1r-   u   䌡r2   s
   hello%eth0N)r(   r   r   r   s   &r   test_unicodeAndBytes%IPv6AddressTests.test_unicodeAndBytes=   s_     	l34k23x01|45}56r   r   N)__name__
__module____qualname____firstlineno____doc__r   r#   r)   r.   r3   r7   __static_attributes__r   r   r   r   r      s*    
,-.66
7 
7r   r   c                  :    ] tR t^JtRtRtRtR R ltR R ltRt	R	# )
TrackingFileDescriptorz6
Write a limited amount, and track what gets written.
TFc               $    V ^8  d   QhRRRRRR/# )r   
operationszlist[Union[int, bytes]]writtenzlist[bytes]
send_limitintr   )r   s   "r   r   #TrackingFileDescriptor.__annotate__S   s$     ; ;1;<G;UX;r   c                	h    Wn         W n        W0n        \        P                  ! V \        4       4       R # N)rB   rC   
SEND_LIMITr   __init__r
   )r   rB   rC   rD   s   &&&&r   rJ   TrackingFileDescriptor.__init__S   s'     %$&7&9:r   c                    V ^8  d   QhRRRR/# )r   databytesr   rE   r   )r   s   "r   r   rF   [   s      % C r   c                	    V P                   P                  ^ 4      p\        V\        4      '       g   Q h\	        V\        V4      4      pV P                  P                  VRV 4       V# )    N)rB   pop
isinstancerE   minlenrC   append)r   rM   toWrites   && r   writeSomeData$TrackingFileDescriptor.writeSomeData[   sV    //%%a('3''''gs4y)D'N+r   )rI   rB   rC   N)
r9   r:   r;   r<   r=   	connected_writeDisconnectedrJ   rW   r>   r   r   r   r@   r@   J   s#    
 I; r   r@   c                      ] tR t^ctRt]! ]P                  ! ]P                  ! ]P                  ! ^^
R7      ]P                  ! ^ ^
R7      4      ^^R7      R7      ]! . R	OR7      R R l4       4       tRtR# )
WriteBufferingTestsz=
Tests for the complex logic in the L{FileDescriptor} class.
)min_sizemax_size)	min_value	max_value)rB   c                    V ^8  d   QhRRRR/# )r   rB   zlist[Union[bytes, int]]r   r   r   )r   s   "r   r    WriteBufferingTests.__annotate__t   s     + +.E +$ +r   c                   RP                  R V 4       4      p. p^p\        WV4      pW^,          .^\        V4      V,          ,           ,          ,          pV'       dR   \        V^ ,          \        4      '       d#   VP                  VP                  ^ 4      4       KG  VP                  4        KY  RP                  V4      pV P                  W&4       R# )a-  
A sequence of C{write()} and C{doWrite()} will eventually write all the
data correctly and in order.

@param operations: A list of C{bytes} (indicating a C{write()}) or
    C{int} (indicating C{doWrite()} with the integer being how much
    C{writeSomeData()} writeSomeData will successfully write).
r   c              3  V   "   T F  p\        V\        4      '       g   K  Vx  K!  	  R # 5irH   )rR   rN   ).0ops   & r   	<genexpr>:WriteBufferingTests.test_writeBuffering.<locals>.<genexpr>}   s     M2z"e7LBBs   )
)N)	joinr@   rT   rR   rN   writerQ   doWriteassertEqual)r   rB   expectedrC   rI   fdresults   &&     r   test_writeBuffering'WriteBufferingTests.test_writeBufferingh   s    * 88MMM!
 
#JD 	A~&!c(mz.I*IJJ
*Q-//*+

'"*r   r   N)s   abcdefrP      g)r9   r:   r;   r<   r=   r   stlistsone_ofbinaryintegersr   rp   r>   r   r   r   r\   r\   c   sl     88II		1r2a26 
	 ,-+ .	+r   r\   N)r=   
__future__r   typingr   
hypothesisr   r   r   rs   twisted.internet.abstractr   r   twisted.trial.unittestr	   test_tcpr
   r   r@   r\   r   r   r   <module>r~      sH    #  7 7 C 6 '47* 47n^ 2-+- -+r   