ó
    Ö›‘hÕ  ã                  óž   • S r SSKJr  SSKJr  SSKJrJrJr	  SSK
JrJr  SSKJr  SSKJr   " S	 S
\5      r " S S\5      r " S S\5      rg)zY
Tests for L{twisted.internet.abstract}, a collection of APIs for implementing
reactors.
é    )Úannotations)ÚUnion)ÚexampleÚgivenÚ
strategies)ÚFileDescriptorÚisIPv6Address)ÚSynchronousTestCaseé   )Ú_FakeFDSetReactorc                  óT   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
S	rg
)ÚIPv6AddressTestsé   zk
Tests for L{isIPv6Address}, a function for determining if a particular
string is an IPv6 address literal.
c                ó8   • U R                  [        S5      5        g)z2
The empty string is not an IPv6 address literal.
Ú N©ÚassertFalser	   ©Úselfs    ÚgC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/internet/test/test_abstract.pyÚ
test_emptyÚIPv6AddressTests.test_empty   s   € ð 	×Ñœ rÓ*Õ+ó    c                ó8   • U R                  [        S5      5        g)z1
A single C{":"} is not an IPv6 address literal.
Ú:Nr   r   s    r   Ú
test_colonÚIPv6AddressTests.test_colon   s   € ð 	×Ñœ sÓ+Õ,r   c                ó8   • U R                  [        S5      5        g)z0
C{"::1"} is the IPv6 loopback address literal.
z::1N©Ú
assertTruer	   r   s    r   Útest_loopbackÚIPv6AddressTests.test_loopback%   s   € ð 	�‰œ eÓ,Õ-r   c                ó    • U R                  [        S5      5        U R                  [        S5      5        U R                  [        S5      5        g)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                ó    • U R                  [        S5      5        U R                  [        S5      5        U R                  [        S5      5        g)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                ó  • U R                  [        S5      5        U R                  [        S5      5        U R                  [        S5      5        U R                  [        S5      5        U R                  [        S5      5        g)zA
L{isIPv6Address} evaluates ASCII-encoded bytes as well as text.
s	   fe80::2%1r$   u   äŒ¡r(   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   © N)ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r!   r%   r)   r,   Ú__static_attributes__r.   r   r   r   r      s%   † ñô
,ô-ô.ô6ô6÷
7r   r   c                  ó@   • \ rS rSrSrSrSr      S	S jrS
S jrSr	g)ÚTrackingFileDescriptoréJ   z6
Write a limited amount, and track what gets written.
TFc                óf   • Xl         X l        X0l        [        R                  " U [        5       5        g ©N)Ú
operationsÚwrittenÚ
SEND_LIMITr   Ú__init__r   )r   r<   r=   Ú
send_limits       r   r?   ÚTrackingFileDescriptor.__init__S   s'   € ð %ŒØŒØ$ŒÜ×Ò Ô&7Ó&9Õ:r   c                óÐ   • U R                   R                  S5      n[        U[        5      (       d   e[	        U[        U5      5      nU R                  R                  US U 5        U$ )Nr   )r<   ÚpopÚ
isinstanceÚintÚminÚlenr=   Úappend)r   ÚdataÚtoWrites      r   ÚwriteSomeDataÚ$TrackingFileDescriptor.writeSomeData[   sV   € Ø—/‘/×%Ñ% aÓ(ˆÜ˜'¤3×'Ñ'Ð'Ð'Ü�gœs 4›yÓ)ˆØ�‰×Ñ˜D  '˜NÔ+Øˆr   )r>   r<   r=   N)r<   zlist[Union[int, bytes]]r=   zlist[bytes]r@   rE   )rI   Úbytesr/   rE   )
r1   r2   r3   r4   r5   Ú	connectedÚ_writeDisconnectedr?   rK   r6   r.   r   r   r8   r8   J   s6   † ñð
 €IØÐð;Ø1ð;Ø<Gð;ØUXô;÷r   r8   c                  óÈ   • \ rS rSrSr\" \R                  " \R                  " \R                  " SSS9\R                  " SSS95      SS	S9S
9\" / SQS
9SS j5       5       rSrg)ÚWriteBufferingTestséc   z=
Tests for the complex logic in the L{FileDescriptor} class.
r   é
   )Úmin_sizeÚmax_sizer   )Ú	min_valueÚ	max_valueé   é   )r<   )s   abcdefr   ó   gc                ó~  • SR                  S U 5       5      n/ nSn[        XU5      nXS-  /S[        U5      U-  -   -  -  nU(       aR  [        US   [        5      (       a!  UR                  UR                  S5      5        OUR                  5         U(       a  MR  SR                  U5      nU R                  X&5        g)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  óT   #   • U  H  n[        U[        5      (       d  M  Uv •  M      g 7fr;   )rD   rM   )Ú.0Úops     r   Ú	<genexpr>Ú:WriteBufferingTests.test_writeBuffering.<locals>.<genexpr>}   s   é € ÐMª 2´zÀ"Äe×7LŸB™Bªùs   ‚(Ÿ	(é   é   r   r   N)	Újoinr8   rG   rD   rM   ÚwriterC   ÚdoWriteÚassertEqual)r   r<   Úexpectedr=   r>   ÚfdÚresults          r   Útest_writeBufferingÚ'WriteBufferingTests.test_writeBufferingh   s«   € ð* —8‘8ÑM©ÓMÓMˆØ!ˆð
 ˆ
Ü# J¸ÓDˆð 	 A‘~Ð&¨!¬c°(«m¸zÑ.IÑ*IÑJÑJˆ
æÜ˜* Q™-¬×/Ñ/Ø—‘˜Ÿ™¨Ó*Õ+à—
‘
”÷	 ˆjð —‘˜'Ó"ˆØ×Ñ˜Õ*r   r.   N)r<   zlist[Union[bytes, int]]r/   r0   )r1   r2   r3   r4   r5   r   ÚstÚlistsÚone_ofÚbinaryÚintegersr   rj   r6   r.   r   r   rQ   rQ   c   sl   † ññ Ø—8’8Ø�IŠIØ—	’	 1¨rÑ2Ø—’ a°2Ñ6óð Øñ
ñ	ñ Ò,Ñ-ó+ó .ó	ó+r   rQ   N)r5   Ú
__future__r   Útypingr   Ú
hypothesisr   r   r   rl   Útwisted.internet.abstractr   r	   Útwisted.trial.unittestr
   Útest_tcpr   r   r8   rQ   r.   r   r   Ú<module>rw      sH   ðñõ #å ç 7Ñ 7ç CÝ 6Ý 'ô47Ð*ô 47ôn˜^ô ô2-+Ð-õ -+r   