+
    üÐj±  ã                   ó  € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	H
t
  ! R R]P                  4      t ! R R]P                  ]	P                  4      t ! R	 R
]P                  4      t ! R R]4      t ! R R]4      tR# )z,
Tests for L{twisted.words.xish.xmlstream}.
)Úprotocol)Úfailure)Úunittest)ÚdomishÚutilityÚ	xmlstreamc                   óD   a € ] tR t^t o R tR tR tR tR tR t	Rt
V tR# )	ÚXmlStreamTestsc                óÔ   € R V n         . V n        \        P                  ! 4       V n        W P                  n        V P                  P
                  V P                  P                  n        R# )z	no reasonN)ÚconnectionLostMsgÚoutlistr   Ú	XmlStreamÚ	transportÚappendÚwrite©Úselfs   &ÚC/usr/lib/python3/dist-packages/twisted/words/test/test_xmlstream.pyÚsetUpÚXmlStreamTests.setUp   sG   € Ø!,ˆÔØˆŒÜ"×,Ò,Ó.ˆŒØ#'�‰Ô Ø)-¯©×)<Ñ)<ˆ�‰× Ñ Ö&ó    c                óŠ   € V P                   P                  \        P                  ! \	        V P
                  4      4      4       R# )z1
Stub loseConnection because we are a transport.
N)r   ÚconnectionLostr   ÚFailureÚ	Exceptionr   r   s   &r   ÚloseConnectionÚXmlStreamTests.loseConnection   s-   € ð 	�‰×%Ñ%Ü�OŠOœI d×&<Ñ&<Ó=Ó>ö	
r   c                ó¶   € V P                   P                  4        V P                   P                  R4       V P                  V P                  ^ ,          R4       R# )zY
Calling L{xmlstream.XmlStream.send} results in the data being written
to the transport.
s   <root>N)r   ÚconnectionMadeÚsendÚassertEqualr   r   s   &r   Ú	test_sendÚXmlStreamTests.test_send   s>   € ð
 	�‰×%Ñ%Ô'Ø�‰×Ñ˜IÔ&Ø×Ñ˜Ÿ™ a�¨)Ö4r   c                ó  a€ . oV3R lpV P                   P                  \         P                  V4       V P                   P                  4        V P                   P	                  R4       V P                  ^\        S4      4       R# )zE
Receiving the starttag of the root element results in stream start.
c                 ó*   <€ SP                  R 4       R # ©N©r   )ÚrootelemÚstreamStarteds   &€r   ÚstreamStartEventÚ9XmlStreamTests.test_receiveRoot.<locals>.streamStartEvent.   s   ø€ Ø× Ñ  Ö&r   ú<root>N)r   ÚaddObserverÚSTREAM_START_EVENTr   ÚdataReceivedr    Úlen)r   r)   r(   s   & @r   Útest_receiveRootÚXmlStreamTests.test_receiveRoot(   sc   ø€ ð ˆõ	'ð 	�‰×"Ñ"¤9×#?Ñ#?ÐAQÔRØ�‰×%Ñ%Ô'Ø�‰×#Ñ# HÔ-Ø×Ñ˜œC Ó.Ö/r   c                ó´  aa€ . o. oV3R lpV3R lpV P                   P                  \         P                  V4       V P                   P                  \         P                  V4       V P                   P	                  4        V P                   P                  R4       V P                  ^ \        S4      4       V P                  ^ \        S4      4       V P                   P                  R4       V P                  ^\        S4      4       V P                  S^ ,          P                  \        P                  4      4       V P                  ^\        S4      4       R# )z>
Receiving malformed XML results in an L{STREAM_ERROR_EVENT}.
c                 ó*   <€ SP                  V 4       R # r%   r&   )ÚreasonÚstreamErrors   &€r   ÚstreamErrorEventÚ;XmlStreamTests.test_receiveBadXML.<locals>.streamErrorEvent=   s   ø€ Ø×Ñ˜vÖ&r   c                 ó*   <€ SP                  R 4       R # r%   r&   )Ú_Ú	streamEnds   &€r   ÚstreamEndEventÚ9XmlStreamTests.test_receiveBadXML.<locals>.streamEndEvent@   s   ø€ Ø×Ñ˜TÖ"r   r+   z<child><unclosed></child>N)r   r,   ÚSTREAM_ERROR_EVENTÚSTREAM_END_EVENTr   r.   r    r/   Ú
assertTrueÚcheckr   ÚParserError)r   r6   r;   r:   r5   s   &  @@r   Útest_receiveBadXMLÚ!XmlStreamTests.test_receiveBadXML6   sø   ù€ ð ˆØˆ	õ	'õ	#ð 	�‰×"Ñ"¤9×#?Ñ#?ÐAQÔRØ�‰×"Ñ"¤9×#=Ñ#=¸~ÔNØ�‰×%Ñ%Ô'à�‰×#Ñ# HÔ-Ø×Ñ˜œC Ó,Ô-Ø×Ñ˜œC 	›NÔ+à�‰×#Ñ#Ð$?Ô@Ø×Ñ˜œC Ó,Ô-Ø�‰˜ A�×,Ñ,¬V×-?Ñ-?Ó@ÔAØ×Ñ˜œC 	›NÖ+r   c                ó¦  a€ . oV3R lpV P                   P                  \         P                  V4       V P                   P                  4        V P	                  4        V P                  ^\        S4      4       V P                  S^ ,          \        P                  4       V P                  S^ ,          P                  4       V P                  4       R# )z0
Ending the stream fires a L{STREAM_END_EVENT}.
c                 ó*   <€ SP                  V 4       R # r%   r&   )r4   r:   s   &€r   r;   Ú5XmlStreamTests.test_streamEnd.<locals>.streamEndEventV   s   ø€ Ø×Ñ˜VÖ$r   N)r   r,   r>   r   r   r    r/   ÚassertIsInstancer   r   ÚgetErrorMessager   )r   r;   r:   s   & @r   Útest_streamEndÚXmlStreamTests.test_streamEndP   s–   ø€ ð ˆ	õ	%ð 	�‰×"Ñ"¤9×#=Ñ#=¸~ÔNØ�‰×%Ñ%Ô'Ø×ÑÔØ×Ñ˜œC 	›NÔ+Ø×Ñ˜i¨�l¬G¯O©OÔ<Ø×Ñ˜ 1�×5Ñ5Ó7¸×9OÑ9OÖPr   )r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r!   r0   rB   rI   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r	   r	      s*   ø‡ € ò=ò
ò5ò0ò,÷4Qð Qr   r	   c                   ó*   a € ] tR t^at o RtR tRtV tR# )ÚDummyProtocolzÍ
I am a protocol with an event dispatcher without further processing.

