+
    Dfj)                        ^ RI Ht ^ RIHt ^ RIHt ^ RIHt  ! R R]P                  4      t	 ! R R]P                  4      tR	# )
    )annotations)protocol)rawudp)unittestc                  .    ] tR t^tR R ltR R ltRtR# )
MyProtocolc                    V ^8  d   QhRRRR/# )   	expectingzlist[tuple[bytes, bytes, int]]returnNone )formats   "?/usr/lib/python3/dist-packages/twisted/pair/test/test_rawudp.py__annotate__MyProtocol.__annotate__   s     ) )"@ )T )    c                	&    \        V4      V n        R # )N)listr   )selfr   s   &&r   __init__MyProtocol.__init__   s    ir   c               $    V ^8  d   QhRRRRRR/# )r
   databytespeerztuple[bytes, int]r   r   r   )r   s   "r   r   r      s"     
 
U 
2C 
 
r   c                	   Vw  r4V P                   '       g   Q R 4       hV P                   P                  ^ 4      w  rVpWQ8X  g   Q RP                  WQ4      4       hWc8X  g   Q RP                  Wc4      4       hWt8X  g   Q RVVVV3,          4       hR# )z(Got a packet when not expecting anymore.zExpected data {!r}, got {!r}zExpected host {!r}, got {!r}z&Expected port %d=0x%04x, got %d=0x%04xN)r   popr   )r   r   r   hostport
expectData
expectHost
expectPorts   &&&     r   datagramReceivedMyProtocol.datagramReceived   s    ~~~III~-1^^-?-?-B*

! 	
#A#H#H$
 	
! ! 	
#A#H#H$
 	
! ! 	
#K	O
 $
 	
!r   )r   N)__name__
__module____qualname____firstlineno__r   r$   __static_attributes__r   r   r   r   r      s    )
 
r   r   c                      ] tR t^#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 R lt
R R ltR R ltRtR# )RawUDPTestsc                   V ^8  d   QhRR/# r
   r   r   r   )r   s   "r   r   RawUDPTests.__annotate__$   s      
  
4  
r   c                	    \         P                  ! 4       p\        R.4      pVP                  RV4       VP	                  R^ RRRRRRRRRRRRR7       VP
                  '       d   Q RVP
                  ,          4       hR# 	   foobar   testHost     C ޭfoobar   dummypartialdestsourcer   versionihltostot_lenfragment_idfragment_offsetdont_fragmentmore_fragmentsttl5Should not expect any more packets, but still want %rNr2   r3   iC  r   RawUDPProtocolr   addProtor$   r   r   protop1s   &  r   testPacketParsingRawUDPTests.testPacketParsing$   s    %%'0

 	vr"
  $"#% 	 	
* <<< 	
CbllR	
<r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   F   s     4
 4
T 4
r   c                	>   \         P                  ! 4       p\        R
R.4      pVP                  RV4       VP	                  R^ RRRRRRRRRRRRR7       VP	                  R^ RRRRRRRRRRRRR7       VP
                  '       d   Q RVP
                  ,          4       hR	# )r2   r3   	   otherHostr4   r5   r6   r7      3 ޭquuxrD   NrE      quuxrP   i3  rF   rI   s   &  r   testMultiplePacketsRawUDPTests.testMultiplePacketsF   s    %%'0/
 	vr"
  $"#% 	 	
