Ϫf^<ddlmZddlmZddlmZmZddlmZddl m Z ejejGddZ Gdd e jZy ) ) annotations) interface)ipraw) components)unittestc`eZdZddZ ddZddZy) MyProtocolc$t||_yN)list expecting)selfrs ;/usr/lib/python3/dist-packages/twisted/pair/test/test_ip.py__init__zMyProtocol.__init__s ic 2|jsJd|jjd\}}tt|j }t }|D]#}||||k(rJd|d||d||||k(s Jd|d|y)Nz(Got a packet when not expecting anymore.rz Expected =z, got )rpopr sortedkeyslocals)rdatapartialsourcedestprotocolversionihltostot_len fragment_idfragment_offset dont_fragmentmore_fragmentsttl expectDataexpectKw expectKwKeyslocalVariablesks rdatagramReceivedzMyProtocol.datagramReceiveds"~~III~#~~11!4 HF8==?34  JA ~a00 J1#Qx{oVN14E3HI J0 JT!KYznF4(#KK!rcyr )rnumprotos raddProtozMyProtocol.addProto.s rN)rz(list[tuple[bytes, dict[str, str | int]]]returnNone)rbytesrintrstrrr6rr5rr5rr5r r5r!r5r"r5r#r5r$r5r%r5r&r5r2r3)r/objectr0r7r2r3)__name__ __module__ __qualname__rr,r1r.rrr r s)LLL L  L  LLLLLLLLLL !L: rr cTeZdZd dZd dZd dZd dZd dZd dZd dZ d dZ d d Z y ) IPTestsctj}tddddddddd d d dd d d fg}|jd||j ddddd|j rJd|j zyNfoobarr1.2.3.45.6.7.8 rrrrrrr r!r"r#r$r%r&TޭFEfoobardummyrrrr5Should not expect any more packets, but still want %rr IPProtocolr r1r,rrr0p1s rtestPacketParsingzIPTests.testPacketParsing4s  #$ )"+$(#$! #)'-+1)**+#  , tR     $<< Cbll R rPrr0rSp2s rtestMultipleSameProtoszIPTests.testMultipleSameProtoss#  #$ )"+$(#$! #)'-+1)**+#  .#$ )"+$(#$! #)'-+1)**+#  . tR  tR     $<< Cbll R << Cbll R  *!!UV V  vvEE < A AA ctj} |jdtgt d#t $r}|j dk(rnYd}~yd}~wwxYw)=2**32 raises an exception.lrgz"Added protocol must fit in 32 bitsNrorjs rtestAddingBadProtos_TooBigz"IPTests.testAddingBadProtos_TooBigs] MMO W JJujn -!!UV V  vv@@ rsctj} |jdtgt d#t $r}|j dk(rnYd}~yd}~wwxYw)rulrgrvNrorjs rtestAddingBadProtos_TooBig2z#IPTests.testAddingBadProtos_TooBig2s] MMO W JJy*R. 1!!UV V  vv@@ rsN)r2r3) r8r9r:rTrZr^r`rcrlrrrwryr.rrr<r<3s:. `P dJ X .` DW W W Wrr<N) __future__rzoper twisted.pairrrtwisted.pythonr twisted.trialr implementerIRawDatagramProtocolr TestCaser<r.rrrsY# %"s//0# # 1# LwWhwWr