+
    üÐj	-  ã                   ó:  € R t ^ RIHt ^ RIHt ^ RIHt RtRtRt	Rt
 ! R R	]P                  4      t ! R
 R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      tR# )z4
Tests for L{twisted.words.protocols.jabber.error}.
)Úunittest©Úerror)Údomishz$http://www.w3.org/XML/1998/namespaceú http://etherx.jabber.org/streamsz#urn:ietf:params:xml:ns:xmpp-streamsz#urn:ietf:params:xml:ns:xmpp-stanzasc                   óh   a € ] tR t^t o V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )ÚBaseErrorTestsc                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€ÚE/usr/lib/python3/dist-packages/twisted/words/test/test_jabbererror.pyÚ__annotate__ÚBaseErrorTests.__annotate__   s   ø€ ÷ 3ñ 3 dñ 3ó    c                óÔ   € \         P                  ! R4      pVP                  4       pV P                  VP                  R4       V P                  \        VP                  4      ^4       R# )z,
Test getting an element for a plain error.
úfeature-not-implementedN)r   Ú	BaseErrorÚ
getElementÚassertIdenticalÚuriÚassertEqualÚlenÚchildren©ÚselfÚeÚelements   &  r   Útest_getElementPlainÚ#BaseErrorTests.test_getElementPlain   sM   € ô �OŠOÐ5Ó6ˆØ—,‘,“.ˆØ×Ñ˜WŸ[™[¨$Ô/Ø×Ñœ˜W×-Ñ-Ó.°Ö2r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r      s   ø€ ÷ Lñ L Tñ Lr   c                óJ  € \         P                  ! RR4      pVP                  4       pV P                  \	        VP
                  4      ^4       V P                  \        VP                  4      R4       V P                  VP                  P                  \        R34      R4       R# )z3
Test getting an element for an error with a text.
r   ÚtextÚlangN)
r   r   r   r   r   r   Ústrr%   ÚgetAttributeÚNS_XMLr   s   &  r   Útest_getElementTextÚ"BaseErrorTests.test_getElementText   sx   € ô �OŠOÐ5°vÓ>ˆØ—,‘,“.ˆØ×Ñœ˜W×-Ñ-Ó.°Ô2Ø×Ñœ˜WŸ\™\Ó*¨FÔ3Ø×Ñ˜Ÿ™×2Ñ2´F¸FÐ3CÓDÀdÖKr   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   '   s   ø€ ÷ Bñ B¨ñ Br   c                ó<  € \         P                  ! RRR4      pVP                  4       pV P                  \	        VP
                  4      ^4       V P                  \        VP                  4      R4       V P                  VP                  \        R3,          R4       R# )z@
Test getting an element for an error with a text and language.
r   r%   Úen_USr&   N)	r   r   r   r   r   r   r'   r%   r)   r   s   &  r   Útest_getElementTextLangÚ&BaseErrorTests.test_getElementTextLang'   st   € ô �OŠOÐ5°v¸wÓGˆØ—,‘,“.ˆØ×Ñœ˜W×-Ñ-Ó.°Ô2Ø×Ñœ˜WŸ\™\Ó*¨FÔ3Ø×Ñ˜Ÿ™¤v¨vÐ&6Õ7¸ÖAr   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   1   s   ø€ ÷ .ñ .¨Tñ .r   c                ó  € \         P                  ! R4      p\        P                  ! RVR7      pVP	                  4       pV P                  \        VP                  4      ^4       V P                  VP                  V4       R# )zF
Test getting an element for an error with an app specific condition.
r   )ÚappConditionN)ÚtestnsÚmyerror)	r   ÚElementr   r   r   r   r   r   r5   )r   Úacr   r    s   &   r   Útest_getElementAppConditionÚ*BaseErrorTests.test_getElementAppCondition1   s^   € ô �^Š^Ð1Ó2ˆÜ�OŠOÐ5ÀBÔGˆØ—,‘,“.ˆØ×Ñœ˜W×-Ñ-Ó.°Ô2Ø×Ñ˜Ÿ™¨"Ö-r   r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r!   r*   r/   r8   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s1   ø‡ € ÷3ð 3÷Lð L÷Bð B÷.ö .r   r   c                   óV   a € ] tR t^<t o V 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )	ÚStreamErrorTestsc                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   ÚStreamErrorTests.__annotate__=   s   ø€ ÷ 2ñ 2 dñ 2r   c                ó’   € \         P                  ! R4      pVP                  4       pV P                  VP                  \
        4       R# )z;