( 	
  $"#% 	 	
* <<< 	
CbllR	
<r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   |   s     +
 +
 +
r   c                	   \         P                  ! 4       p\        R.4      p\        R.4      pVP                  RV4       VP                  RV4       VP	                  R^ RRRRRRRRRRRRR7       VP
                  '       d   Q RVP
                  ,          4       hVP
                  '       d   Q RVP
                  ,          4       hR# r1   rF   r   rJ   rK   p2s   &   r   testMultipleSameProtos"RawUDPTests.testMultipleSameProtos|   s    %%'0
 0
 	vr"vr"
  $"#% 	 	
* <<< 	
CbllR	
 <<< 	
CbllR	
<r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/      s     
 
t 
r   c                	    \         P                  ! 4       p\        . 4      pVP                  ^V4       VP	                  R^ RRRRRRRRRRRRR7       R# )   r5   r6   r3   r7   N)r   rG   r   rH   r$   rI   s   &  r   testWrongProtoNotSeen!RawUDPTests.testWrongProtoNotSeen   sh    %%'^q"
  $"#% 	 	
r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/      s     h
 h
d h
r   c                	L   \         P                  ! 4       p\        RR.4      pVP                  RV4       \        RR.4      pVP                  RV4       VP	                  R^ RRRRRRRRRRRRR7       VP	                  R^ RRRRRRRRRRRRR7       VP	                  R	^ RRRRRRRRRRRRR7       VP	                  R
^ RRRRRRRRRRRRR7       VP
                  '       d   Q RVP
                  ,          4       hVP
                  '       d   Q RVP
                  ,          4       hR# )r2   r3   rP   r4   iP  s   P ޭquuxr6   r7   r5   rQ   s   P ޭfoobarrD   NrE   rR   )rS   rP   i  )r2   r3   i  rF   rX   s   &   r   testDemuxingRawUDPTests.testDemuxing   s   %%'0/
 	vr"/0
 	vr"
  $"#% 	 	
( 	
  $"#% 	 	
( 	
  $"#% 	 	
( 	
  $"#% 	 	
* <<< 	
CbllR	
 <<< 	
CbllR	
<r   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   -  s     W W Wr   c                    \         P                  ! 4       p VP                  ^*R4       \        R4      h  \         d   pTP
                  R8X  d    Rp?R# h Rp?ii ; i)z2Adding a wrong level protocol raises an exception.	silliness2addProto must raise an exception for bad protocolsN)z6Added protocol must be an instance of DatagramProtocol)r   rG   rH   AssertionError	TypeErrorargsr   es   & r   testAddingBadProtos_WrongLevel*RawUDPTests.testAddingBadProtos_WrongLevel-  sW    !!#	WJJr;' !!UVV  	vvTT		s   4 AAAAc                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   :  s     W Wd Wr   c                    \         P                  ! 4       p VP                  R\        P                  ! 4       4       \        R4      h  \         d   pTP                  R8X  d    Rp?R# h Rp?ii ; i)z=Adding a protocol with a negative number raises an exception.rh   N)z'Added protocol must be positive or zeror   rG   rH   r   DatagramProtocolri   rj   rk   rl   s   & r   testAddingBadProtos_TooSmall(RawUDPTests.testAddingBadProtos_TooSmall:  s`    !!#	WJJr84467 !!UVV  	vvEE		   %A A/A*)A**A/c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   G  s     W WD Wr   c                    \         P                  ! 4       p VP                  R\        P                  ! 4       4       \        R4      h  \         d   pTP                  R8X  d    Rp?R# h Rp?ii ; i)<Adding a protocol with a number >=2**16 raises an exception.rh   Ni   z"Added protocol must fit in 16 bitsrs   rl   s   & r   testAddingBadProtos_TooBig&RawUDPTests.testAddingBadProtos_TooBigG  s`    !!#	WJJuh779: !!UVV  	vv@@		rw   c                   V ^8  d   QhRR/# r.   r   )r   s   "r   r   r/   T  s     W WT Wr   c                    \         P                  ! 4       p VP                  R\        P                  ! 4       4       \        R4      h  \         d   pTP                  R8X  d    Rp?R# h Rp?ii ; i)rz   rh   Ni  r{   rs   rl   s   & r   testAddingBadProtos_TooBig2'RawUDPTests.testAddingBadProtos_TooBig2T  s`    !!#	WJJy(";";"=> !!UVV  	vv@@		rw   r   N)r&   r'   r(   r)   rL   rT   rZ   r_   rc   rn   ru   r|   r   r*   r   r   r   r,   r,   #   s>     
D4
l+
Z
4h
TWWWW Wr   r,   N)
__future__r   twisted.internetr   twisted.pairr   twisted.trialr   rt   r   TestCaser,   r   r   r   <module>r      s=    # %  #
** 
.|W(## |Wr   