This protocol is only used for testing XmlStreamFactoryMixin to make
sure the bootstrap observers are added to the protocol instance.
c                ój   € Wn         W n        . V n        \        P                  P                  V 4       R # r%   )ÚargsÚkwargsÚ	observersr   ÚEventDispatcherÚ__init__)r   rV   rW   s   &*,r   rZ   ÚDummyProtocol.__init__i   s'   € ØŒ	ØŒØˆŒä×Ñ×(Ñ(¨Ö.r   )rV   rW   rX   N)rK   rL   rM   rN   Ú__doc__rZ   rO   rP   rQ   s   @r   rT   rT   a   s   ø‡ € ñ÷/ð /r   rT   c                   ó6   a € ] tR t^qt o RtR tR tR tRtV t	R# )ÚBootstrapMixinTestsze
Tests for L{xmlstream.BootstrapMixin}.

@ivar factory: Instance of the factory or mixin under test.
c                ó:   € \         P                  ! 4       V n        R # r%   )r   ÚBootstrapMixinÚfactoryr   s   &r   r   ÚBootstrapMixinTests.setUpx   s   € Ü ×/Ò/Ó1ˆŽr   c                óô   a€ . oV3R lp\        4       pV P                  P                  RV4       V P                  P                  V4       VP	                  RR4       V P                  ^\        S4      4       R# )z<
Dispatching an event fires registered bootstrap observers.
c                 ó*   <€ SP                  V 4       R # r%   r&   ©ÚdataÚcalleds   &€r   ÚcbÚ6BootstrapMixinTests.test_installBootstraps.<locals>.cb�   ó   ø€ Ø�M‰M˜$Ör   ú//event/myeventN)rT   ra   ÚaddBootstrapÚinstallBootstrapsÚdispatchr    r/   ©r   rh   Ú
dispatcherrg   s   &  @r   Útest_installBootstrapsÚ*BootstrapMixinTests.test_installBootstraps{   sd   ø€ ð ˆõ	 ô #“_ˆ
Ø�‰×!Ñ!Ð"3°RÔ8Ø�‰×&Ñ& zÔ2à×Ñ˜DÐ"3Ô4Ø×Ñ˜œC ›KÖ(r   c                ó  a€ . oV3R lpV P                   P                  RV4       V P                   P                  RV4       \        4       pV P                   P	                  V4       VP                  RR4       V P                  S4       R# )z9
Test addition and removal of a bootstrap event handler.
c                 ó*   <€ SP                  V 4       R # r%   r&   re   s   &€r   rh   Ú:BootstrapMixinTests.test_addAndRemoveBootstrap.<locals>.cb’   rj   r   rk   N)ra   rl   ÚremoveBootstraprT   rm   rn   ÚassertFalsero   s   &  @r   Útest_addAndRemoveBootstrapÚ.BootstrapMixinTests.test_addAndRemoveBootstrap‹   ss   ø€ ð
 ˆõ	 ð 	�‰×!Ñ!Ð"3°RÔ8Ø�‰×$Ñ$Ð%6¸Ô;ä"“_ˆ
Ø�‰×&Ñ& zÔ2à×Ñ˜DÐ"3Ô4Ø×Ñ˜Ö r   ©ra   N)
rK   rL   rM   rN   r\   r   rq   rx   rO   rP   rQ   s   @r   r^   r^   q   s   ø‡ € ñò2ò)÷ !ð !r   r^   c                   ó6   a € ] tR t^Ÿt o RtR tR tR tRtV t	R# )Ú!GenericXmlStreamFactoryTestsMixinz+
Generic tests for L{XmlStream} factories.
c                ó:   € \         P                  ! 4       V n        R # r%   )r   ÚXmlStreamFactoryra   r   s   &r   r   Ú'GenericXmlStreamFactoryTestsMixin.setUp¤   s   € Ü ×1Ò1Ó3ˆŽr   c                óà   a€ . oV3R lpV P                   P                  RV4       V P                   P                  R4      pVP                  RR4       V P	                  ^\        S4      4       R# )zI
The protocol factory installs bootstrap event handlers on the protocol.
c                 ó*   <€ SP                  V 4       R # r%   r&   re   s   &€r   rh   ÚRGenericXmlStreamFactoryTestsMixin.test_buildProtocolInstallsBootstraps.<locals>.cb­   rj   r   rk   N)ra   rl   ÚbuildProtocolrn   r    r/   )r   rh   Úxsrg   s   &  @r   Ú$test_buildProtocolInstallsBootstrapsÚFGenericXmlStreamFactoryTestsMixin.test_buildProtocolInstallsBootstraps§   s]   ø€ ð ˆõ	 ð 	�‰×!Ñ!Ð"3°RÔ8à�\‰\×'Ñ'¨Ó-ˆØ
�‰�DÐ+Ô,à×Ñ˜œC ›KÖ(r   c                óˆ   € V P                   P                  R4      pV P                  V P                   VP                   4       R# )z0
The protocol factory is saved in the protocol.
N)ra   rƒ   ÚassertIdentical©r   r„   s   & r   Útest_buildProtocolStoresFactoryÚAGenericXmlStreamFactoryTestsMixin.test_buildProtocolStoresFactory·   s0   € ð �\‰\×'Ñ'¨Ó-ˆØ×Ñ˜TŸ\™\¨2¯:©:Ö6r   rz   N)
rK   rL   rM   rN   r\   r   r…   rŠ   rO   rP   rQ   s   @r   r|   r|   Ÿ   s   ø‡ € ñò4ò)÷ 7ð 7r   r|   c                   ó0   a € ] tR t^¿t o RtR tR tRtV tR# )ÚXmlStreamFactoryMixinTestsz/
Tests for L{xmlstream.XmlStreamFactoryMixin}.
c                ój   € \         P                  ! R R R7      V n        \        V P                  n        R # )N)Útest)r   ÚXmlStreamFactoryMixinra   rT   r   r   s   &r   r   Ú XmlStreamFactoryMixinTests.setUpÄ   s"   € Ü ×6Ò6°tÀ$ÔGˆŒÜ -ˆ�‰Ör   c                ó°   € V P                   P                  R4      pV P                  RVP                  4       V P                  RR/VP                  4       R# )zJ
Arguments passed to the factory are passed to protocol on
instantiation.
Nr�   r%   )ra   rƒ   r    rV   rW   r‰   s   & r   Ú"test_buildProtocolFactoryArgumentsÚ=XmlStreamFactoryMixinTests.test_buildProtocolFactoryArgumentsÈ   sD   € ð
 �\‰\×'Ñ'¨Ó-ˆà×Ñ˜ "§'¡'Ô*Ø×Ñ˜& $˜¨¯©Ö3r   rz   N)	rK   rL   rM   rN   r\   r   r“   rO   rP   rQ   s   @r   r�   r�   ¿   s   ø‡ € ñò.÷4ð 4r   r�   N)r\   Útwisted.internetr   Útwisted.pythonr   Útwisted.trialr   Útwisted.words.xishr   r   r   ÚTestCaser	   ÚProtocolrY   rT   r^   r|   r�   © r   r   Ú<module>rœ      sz   ðñõ
 &Ý "Ý "ß 9Ñ 9ôOQ�X×&Ñ&ô OQôd/�H×%Ñ% w×'>Ñ'>ô /ô +!˜(×+Ñ+ô +!ô\7Ð(;ô 7ô@4Ð!Bö 4r   