Test namespace of the element representation of an error.
r   N)r   ÚStreamErrorr   r   r   Ú
NS_STREAMSr   s   &  r   r!   Ú%StreamErrorTests.test_getElementPlain=   s4   € ô ×ÒÐ7Ó8ˆØ—,‘,“.ˆØ×Ñ˜Ÿ™¤jÖ1r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   rD   E   ó   ø€ ÷ 
ñ 
°4ñ 
r   c                ó¦   € \         P                  ! R4      pVP                  4       pV P                  \        \        VR4      P                  4       R# ©zB
Test that the error condition element has the correct namespace.
r   N)r   rF   r   r   ÚNS_XMPP_STREAMSÚgetattrr   r   s   &  r   Ú!test_getElementConditionNamespaceÚ2StreamErrorTests.test_getElementConditionNamespaceE   óA   € ô ×ÒÐ7Ó8ˆØ—,‘,“.ˆØ×ÑÜœW WÐ.GÓH×LÑLö	
r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   rD   O   ó   ø€ ÷ <ñ <¨dñ <r   c                ó¨   € \         P                  ! RR4      pVP                  4       pV P                  \        VP
                  P                  4       R# )ú=
Test that the error text element has the correct namespace.
r   r%   N)r   rF   r   r   rM   r%   r   r   s   &  r   Útest_getElementTextNamespaceÚ-StreamErrorTests.test_getElementTextNamespaceO   s<   € ô ×ÒÐ7¸Ó@ˆØ—,‘,“.ˆØ×Ñœ¨'¯,©,×*:Ñ*:Ö;r   r   N)	r:   r;   r<   r=   r!   rO   rV   r>   r?   r@   s   @r   rB   rB   <   s#   ø‡ € ÷2ð 2÷
ð 
÷<ö <r   rB   c                   ó�   a € ] tR t^Xt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
RtV tR# )ÚStanzaErrorTestsz!
Tests for L{error.StreamError}.
c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   ÚStanzaErrorTests.__annotate__]   s   ø€ ÷ (ñ (¨dñ (r   c                ó¢   € \         P                  ! R4      pV P                  RVP                  4       V P                  RVP                  4       R# )z9
Remote Server Timeout should yield type wait, code 504.
zremote-server-timeoutÚwaitÚ504N)r   ÚStanzaErrorr   ÚtypeÚcode)r   r   s   & r   Útest_typeRemoteServerTimeoutÚ-StanzaErrorTests.test_typeRemoteServerTimeout]   s=   € ô ×ÒÐ5Ó6ˆØ×Ñ˜ §¡Ô(Ø×Ñ˜ §¡Ö'r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r[   e   s   ø€ ÷ 1ñ 1 dñ 1r   c                óî   € \         P                  ! R4      pVP                  4       pV P                  VP                  R4       V P                  VR,          R4       V P                  VR,          R4       R# )z3
Test getting an element for a plain stanza error.
r   Nr`   Úcancelra   Ú501©r   r_   r   r   r   r   s   &  r   r!   Ú%StanzaErrorTests.test_getElementPlaine   s\   € ô ×ÒÐ7Ó8ˆØ—,‘,“.ˆØ×Ñ˜Ÿ™ dÔ+Ø×Ñ˜ �¨(Ô3Ø×Ñ˜ �¨%Ö0r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r[   o   s   ø€ ÷ 1ñ 1 Tñ 1r   c                óð   € \         P                  ! RR4      pVP                  4       pV P                  VP                  R4       V P                  VR,          R4       V P                  VR,          R4       R# )z?
Test getting an element for a stanza error with a given type.
r   ÚauthNr`   ra   rg   rh   r   s   &  r   Útest_getElementTypeÚ$StanzaErrorTests.test_getElementTypeo   s^   € ô ×ÒÐ7¸Ó@ˆØ—,‘,“.ˆØ×Ñ˜Ÿ™ dÔ+Ø×Ñ˜ �¨&Ô1Ø×Ñ˜ �¨%Ö0r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r[   y   rJ   r   c                ó¦   € \         P                  ! R4      pVP                  4       pV P                  \        \        VR4      P                  4       R# rL   )r   r_   r   r   ÚNS_XMPP_STANZASrN   r   r   s   &  r   rO   Ú2StanzaErrorTests.test_getElementConditionNamespacey   rQ   r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r[   ƒ   rS   r   c                óª   € \         P                  ! RRR7      pVP                  4       pV P                  \        VP
                  P                  4       R# )rU   r   r%   )r%   N)r   r_   r   r   rq   r%   r   r   s   &  r   rV   Ú-StanzaErrorTests.test_getElementTextNamespaceƒ   s<   € ô ×ÒÐ7¸fÔEˆØ—,‘,“.ˆØ×Ñœ¨'¯,©,×*:Ñ*:Ö;r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r[   ‹   s   ø€ ÷ @ñ @ ñ @r   c                óV  € \         P                  ! R4      pRVR&   RVR&   RVR&   \        P                  ! R4      pVP	                  V4      pV P                  W14       V P                  VR,          R4       V P                  VR,          R4       V P                  VR,          R4       V P                  VP                  P                  ^ ,          P                  R4       V P                  VP                  R,          R	4       V P                  VP                  VP                  4       R
# )zÃ
Test an error response is generated from a stanza.

The addressing on the (new) response stanza should be reversed, an
error child (with proper properties) added and the type set to
C{'error'}.
Úchatr`   zuser1@example.comÚtozuser2@example.com/resourceÚfromúservice-unavailabler   rf   N)zjabber:clientÚmessage)
r   r6   r   r_   Ú
toResponseÚassertNotIdenticalr   r   ÚnameÚassertNotEqual)r   Ústanzar   Úresponses   &   r   Útest_toResponseÚ StanzaErrorTests.test_toResponse‹   sô   € ô —’Ð <Ó=ˆØˆˆv‰Ø*ˆˆt‰Ø5ˆˆv‰Ü×ÒÐ3Ó4ˆØ—<‘< Ó'ˆØ×Ñ Ô1Ø×Ñ˜ &Õ)Ð+>Ô?Ø×Ñ˜ $�Ð)EÔFØ×Ñ˜ &Õ)¨7Ô3Ø×Ñ˜Ÿ™×0Ñ0°Õ3×8Ñ8Ð:OÔPØ×Ñ˜Ÿ™¨Õ/°Ô:Ø×Ñ˜FŸO™O¨X×->Ñ->Ö?r   r   N)r:   r;   r<   r=   Ú__doc__rb   r!   rm   rO   rV   rƒ   r>   r?   r@   s   @r   rY   rY   X   sH   ø‡ € ñ÷(ð (÷1ð 1÷1ð 1÷
ð 
÷<ð <÷@ö @r   rY   c                   ó¢   a € ] tR t^¢t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltRtV tR# )ÚParseErrorTestsz!
Tests for L{error._parseError}.
c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   ÚParseErrorTests.__annotate__§   s   ø€ ÷ 5ñ 5�tñ 5r   c                ó<   € \         P                  ! R4      V n        R # )N)Nr   )r   r6   r   )r   s   &r   ÚsetUpÚParseErrorTests.setUp§   s   € Ü—^’^ OÓ4ˆŽ
r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   ª   s   ø€ ÷ 
ñ 
˜Dñ 
r   c           
     ó|   € \         P                  ! V P                   R4      pV P                  RRRRRRRR/V4       R# )z*
Test parsing of the empty error element.
ÚerrornsÚ	conditionNr%   ÚtextLangr3   )r   Ú_parseErrorr   ©r   Úresults   & r   Ú
test_emptyÚParseErrorTests.test_emptyª   s@   € ô ×"Ò" 4§:¡:¨yÓ9ˆØ×ÑØ˜$ ¨¨j¸$ÀÐPTÐUØö	
r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   ´   s   ø€ ÷ =ñ = ñ =r   c                ó°   € V P                   P                  R4       \         P                  ! V P                   R4      pV P                  RVR,          4       R# )z4
Test parsing of an error element with a condition.
r�   úbad-requestr�   N)r�   r™   ©r   Ú
addElementr’   r   r“   s   & r   Útest_conditionÚParseErrorTests.test_condition´   sB   € ð 	�
‰
×ÑÐ8Ô9Ü×"Ò" 4§:¡:¨yÓ9ˆØ×Ñ˜¨¨{Õ(;Ö<r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   ¼   s   ø€ ÷ 3ñ 3˜4ñ 3r   c                ó  € V P                   P                  R4      pVP                  R4       \         P                  ! V P                   R4      pV P	                  RVR,          4       V P	                  RVR,          4       R# )z/
Test parsing of an error element with a text.
r�   r%   ÚtestNr‘   ©r�   r%   )r   r›   Ú
addContentr’   r   ©r   r%   r”   s   &  r   Ú	test_textÚParseErrorTests.test_text¼   sd   € ð �z‰z×$Ñ$Ð%8Ó9ˆØ�‰˜ÔÜ×"Ò" 4§:¡:¨yÓ9ˆØ×Ñ˜ ¨¥Ô0Ø×Ñ˜˜v jÕ1Ö2r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   Æ   s   ø€ ÷ 6ñ 6˜tñ 6r   c                óè   € V P                   P                  R4      pRV\        R3&   VP                  R4       \         P                  ! V P                   R4      pV P                  RVR,          4       R# )zG
Test parsing of an error element with a text with a defined language.
r�   r.   r&   r    r‘   Nr¡   )r   r›   r)   r¢   r’   r   r£   s   &  r   Útest_textLangÚParseErrorTests.test_textLangÆ   s^   € ð �z‰z×$Ñ$Ð%8Ó9ˆØ&ˆŒV�Vˆ^ÑØ�‰˜ÔÜ×"Ò" 4§:¡:¨yÓ9ˆØ×Ñ˜ &¨Õ"4Ö5r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   Ð   s   ø€ ÷ <ñ < 4ñ <r   c                ó®   € V P                   P                  R4      p\         P                  ! V P                   R4      pV P                  WR,          4       R# )zB
Test parsing of an error element with an app specific condition.
r�   r3   N©r4   r�   rš   ©r   r�   r”   s   &  r   Útest_appConditionÚ!ParseErrorTests.test_appConditionÐ   sB   € ð —J‘J×)Ñ)Ð*AÓBˆ	Ü×"Ò" 4§:¡:¨yÓ9ˆØ×Ñ˜¨>Õ$:Ö;r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r‰   Ø   s   ø€ ÷ <ñ <¨4ñ <r   c                óä   € V P                   P                  R4       V P                   P                  R4      p\         P                  ! V P                   R4      pV P                  WR,          4       R# )zI
Test parsing of an error element with multiple app specific conditions.
r�   r3   Nr¬   )r4   Ú
condition2rš   r­   s   &  r   Útest_appConditionMultipleÚ)ParseErrorTests.test_appConditionMultipleØ   sU   € ð 	�
‰
×ÑÐ5Ô6Ø—J‘J×)Ñ)Ð*BÓCˆ	Ü×"Ò" 4§:¡:¨yÓ9ˆØ×Ñ˜¨>Õ$:Ö;r   r   N)r:   r;   r<   r=   r…   r‹   r•   rœ   r¤   r¨   r®   r³   r>   r?   r@   s   @r   r‡   r‡   ¢   sP   ø‡ € ñ÷5ð 5÷
ð 
÷=ð =÷3ð 3÷6ð 6÷<ð <÷<ö <r   r‡   c                   óD   a € ] tR t^ât o V 3R lR ltV 3R lR ltRtV tR# )ÚExceptionFromStanzaTestsc                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   Ú%ExceptionFromStanzaTests.__annotate__ã   s   ø€ ÷ &/ñ &/˜Dñ &/r   c                óH  € \         P                  ! R	4      pVP                  R
4      pVP                  R4       VP                  R4      pRVR&   VP                  \        R34       VP                  R4      pRVR&   \        P
                  ! V4      pV P                  V\        P                  4       V P                  RVP                  4       V P                  RVP                  4       V P                  WEP                  4       V P                  V.VP                  4       R# )a]  
Test basic operations of exceptionFromStanza.

Given a realistic stanza, check if a sane exception is returned.

Using this stanza::

  <iq type='error'
      from='pubsub.shakespeare.lit'
      to='francisco@denmark.lit/barracks'
      id='subscriptions1'>
    <pubsub xmlns='http://jabber.org/protocol/pubsub'>
      <subscriptions/>
    </pubsub>
    <error type='cancel'>
      <feature-not-implemented
        xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
      <unsupported xmlns='http://jabber.org/protocol/pubsub#errors'
                   feature='retrieve-subscriptions'/>
    </error>
  </iq>
NÚsubscriptionsr   rf   r`   r   zretrieve-subscriptionsÚfeature©Nr�   )z!http://jabber.org/protocol/pubsubÚpubsub)z(http://jabber.org/protocol/pubsub#errorsÚunsupported)r   r6   r›   rq   r   ÚexceptionFromStanzaÚassertIsInstancer_   r   r�   r`   r3   r   )r   r�   Úpr   Úucr”   s   &     r   Ú
test_basicÚ#ExceptionFromStanzaTests.test_basicã   sî   € ô0 —’Ð 0Ó1ˆØ×ÑÐMÓNˆØ	�‰�_Ô%Ø×Ñ˜gÓ&ˆØˆˆ&‰	Ø	�‰”oÐ'@ÐAÔBØ�\‰\ÐUÓVˆØ0ˆˆ9‰ä×*Ò*¨6Ó2ˆØ×Ñ˜f¤e×&7Ñ&7Ô8Ø×ÑÐ2°F×4DÑ4DÔEØ×Ñ˜ 6§;¡;Ô/Ø×Ñ˜×0Ñ0Ô1Ø×Ñ˜!˜˜fŸo™oÖ.r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r¸     s   ø€ ÷ /ñ /˜Tñ /r   c                óÖ  € \         P                  ! R4      pVP                  RRR7      pVP                  RRR7      pRVR&   \        P                  ! V4      pV P                  V\        P                  4       V P                  R	VP                  4       V P                  R
VP                  4       V P                  RVP                  4       V P                  V.VP                  4       R# )a�  
Test legacy operations of exceptionFromStanza.

Given a realistic stanza with only legacy (pre-XMPP) error information,
check if a sane exception is returned.

Using this stanza::

  <message type='error'
           to='piers@pipetree.com/Home'
           from='qmacro@jaber.org'>
    <body>Are you there?</body>
    <error code='502'>Unable to resolve hostname.</error>
  </message>
NÚbodyzAre you there?)Úcontentr   zUnable to resolve hostname.Ú502ra   r{   r]   r¼   )r   r6   r›   r   r¿   rÀ   r_   r   r�   r`   r%   r   )r   r�   rÁ   r   r”   s   &    r   Útest_legacyÚ$ExceptionFromStanzaTests.test_legacy  sÄ   € ô  —’Ð 0Ó1ˆØ×Ñ˜fÐ.>ÐÓ?ˆØ×Ñ˜gÐ/LÐÓMˆØˆˆ&‰	ä×*Ò*¨6Ó2ˆØ×Ñ˜f¤e×&7Ñ&7Ô8Ø×ÑÐ.°×0@Ñ0@ÔAØ×Ñ˜ §¡Ô-Ø×ÑÐ6¸¿¹ÔDØ×Ñ˜!˜˜fŸo™oÖ.r   r   N)r:   r;   r<   r=   rÃ   rÊ   r>   r?   r@   s   @r   r¶   r¶   â   s   ø‡ € ÷&/ð &/÷P/ö /r   r¶   c                   ó2   a € ] tR tRt o V 3R lR ltRtV tR# )ÚExceptionFromStreamErrorTestsi(  c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   Ú*ExceptionFromStreamErrorTests.__annotate__)  s   ø€ ÷ Bñ B˜Dñ Br   c                ó  € \         P                  ! R4      pVP                  \        R34       \        P
                  ! V4      pV P                  V\        P                  4       V P                  RVP                  4       R# )a+  
Test basic operations of exceptionFromStreamError.

Given a realistic stream error, check if a sane exception is returned.

Using this error::

  <stream:error xmlns:stream='http://etherx.jabber.org/streams'>
    <xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
  </stream:error>
zxml-not-well-formedN)r   r   )
r   r6   r›   rM   r   ÚexceptionFromStreamErrorrÀ   rF   r   r�   )r   r   r”   s   &  r   rÃ   Ú(ExceptionFromStreamErrorTests.test_basic)  sb   € ô �NŠNÐHÓIˆØ	�‰”oÐ'<Ð=Ô>ä×/Ò/°Ó2ˆØ×Ñ˜f¤e×&7Ñ&7Ô8Ø×ÑÐ.°×0@Ñ0@ÖAr   r   N)r:   r;   r<   r=   rÃ   r>   r?   r@   s   @r   rÍ   rÍ   (  s   ø‡ € ÷Bö Br   rÍ   N)r…   Útwisted.trialr   Útwisted.words.protocols.jabberr   Útwisted.words.xishr   r)   rG   rM   rq   ÚTestCaser   rB   rY   r‡   r¶   rÍ   r   r   r   Ú<module>r×      s¡   ðñõ
 #Ý 0Ý %à	/€Ø/€
Ø7€Ø7€ô&.�X×&Ñ&ô &.ôR<�x×(Ñ(ô <ô8G@�x×(Ñ(ô G@ôT=<�h×'Ñ'ô =<ô@C/˜x×0Ñ0ô C/ôLB H×$5Ñ$5ö Br   