+
    üÐj†q  ã                   ó¬  € R t ^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtH t  ^ RI!H"t"H#t# ^ RI$H%t% ^ RI&H't'H(t(H)t)H*t*H+t+H,t,H-t-H.t.H/t/ ^ RI0H1t1 ^ RI2H3t3 ]! ]4RR7      t5 ! R R]4      t6 ! R R]4      t7 ! R R]4      t8 ! R R4      t9 ! R R]]94      t: ! R  R!]]94      t; ! R" R#]]94      t< ! R$ R%]]94      t= ! R& R']14      t> ! R( R)]14      t? ! R* R+]'4      t@ ! R, R-]'4      tA ! R. R/]'4      tB ! R0 R14      tC]! ]"4       ! R2 R3]34      4       tD ! R4 R5]4      tER# )6z#
Tests for L{twisted.web.template}
N)ÚStringIO)ÚListÚOptional)Úimplementer)ÚverifyObject)ÚDeferredÚsucceed)ÚEventLoggingObserver)ÚglobalLogPublisher)ÚFailure)ÚFilePath)ÚTestCase)Úsuppress)ÚUnexposedMethodError)ÚFlattenerErrorÚMissingRenderMethodÚMissingTemplateLoader)ÚIRequestÚITemplateLoader)ÚNOT_DONE_YET)	ÚElementÚFlattenableÚTagÚ	TagLoaderÚXMLFileÚ	XMLStringÚrenderElementÚrendererÚtags)ÚFlattenTestCase)ÚDummyRequestúhPassing filenames or file objects to XMLFile is deprecated since Twisted 12.1.  Pass a FilePath instead.)ÚcategoryÚmessagec                   ó~   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	Rt
V tR# )ÚTagFactoryTestszG
Tests for L{_TagFactory} through the publicly-exposed L{tags} object.
c                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€Ú@/usr/lib/python3/dist-packages/twisted/web/test/test_template.pyÚ__annotate__ÚTagFactoryTests.__annotate__4   s   ø€ ÷ +ñ + ñ +ó    c                ó^   € \         P                  pV P                  VP                  R4       R# )z-
HTML tags can be retrieved through C{tags}.
ÚaN)r   r2   ÚassertEqualÚtagName©ÚselfÚtags   & r-   Útest_lookupTagÚTagFactoryTests.test_lookupTag4   s!   € ô �f‰fˆØ×Ñ˜Ÿ™ cÖ*r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r/   ;   s   ø€ ÷ /ñ / Tñ /r0   c                ó^   € \         P                  pV P                  VP                  R4       R# )zR
Twisted supports the latest and greatest HTML tags from the HTML5
specification.
ÚvideoN)r   r<   r3   r4   r5   s   & r-   Útest_lookupHTML5TagÚ#TagFactoryTests.test_lookupHTML5Tag;   s!   € ô
 �j‰jˆØ×Ñ˜Ÿ™ gÖ.r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r/   C   s   ø€ ÷ *ñ *¨4ñ *r0   c                ó^   € \         P                  pV P                  VP                  R4       R# )z¯
To support transparent inclusion in templates, there is a special tag,
the transparent tag, which has no name of its own but is accessed
through the "transparent" attribute.
Ú N)r   Útransparentr3   r4   r5   s   & r-   Útest_lookupTransparentTagÚ)TagFactoryTests.test_lookupTransparentTagC   s#   € ô ×ÑˆØ×Ñ˜Ÿ™ bÖ)r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r/   L   s   ø€ ÷ Dñ D tñ Dr0   c                óF   € V P                  \        \        \        R4       R# )z^
Invalid tags which are not part of HTML cause AttributeErrors when
accessed through C{tags}.
ÚinvalidN©ÚassertRaisesÚAttributeErrorÚgetattrr   ©r6   s   &r-   Útest_lookupInvalidTagÚ%TagFactoryTests.test_lookupInvalidTagL   s   € ð
 	×Ñœ.¬'´4¸ÖCr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r/   S   s   ø€ ÷ @ñ @ ñ @r0   c                óF   € V P                  \        \        \        R4       R# )zy
As a special case, the <xmp> tag is simply not available through
C{tags} or any other part of the templating machinery.
ÚxmpNrH   rL   s   &r-   Útest_lookupXMPÚTagFactoryTests.test_lookupXMPS   s   € ð
 	×Ñœ.¬'´4¸Ö?r0   r*   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r8   r=   rC   rM   rR   Ú__static_attributes__Ú__classdictcell__©r,   s   @r-   r%   r%   /   s@   ø‡ € ñ÷+ð +÷/ð /÷*ð *÷Dð D÷@ö @r0   r%   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V 3R lR ltRtV tR# )ÚElementTestsz-
Tests for the awesome new L{Element} class.
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   ÚElementTests.__annotate__`   s   ø€ ÷ 3ñ 3¨Dñ 3r0   c                ó”   € \        4       pV P                  \        VP                  R4      pV P	                  VP
                  V4       R# )zZ
L{Element.render} raises L{MissingTemplateLoader} if the C{loader}
attribute is L{None}.
N)r   rI   r   ÚrenderÚassertIdenticalÚelement©r6   rc   Úerrs   &  r-   Útest_missingTemplateLoaderÚ'ElementTests.test_missingTemplateLoader`   s8   € ô
 “)ˆØ×ÑÔ 5°w·~±~ÀtÓLˆØ×Ñ˜SŸ[™[¨'Ö2r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   i   s   ø€ ÷ 
ñ 
°ñ 
r0   c           	     óv   €  ! R R\         4      pV P                  R\        \        V! 4       4      4      4       R# )zD
A L{MissingTemplateLoader} instance can be repr()'d without error.
c                   ó2   a € ] tR t^nt o V 3R lR ltRtV tR# )ÚFElementTests.test_missingTemplateLoaderRepr.<locals>.PrettyReprElementc                ó    <€ V ^8„  d   QhRS[ /# ©r(   r)   ©Ústr)r+   r,   s   "€r-   r.   ÚSElementTests.test_missingTemplateLoaderRepr.<locals>.PrettyReprElement.__annotate__o   ó   ø€ ÷ -ñ -¡#ñ -r0   c                ó   € R # ©úPretty Repr Elementr*   rL   s   &r-   Ú__repr__ÚOElementTests.test_missingTemplateLoaderRepr.<locals>.PrettyReprElement.__repr__o   ó   € Ù,r0   r*   N©rT   rU   rV   rW   ru   rY   rZ   r[   s   @r-   ÚPrettyReprElementrk   n   ó   ø‡ € ÷-ö -r0   ry   rt   N)r   ÚassertInÚreprr   )r6   ry   s   & r-   Útest_missingTemplateLoaderReprÚ+ElementTests.test_missingTemplateLoaderRepri   s0   € ô
	-¤ô 	-ð 	�‰Ø!¤4Ô(=Ñ>OÓ>QÓ(RÓ#Sö	
r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   v   s   ø€ ÷ 0ñ 0¨Dñ 0r0   c                óÌ   € \        4       pV P                  \        VP                  R4      pV P	                  VP
                  V4       V P                  VP                  R4       R# )z†
When called with the name which is not associated with a render method,
L{Element.lookupRenderMethod} raises L{MissingRenderMethod}.
ÚfooN)r   rI   r   ÚlookupRenderMethodrb   rc   r3   Ú
renderNamerd   s   &  r-   Útest_missingRendererMethodÚ'ElementTests.test_missingRendererMethodv   sO   € ô
 “)ˆØ×ÑÔ 3°W×5OÑ5OÐQVÓWˆØ×Ñ˜SŸ[™[¨'Ô2Ø×Ñ˜Ÿ™¨Ö/r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   €   s   ø€ ÷ +ñ +¨dñ +r0   c                ó    €  ! R R\         4      p\        \        V! 4       R4      4      pV P                  RV4       V P                  RV4       R# )zB
A L{MissingRenderMethod} instance can be repr()'d without error.
c                   ó2   a € ] tR t^…t o V 3R lR ltRtV tR# )ÚDElementTests.test_missingRenderMethodRepr.<locals>.PrettyReprElementc                ó    <€ V ^8„  d   QhRS[ /# rm   rn   )r+   r,   s   "€r-   r.   ÚQElementTests.test_missingRenderMethodRepr.<locals>.PrettyReprElement.__annotate__†   rq   r0   c                ó   € R # rs   r*   rL   s   &r-   ru   ÚMElementTests.test_missingRenderMethodRepr.<locals>.PrettyReprElement.__repr__†   rw   r0   r*   Nrx   r[   s   @r-   ry   r‰   …   rz   r0   ry   ÚexpectedMethodrt   N)r   r|   r   r{   )r6   ry   Úss   &  r-   Útest_missingRenderMethodReprÚ)ElementTests.test_missingRenderMethodRepr€   sE   € ô
	-¤ô 	-ô Ô$Ñ%6Ó%8Ð:JÓKÓLˆØ�‰Ð+¨QÔ/Ø�‰Ð&¨Ö*r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   �   s   ø€ ÷ 4ñ 4 dñ 4r0   c                óž   €  ! R R\         4      pV! 4       P                  R4      pV P                  V! R\        P                  4      R4       R# )zq
When called with the name of a defined render method,
L{Element.lookupRenderMethod} returns that render method.
c                   ó<   a € ] tR t^“t o ]V 3R lR l4       tRtV tR# )ÚBElementTests.test_definedRenderer.<locals>.ElementWithRenderMethodc                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# ©r(   Úrequestr7   r)   ©r   r   r   r   )r+   r,   s   "€r-   r.   ÚOElementTests.test_definedRenderer.<locals>.ElementWithRenderMethod.__annotate__•   s'   ø€ ÷ ñ ¡8©HÕ#5ð ¹Cð ÁKñ r0   c                ó   € R # )Úbarr*   ©r6   r˜   r7   s   &&&r-   r�   ÚFElementTests.test_definedRenderer.<locals>.ElementWithRenderMethod.foo”   s   € ár0   r*   N)rT   rU   rV   rW   r   r�   rY   rZ   r[   s   @r-   ÚElementWithRenderMethodr•   “   s   ø‡ € Ø÷ó ör0   rŸ   r�   Nrœ   )r   r‚   r3   r   Úbr)r6   rŸ   r�   s   &  r-   Útest_definedRendererÚ!ElementTests.test_definedRenderer�   s>   € ô	¤gô 	ñ
 &Ó'×:Ñ:¸5ÓAˆØ×Ñ™˜T¤4§7¡7Ó+¨UÖ3r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   ›   s   ø€ ÷ ;ñ ;˜Tñ ;r0   c                ó¶   a€ \        \        4       ! R R4      4       o ! V3R lR\        4      pV! 4       pV P                  VP	                  R4      R.4       R# )zQ
L{Element.render} loads a document from the C{loader} attribute and
returns it.
c                   ó2   a € ] tR t^¡t o V 3R lR ltRtV tR# )Ú0ElementTests.test_render.<locals>.TemplateLoaderc                ó0   <€ V ^8„  d   QhRS[ S[,          /# rm   )r   r   )r+   r,   s   "€r-   r.   Ú=ElementTests.test_render.<locals>.TemplateLoader.__annotate__£   s   ø€ ÷ "ñ "™d¡;Õ/ñ "r0   c                ó   € R .# )Úresultr*   rL   s   &r-   ÚloadÚ5ElementTests.test_render.<locals>.TemplateLoader.load£   s
   € Ø �zÐ!r0   r*   N)rT   rU   rV   rW   r«   rY   rZ   r[   s   @r-   ÚTemplateLoaderr¦   ¡   s   ø‡ € ÷"ö "r0   r­   c                   ó(   <€ ] tR t^¦t Z ! 4       tRtR# )Ú-ElementTests.test_render.<locals>.StubElementr*   N)rT   rU   rV   rW   ÚloaderrY   )r­   s   €r-   ÚStubElementr¯   ¦   s   ø† Ú#Ó%ŒFr0   r±   Nrª   )r   r   r   r3   ra   )r6   r±   rc   r­   s   &  @r-   Útest_renderÚElementTests.test_render›   sQ   ø€ ô 
”_Ó	%÷	"ð 	"ó 
&ð	"÷	&œ'ô 	&ñ “-ˆØ×Ñ˜Ÿ™¨Ó-°¨zÖ:r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   ¬   s   ø€ ÷ ñ  Tñ r0   c                óÔ   € V P                  \        \        4      p\        P                  R8¼  d   V P                  \        V4      R4       R# V P                  \        V4      R4       R# )zj
If the L{renderer} decorator  is called without any arguments, it will
raise a comprehensible exception.
z=Expose.__call__() missing 1 required positional argument: 'f'z6__call__() missing 1 required positional argument: 'f'N)é   é
   )rI   Ú	TypeErrorr   ÚsysÚversion_infor3   ro   )r6   Útes   & r-   Útest_misuseRendererÚ ElementTests.test_misuseRenderer¬   sV   € ð
 ×Ñœy¬(Ó3ˆÜ×Ñ˜wÔ&Ø×ÑÜ�B“ÐXöð ×ÑÜ�B“ÐQör0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r_   »   s   ø€ ÷ Tñ T¨Tñ Tr0   c                óR   € V P                  \        \        P                  RR4       R# )zt
Called directly, without a default, L{renderer.get} raises
L{UnexposedMethodError} when it cannot find a renderer.
NÚnotARenderer)rI   r   r   ÚgetrL   s   &r-   Útest_renderGetDirectlyErrorÚ(ElementTests.test_renderGetDirectlyError»   s   € ð
 	×ÑÔ.´·±¸dÀNÖSr0   r*   N)rT   rU   rV   rW   rX   rf   r}   r„   r�   r¡   r²   r¼   rÂ   rY   rZ   r[   s   @r-   r]   r]   [   s\   ø‡ € ñ÷3ð 3÷
ð 
÷0ð 0÷+ð +÷4ð 4÷;ð ;÷"ð ÷Tö Tr0   r]   c                   óz   a € ] tR t^Ãt o RtV 3R lR ltV 3R lR lt].]n        V 3R lR lt	].]	n        Rt
V tR	# )
ÚXMLFileReprTestsz:
Tests for L{twisted.web.template.XMLFile}'s C{__repr__}.
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   ÚXMLFileReprTests.__annotate__È   s   ø€ ÷ Hñ H˜tñ Hr0   c                ón   € \        R4      pV P                  RV: R2\        \        V4      4      4       R# )z;
An L{XMLFile} with a L{FilePath} returns a useful repr().
ú/tmp/fake.xmlú<XMLFile of Ú>N)r   r3   r|   r   )r6   Úpaths   & r-   Útest_filePathÚXMLFileReprTests.test_filePathÈ   s0   € ô ˜Ó(ˆØ×Ñ˜<¨¡x¨qÐ1´4¼À»Ó3FÖGr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rÇ   Ï   s   ø€ ÷ Jñ J˜tñ Jr0   c                ó\   € RpV P                  RV: R2\        \        V4      4      4       R# )z8
An L{XMLFile} with a filename returns a useful repr().
rÉ   rÊ   rË   N)r3   r|   r   )r6   Úfnames   & r-   Útest_filenameÚXMLFileReprTests.test_filenameÏ   s+   € ð  ˆØ×Ñ˜<¨¡y°Ð2´D¼À»Ó4HÖIr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rÇ   Ø   s   ø€ ÷ Hñ H˜4ñ Hr0   c                ón   € \        R4      pV P                  RV: R2\        \        V4      4      4       R# )z;
An L{XMLFile} with a file object returns a useful repr().
znot xmlrÊ   rË   N)r   r3   r|   r   )r6   Úfobjs   & r-   Ú	test_fileÚXMLFileReprTests.test_fileØ   s0   € ô ˜	Ó"ˆØ×Ñ˜<¨¡x¨qÐ1´4¼À»Ó3FÖGr0   r*   N)rT   rU   rV   rW   rX   rÍ   rÒ   Ú_xmlFileSuppressr   r×   rY   rZ   r[   s   @r-   rÅ   rÅ   Ã   sK   ø‡ € ñ÷Hð H÷Jð Jð /Ð/€MÔ÷Hð Hð +Ð+€I×Òr0   rÅ   c                   óz   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].]n	        V 3R lt
R	tV tR
# )ÚXMLLoaderTestsMixinú<p>Hello, world.</p>c                ó    <€ V ^8„  d   QhRS[ /# rm   ©r   )r+   r,   s   "€r-   r.   Ú XMLLoaderTestsMixin.__annotate__î   s   ø€ ÷ "ñ "™ñ "r0   c                ó   € \         h©N)ÚNotImplementedErrorrL   s   &r-   ÚloaderFactoryÚ!XMLLoaderTestsMixin.loaderFactoryî   s   € Ü!Ð!r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rß   ñ   s   ø€ ÷ :ñ :˜4ñ :r0   c                óp  € \        V \        4      '       g   Q hV P                  4       pVP                  4       w  p\        V\        4      '       g   Q hV P                  V P                  .R7      pV P                  '       da   V P                  \        V4      ^4       V P                  V^ ,          R,          \        4       V P                  V^ ,          R,          R4       MV P                  \        V4      ^ 4       V P                  VP                  R4       V P                  VP                  R.4       R# )zA
Verify that the loader returns a tag with the correct children.
)ÚoffendingFunctionsr"   r#   r!   ÚpúHello, world.N)Ú
isinstancer   rã   r«   r   ÚflushWarningsÚdeprecatedUser3   ÚlenÚDeprecationWarningr4   Úchildren)r6   r°   r7   Úwarningss   &   r-   Ú	test_loadÚXMLLoaderTestsMixin.test_loadñ   sü   € ô ˜$¤×)Ò)Ð)Ð)Ø×#Ñ#Ó%ˆØ—‘“‰ˆÜ˜#œs×#Ò#Ð#Ð#à×%Ñ%¸$×:LÑ:LÐ9MÐ%ÓNˆØ××ÐØ×ÑœS ›]¨AÔ.Ø×Ñ˜X a�[¨Õ4Ô6HÔIØ×ÑØ˜•˜IÕ&ðKõð ×ÑœS ›]¨AÔ.à×Ñ˜Ÿ™ cÔ*Ø×Ñ˜Ÿ™¨Ð'8Ö9r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rß   	  s   ø€ ÷ 	'ñ 	' ñ 	'r0   c                ó¸   € \        V \        4      '       g   Q hV P                  4       pVP                  4       pVP                  4       pV P	                  W#4       R# )zL
If {load()} can be called on a loader twice the result should be the
same.
N)rê   r   rã   r«   r3   )r6   r°   Útags1Útags2s   &   r-   Útest_loadTwiceÚ"XMLLoaderTestsMixin.test_loadTwice	  sI   € ô
 ˜$¤×)Ò)Ð)Ð)Ø×#Ñ#Ó%ˆØ—‘“ˆØ—‘“ˆØ×Ñ˜Ö&r0   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r(   rì   )Úbool)r+   r,   s   "€r-   r.   rß   â   s   ø‡ ‚ ÙÑò r0   r*   N)rT   rU   rV   rW   ÚtemplateStringrã   rñ   r÷   rÙ   r   Ú__annotate_func__rY   rZ   r[   s   @r-   rÛ   rÛ   â   sI   ø‡ € ðð
 ,€Nð÷"ð "÷:ð :÷0	'ð 	'ð  0Ð0€NÔ÷e ƒ r0   rÛ   c                   ó:   a € ] tR tRt o RtRtV 3R lR ltRtV tR# )ÚXMLStringLoaderTestsi  z-
Tests for L{twisted.web.template.XMLString}
Fc                ó    <€ V ^8„  d   QhRS[ /# rm   rÞ   )r+   r,   s   "€r-   r.   Ú!XMLStringLoaderTests.__annotate__  s   ø€ ÷ .ñ .™ñ .r0   c                ó,   € \        V P                  4      # )zC
@return: an L{XMLString} constructed with C{self.templateString}.
)r   rû   rL   s   &r-   rã   Ú"XMLStringLoaderTests.loaderFactory  s   € ô ˜×,Ñ,Ó-Ð-r0   r*   N©	rT   rU   rV   rW   rX   rì   rã   rY   rZ   r[   s   @r-   rþ   rþ     s   ø‡ € ñð €M÷.ö .r0   rþ   c                   ó:   a € ] tR tRt o RtRtV 3R lR ltRtV tR# )ÚXMLFileWithFilePathTestsi%  zB
Tests for L{twisted.web.template.XMLFile}'s L{FilePath} support.
Fc                ó    <€ V ^8„  d   QhRS[ /# rm   rÞ   )r+   r,   s   "€r-   r.   Ú%XMLFileWithFilePathTests.__annotate__,  s   ø€ ÷ ñ ™ñ r0   c                óž   € \        V P                  4       4      pVP                  V P                  P	                  R4      4       \        V4      # )zv
@return: an L{XMLString} constructed with a L{FilePath} pointing to a
    file that contains C{self.templateString}.
Úutf8)r   ÚmktempÚ
setContentrû   Úencoder   ©r6   Úfps   & r-   rã   Ú&XMLFileWithFilePathTests.loaderFactory,  s;   € ô
 �d—k‘k“mÓ$ˆØ
�‰�d×)Ñ)×0Ñ0°Ó8Ô9Ü�r‹{Ðr0   r*   Nr  r[   s   @r-   r  r  %  s   ø‡ € ñð €M÷ö r0   r  c                   ó:   a € ] tR tRt o RtRtV 3R lR ltRtV tR# )ÚXMLFileWithFileTestsi6  zM
Tests for L{twisted.web.template.XMLFile}'s deprecated file object support.
Tc                ó    <€ V ^8„  d   QhRS[ /# rm   rÞ   )r+   r,   s   "€r-   r.   Ú!XMLFileWithFileTests.__annotate__=  s   ø€ ÷ 6ñ 6™ñ 6r0   c                ó>   € \        \        V P                  4      4      # )zc
@return: an L{XMLString} constructed with a file object that contains
    C{self.templateString}.
)r   r   rû   rL   s   &r-   rã   Ú"XMLFileWithFileTests.loaderFactory=  s   € ô
 ”x × 3Ñ 3Ó4Ó5Ð5r0   r*   Nr  r[   s   @r-   r  r  6  s   ø‡ € ñð €M÷6ö 6r0   r  c                   ó:   a € ] tR tRt o RtRtV 3R lR ltRtV tR# )ÚXMLFileWithFilenameTestsiE  zJ
Tests for L{twisted.web.template.XMLFile}'s deprecated filename support.
Tc                ó    <€ V ^8„  d   QhRS[ /# rm   rÞ   )r+   r,   s   "€r-   r.   Ú%XMLFileWithFilenameTests.__annotate__L  s   ø€ ÷  ñ  ™ñ  r0   c                ó²   € \        V P                  4       4      pVP                  V P                  P	                  R4      4       \        VP                  4      # )zs
@return: an L{XMLString} constructed with a filename that points to a
    file containing C{self.templateString}.
r	  )r   r
  r  rû   r  r   rÌ   r  s   & r-   rã   Ú&XMLFileWithFilenameTests.loaderFactoryL  s@   € ô
 �d—k‘k“mÓ$ˆØ
�‰�d×)Ñ)×0Ñ0°Ó8Ô9Ü�r—w‘wÓÐr0   r*   Nr  r[   s   @r-   r  r  E  s   ø‡ € ñð €M÷ ö  r0   r  c                   óh  a € ] tR tR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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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(# ))ÚFlattenIntegrationTestsiV  zO
Tests for integration between L{Element} and
L{twisted.web._flatten.flatten}.
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   Ú$FlattenIntegrationTests.__annotate__\  s   ø€ ÷ Pñ P ñ Pr0   c                ój   € . ROpV F(  pV P                  \        \        V4      R7      V4       K*  	  R# )zž
Given a series of parsable XML strings, verify that
L{twisted.web._flatten.flatten} will flatten the L{Element} back to the
input when sent on a round trip.
©r°   N)ó   <p>Hello, world.</p>s   <p><!-- hello, world --></p>s    <p><![CDATA[Hello, world.]]></p>sB   <test1 xmlns:test2="urn:test2"><test2:test3></test2:test3></test1>s0   <test1 xmlns="urn:test2"><test3></test3></test1>ó
   <p>â˜ƒ</p>)ÚassertFlattensImmediatelyr   r   )r6   Ú	fragmentsÚxmls   &  r-   Útest_roundTripÚ&FlattenIntegrationTests.test_roundTrip\  s.   € ò
ˆ	ó ˆCØ×*Ñ*¬7¼)ÀC».Ô+IÈ3ÖOó r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  m  s   ø€ ÷ Hñ H tñ Hr0   c                óT   € \        \        R4      R7      pV P                  VR4       R# )z`
When flattening an HTML entity, it should flatten out to the utf-8
representation if possible.
z<p>&#9731;</p>r!  r#  N©r   r   r$  ©r6   rc   s   & r-   Útest_entityConversionÚ-FlattenIntegrationTests.test_entityConversionm  s%   € ô
 ¤Ð+;Ó!<Ô=ˆØ×&Ñ& wÐ0FÖGr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  u  s   ø€ ÷ Fñ F¨Dñ Fr0   c                óB   € V P                  \        4       \        4       R# )zS
Rendering an Element without a loader attribute raises the appropriate
exception.
N)ÚassertFlatteningRaisesr   r   rL   s   &r-   rf   Ú2FlattenIntegrationTests.test_missingTemplateLoaderu  s   € ð
 	×#Ñ#¤G£IÔ/DÖEr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  |  s   ø€ ÷ Bñ B¨$ñ Br0   c                ó\   € \        \        R4      R7      pV P                  V\        4       R# )z²
Flattening an L{Element} with a C{loader} which has a tag with a render
directive fails with L{FlattenerError} if there is no available render
method to satisfy that directive.
zy
        <p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
          t:render="unknownMethod" />
        r!  N)r   r   r1  r   r,  s   & r-   Útest_missingRenderMethodÚ0FlattenIntegrationTests.test_missingRenderMethod|  s.   € ô Üðóô
ˆð 	×#Ñ# GÔ-@ÖAr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  Œ  s   ø€ ÷ Bñ B¨4ñ Br0   c                óT   € \        \        R4      R7      pV P                  VR4       R# )z_
A C{transparent} element should be eliminated from the DOM and rendered as
only its children.
zk<t:transparent xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">Hello, world.</t:transparent>r!  ó   Hello, world.Nr+  r,  s   & r-   Útest_transparentRenderingÚ1FlattenIntegrationTests.test_transparentRenderingŒ  s.   € ô
 Üð#óô
ˆð 	×&Ñ& wÐ0@ÖAr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  ›  s   ø€ ÷ 
ñ 
 Dñ 
r0   c                óT   € \        \        R4      R7      pV P                  VR4       R# )zf
An Element with an attr tag renders the vaule of its attr tag as an
attribute of its containing tag.
z‚<a xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"><t:attr name="href">http://example.com</t:attr>Hello, world.</a>r!  s.   <a href="http://example.com">Hello, world.</a>Nr+  r,  s   & r-   Útest_attrRenderingÚ*FlattenIntegrationTests.test_attrRendering›  s1   € ô
 Üðóô
ˆð 	×&Ñ&ØÐFö	
r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  ¬  s   ø€ ÷ Wñ W°4ñ Wr0   c                óx   € T P                  \        ^ú4       Uu. uF  p\        R4      NK  	  upR4       R# u upi )z~
When rendering a large number of already-fired Deferreds we should not
encounter any recursion errors or stack-depth issues.
ÚxNsú   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)r$  Úranger   )r6   Úis   & r-   Ú!test_synchronousDeferredRecursionÚ9FlattenIntegrationTests.test_synchronousDeferredRecursion¬  s.   € ð
 	×&Ñ&¼eÀC¼jÓ'I¹j¸¬°®¹jÑ'IÈ:ÖVùÒ'Is   ™7c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  ³  s   ø€ ÷ 
ñ 
¨ñ 
r0   c                ó<   € V P                  \        \        R4       R# )zc
A template with a toplevel C{attr} tag will not load; it will raise
L{AssertionError} if you try.
z˜<t:attr
            xmlns:t='http://twistedmatrix.com/ns/twisted.web.template/0.1'
            name='something'
            >hello</t:attr>
            N©rI   ÚAssertionErrorr   rL   s   &r-   Útest_errorToplevelAttrÚ.FlattenIntegrationTests.test_errorToplevelAttr³  s   € ð
 	×ÑÜÜðö	
r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  Â  s   ø€ ÷ 
ñ 
 tñ 
r0   c                ó<   € V P                  \        \        R4       R# )zu
A template with an C{attr} tag with no C{name} attribute will not load;
it will raise L{AssertionError} if you try.
z{<html><t:attr
            xmlns:t='http://twistedmatrix.com/ns/twisted.web.template/0.1'
            >hello</t:attr></html>NrI  rL   s   &r-   Útest_errorUnnamedAttrÚ-FlattenIntegrationTests.test_errorUnnamedAttrÂ  s   € ð
 	×ÑÜÜð&ö	
r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  Ï  s   ø€ ÷ @ñ @¨Dñ @r0   c                ót   € Rp\        \        V4      R7      pV P                  W!P                  R4      4       R# )zp
If the parser sees a prefix it doesn't recognize on an attribute, it
will pass it on through to serialization.
z}<hello:world hello:sample="testing" xmlns:hello="http://made-up.example.com/ns/not-real">This is a made-up tag.</hello:world>r!  r	  N)r   r   ÚassertFlattensTor  )r6   ÚtheInputrc   s   &  r-   Útest_lenientPrefixBehaviorÚ2FlattenIntegrationTests.test_lenientPrefixBehaviorÏ  s4   € ð3ð 	ô
 ¤¨8Ó!4Ô5ˆØ×Ñ˜g§¡°vÓ'>Ö?r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  Ü  s   ø€ ÷ Bñ B¨ñ Br0   c                ól   €  ! R R\         4      pV! \        R4      R7      pV P                  VR4       R# )zQ
An Element with a render method which returns a Deferred will render
correctly.
c                   ó<   a € ] tR tRt o ]V 3R lR l4       tRtV tR# )ÚHFlattenIntegrationTests.test_deferredRendering.<locals>.RenderfulElementiâ  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚUFlattenIntegrationTests.test_deferredRendering.<locals>.RenderfulElement.__annotate__ä  s*   ø€ ÷ 0ñ 0Ù'©Õ1ð0Ù8;ð0áñ0r0   c                ó   € \        R 4      # ©ré   )r   r�   s   &&&r-   ÚrenderMethodÚUFlattenIntegrationTests.test_deferredRendering.<locals>.RenderfulElement.renderMethodã  s   € ô ˜Ó/Ð/r0   r*   N©rT   rU   rV   rW   r   r_  rY   rZ   r[   s   @r-   ÚRenderfulElementrZ  â  s   ø‡ € Ø÷0ó ö0r0   rb  úŸ
        <p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
          t:render="renderMethod">
            Goodbye, world.
        </p>
        r!  r9  Nr+  ©r6   rb  rc   s   &  r-   Útest_deferredRenderingÚ.FlattenIntegrationTests.test_deferredRenderingÜ  s:   € ô	0œwô 	0ñ #Üðóô	
ˆð 	×&Ñ& wÐ0@ÖAr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  õ  s   ø€ ÷ 	Nñ 	N¨4ñ 	Nr0   c                óR   €  ! R R\         4      pV P                  V! 4       R4       R# )z‹
If there is a non-None loader attribute on the class of an Element
instance but none on the instance itself, the class attribute is used.
c                   ó&   € ] tR tRt]! R4      tRtR# )ÚEFlattenIntegrationTests.test_loaderClassAttribute.<locals>.SubElementiû  rÜ   r*   N)rT   rU   rV   rW   r   r°   rY   r*   r0   r-   Ú
SubElementrj  û  s   † ÙÐ5Ó6ŒFr0   rk  r"  N)r   r$  )r6   rk  s   & r-   Útest_loaderClassAttributeÚ1FlattenIntegrationTests.test_loaderClassAttributeõ  s#   € ô	7œô 	7ð 	×&Ñ&¡z£|Ð5LÖMr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r     s   ø€ ÷ Iñ I¨ñ Ir0   c                óx   a€ . o ! V3R lR\         4      pV! \        R4      R7      pV P                  VR4       R# )zi
An Element with a valid render directive has that directive invoked and
the result added to the output.
c                   óD   <a € ] tR tRt o ]V 3R lV3R ll4       tRtV tR# )ÚIFlattenIntegrationTests.test_directiveRendering.<locals>.RenderfulElementi  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚVFlattenIntegrationTests.test_directiveRendering.<locals>.RenderfulElement.__annotate__	  s*   ø€ ÷ ,ñ ,Ù'©Õ1ð,Ù8;ð,áñ,r0   c                ó8   <€ SP                  W34       V! R 4      # r^  )Úappend)r6   r˜   r7   Úrenderss   &&&€r-   r_  ÚVFlattenIntegrationTests.test_directiveRendering.<locals>.RenderfulElement.renderMethod  s   ø€ ð —‘ ˜Ô/Ù˜?Ó+Ð+r0   r*   Nra  )r,   rv  s   @€r-   rb  rq    s   ù‡ € Ø÷,ò ,ó ö,r0   rb  úx
        <p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
          t:render="renderMethod" />
        r!  r"  Nr+  )r6   rb  rc   rv  s   &  @r-   Útest_directiveRenderingÚ/FlattenIntegrationTests.test_directiveRendering   sB   ø€ ð
 ˆ÷	,œwô 	,ñ #Üðóô
ˆð 	×&Ñ& wÐ0GÖHr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r    s   ø€ ÷ Bñ B°Dñ Br0   c                ól   €  ! R R\         4      pV! \        R4      R7      pV P                  VR4       R# )zo
An Element with a render method which omits the containing tag
successfully removes that tag from the output.
c                   ó<   a € ] tR tRt o ]V 3R lR l4       tRtV tR# )ÚTFlattenIntegrationTests.test_directiveRenderingOmittingTag.<locals>.RenderfulElementi  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚaFlattenIntegrationTests.test_directiveRenderingOmittingTag.<locals>.RenderfulElement.__annotate__!  s*   ø€ ÷ 'ñ 'Ù'©Õ1ð'Ù8;ð'áñ'r0   c                ó   € R # r^  r*   r�   s   &&&r-   r_  ÚaFlattenIntegrationTests.test_directiveRenderingOmittingTag.<locals>.RenderfulElement.renderMethod   s   € ñ 'r0   r*   Nra  r[   s   @r-   rb  r~    s   ø‡ € Ø÷'ó ö'r0   rb  rc  r!  r9  Nr+  rd  s   &  r-   Ú"test_directiveRenderingOmittingTagÚ:FlattenIntegrationTests.test_directiveRenderingOmittingTag  s:   € ô	'œwô 	'ñ #Üðóô	
ˆð 	×&Ñ& wÐ0@ÖAr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  2  s   ø€ ÷ Rñ R°Tñ Rr0   c                ól   €  ! R R\         4      pV! \        R4      R7      pV P                  VR4       R# )ú\
An Element which is returned by the render method of another Element is
rendered properly.
c                   ó<   a € ] tR tRt o ]V 3R lR l4       tRtV tR# )ÚUFlattenIntegrationTests.test_elementContainingStaticElement.<locals>.RenderfulElementi8  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚbFlattenIntegrationTests.test_elementContainingStaticElement.<locals>.RenderfulElement.__annotate__:  s/   ø€ ÷ Pñ PÙ'©Õ1ðPÙ8;ðPáñPr0   c                ó8   € V! \        \        R 4      R7      4      # )z<em>Hello, world.</em>r!  )r   r   r�   s   &&&r-   r_  ÚbFlattenIntegrationTests.test_elementContainingStaticElement.<locals>.RenderfulElement.renderMethod9  s   € ñ œ7¬)Ð4LÓ*MÔNÓOÐOr0   r*   Nra  r[   s   @r-   rb  r‰  8  s   ø‡ € Ø÷Pó öPr0   rb  rx  r!  s   <p><em>Hello, world.</em></p>Nr+  rd  s   &  r-   Ú#test_elementContainingStaticElementÚ;FlattenIntegrationTests.test_elementContainingStaticElement2  s<   € ô	Pœwô 	Pñ #Üðóô
ˆð 	×&Ñ& wÐ0PÖQr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  I  s   ø€ ÷ Iñ I¨ñ Ir0   c                ól   €  ! R R\         4      pV! \        R4      R7      pV P                  VR4       R# )r‡  c                   ó<   a € ] tR tRt o ]V 3R lR l4       tRtV tR# )ÚHFlattenIntegrationTests.test_elementUsingSlots.<locals>.RenderfulElementiO  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚUFlattenIntegrationTests.test_elementUsingSlots.<locals>.RenderfulElement.__annotate__Q  s*   ø€ ÷ 5ñ 5Ù'©Õ1ð5Ù8;ð5áñ5r0   c                ó&   € VP                  R R7      # )zworld.)Útest2)Ú	fillSlotsr�   s   &&&r-   r_  ÚUFlattenIntegrationTests.test_elementUsingSlots.<locals>.RenderfulElement.renderMethodP  s   € ð —}‘}¨8�}Ó4Ð4r0   r*   Nra  r[   s   @r-   rb  r“  O  s   ø‡ € Ø÷5ó ö5r0   rb  zž<p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1" t:render="renderMethod"><t:slot name="test1" default="Hello, " /><t:slot name="test2" /></p>r!  r"  Nr+  rd  s   &  r-   Útest_elementUsingSlotsÚ.FlattenIntegrationTests.test_elementUsingSlotsI  s:   € ô	5œwô 	5ñ #Üðóô
ˆð 	×&Ñ& wÐ0GÖHr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  a  s   ø€ ÷ #Iñ #I°dñ #Ir0   c                ó’   a€  ! V3R lR\         4      p ! R R\         4      oV! \        R4      R7      pV P                  VR4       R# )	zŸ
Directives in the document factory of an Element returned from a render
method of another Element are satisfied from the correct object: the
"inner" Element.
c                   óD   <a € ] tR tRt o ]V 3R lV3R ll4       tRtV tR# )ÚRFlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.OuterElementih  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   Ú_FlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.OuterElement.__annotate__j  s'   ø€ ÷ ñ ©8±HÕ+=ð ÁCð ÉKñ r0   c                ó4   <€ V! S! \        R 4      R7      4      # )z©
                <t:ignored
                  xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
                  t:render="innerMethod" />
                r!  )r   )r6   r˜   r7   ÚInnerElements   &&&€r-   ÚouterMethodÚ^FlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.OuterElement.outerMethodi  s%   ø€ áÙ Ü(ðó ôó
ð 
r0   r*   N)rT   rU   rV   rW   r   r¤  rY   rZ   )r,   r£  s   @€r-   ÚOuterElementrŸ  h  s   ù‡ € Ø÷ò ó ör0   r¦  c                   ó<   a € ] tR tRt o ]V 3R lR l4       tRtV tR# )ÚRFlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.InnerElementiw  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   Ú_FlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.InnerElement.__annotate__y  s'   ø€ ÷ 'ñ '©8±HÕ+=ð 'ÁCð 'ÉKñ 'r0   c                ó   € R # r^  r*   r�   s   &&&r-   ÚinnerMethodÚ^FlattenIntegrationTests.test_elementContainingDynamicElement.<locals>.InnerElement.innerMethodx  s   € á&r0   r*   N)rT   rU   rV   rW   r   r¬  rY   rZ   r[   s   @r-   r£  r¨  w  s   ø‡ € Ø÷'ó ö'r0   r£  zw
        <p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"
          t:render="outerMethod" />
        r!  r"  Nr+  )r6   r¦  rc   r£  s   &  @r-   Ú$test_elementContainingDynamicElementÚ<FlattenIntegrationTests.test_elementContainingDynamicElementa  sG   ø€ ÷	œ7ô 	ô	'œ7ô 	'ñ
 Üðóô
ˆð 	×&Ñ& wÐ0GÖHr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   r  †  s   ø€ ÷ #:ñ #: dñ #:r0   c                óÎ   aa€ \        R4      o ! VV3R lR\        4      oS! 4       pS! 4       pV P                  VR4       V P                  VR4       V P                  VR4       R# )zg
Rendering the output of a loader, or even the same element, should
return different output each time.
zœ<p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1"><t:transparent t:render="classCounter" /> <t:transparent t:render="instanceCounter" /></p>c                   ón   <a € ] tR tRt o ^ t^ t Zt]V 3R lV3R ll4       t]V 3R lR l4       t	Rt
V tR# )ÚHFlattenIntegrationTests.test_sameLoaderTwice.<locals>.DestructiveElementi’  c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   ÚUFlattenIntegrationTests.test_sameLoaderTwice.<locals>.DestructiveElement.__annotate__˜  s*   ø€ ÷ :ñ :Ù'©Õ1ð:Ù8;ð:áñ:r0   c                ól   <€ S;P                   ^,          un         V! \        SP                   4      4      # ©é   )Úcountro   )r6   r˜   r7   ÚDestructiveElements   &&&€r-   ÚclassCounterÚUFlattenIntegrationTests.test_sameLoaderTwice.<locals>.DestructiveElement.classCounter—  s-   ø€ ð #×(Ò(¨AÕ-Õ(Ùœ3Ð1×7Ñ7Ó8Ó9Ð9r0   c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# r—   r™   )r+   r,   s   "€r-   r.   rµ  Ÿ  s*   ø€ ÷ 4ñ 4Ù'©Õ1ð4Ù8;ð4áñ4r0   c                ój   € V ;P                   ^,          un         V! \        V P                   4      4      # r·  )ÚinstanceCountro   r�   s   &&&r-   ÚinstanceCounterÚXFlattenIntegrationTests.test_sameLoaderTwice.<locals>.DestructiveElement.instanceCounterž  s+   € ð ×"Ò" aÕ'Õ"Ùœ3˜t×1Ñ1Ó2Ó3Ð3r0   r*   N)rT   rU   rV   rW   r¹  r¿  r°   r   r»  rÀ  rY   rZ   )r,   rº  ÚsharedLoaders   @€€r-   rº  r³  ’  s?   ù‡ € ØˆEØˆMÙ!ˆFà÷:ò :ó ð:ð ÷4ó ö4r0   rº  s
   <p>1 1</p>s
   <p>2 2</p>s
   <p>3 1</p>N)r   r   r$  )r6   Úe1Úe2rº  rÂ  s   &  @@r-   Útest_sameLoaderTwiceÚ,FlattenIntegrationTests.test_sameLoaderTwice†  sg   ù€ ô
 !ðó
ˆ÷	4ð 	4¤ô 	4ñ&  Ó!ˆÙÓ!ˆØ×&Ñ& r¨=Ô9Ø×&Ñ& r¨=Ô9Ø×&Ñ& r¨=Ö9r0   r*   N)rT   rU   rV   rW   rX   r'  r-  rf   r5  r:  r>  rE  rK  rO  rU  re  rl  ry  rƒ  rŽ  rš  r®  rÅ  rY   rZ   r[   s   @r-   r  r  V  sÛ   ø‡ € ñ÷
Pð P÷"Hð H÷Fð F÷Bð B÷ Bð B÷
ð 
÷"Wð W÷
ð 
÷
ð 
÷@ð @÷Bð B÷2	Nð 	N÷Ið I÷2Bð B÷2Rð R÷.Ið I÷0#Ið #I÷J#:ö #:r0   r  c                   ól   a € ] tR tR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Rt	V t
R# )ÚTagLoaderTestsi¬  z
Tests for L{TagLoader}.
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   ÚTagLoaderTests.__annotate__±  s   ø€ ÷ 0ñ 0�tñ 0r0   c                óN   € \        \        P                  ! R 4      4      V n        R# )ÚtestN)r   r   rD  r°   rL   s   &r-   ÚsetUpÚTagLoaderTests.setUp±  s   € Ü¤§¢ v£Ó/ˆŽr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rÊ  ´  s   ø€ ÷ Dñ D ñ Dr0   c                óX   € V P                  \        \        V P                  4      4       R# )z:
An instance of L{TagLoader} provides L{ITemplateLoader}.
N)Ú
assertTruer   r   r°   rL   s   &r-   Útest_interfaceÚTagLoaderTests.test_interface´  s   € ð 	�‰œ¤_°d·k±kÓBÖCr0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rÊ  º  s   ø€ ÷ 8ñ 8 ñ 8r0   c                ób   € V P                  V P                  P                  4       \        4       R# )z;
L{TagLoader.load} returns a list, per L{ITemplateLoader}.
N)ÚassertIsInstancer°   r«   ÚlistrL   s   &r-   Útest_loadsListÚTagLoaderTests.test_loadsListº  s!   € ð 	×Ñ˜dŸk™k×.Ñ.Ó0´$Ö7r0   c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   rÊ  À  s   ø€ ÷ :ñ :˜dñ :r0   c                óT   € \        V P                  4      pV P                  VR4       R# )zv
L{TagLoader} can be used in an L{Element}, and flattens as the tag used
to construct the L{TagLoader} would flatten.
s   <i>test</i>N)r   r°   r$  )r6   Úes   & r-   Útest_flattenÚTagLoaderTests.test_flattenÀ  s"   € ô
 �D—K‘KÓ ˆØ×&Ñ& q¨.Ö9r0   r!  N)rT   rU   rV   rW   rX   rÍ  rÒ  rØ  rÝ  rY   rZ   r[   s   @r-   rÈ  rÈ  ¬  s4   ø‡ € ñ÷0ð 0÷Dð D÷8ð 8÷:ö :r0   rÈ  c                   ó*   € ] tR tRtRt]! R4      tRtR# )ÚTestElementiÉ  z2
An L{Element} that can be rendered successfully.
zS<p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">Hello, world.</p>r*   N)rT   rU   rV   rW   rX   r   r°   rY   r*   r0   r-   rà  rà  É  s   † ññ ð	ó„Fr0   rà  c                   óJ   a € ] tR tRt o Rt]! R4      tRV 3R lR lltRtV t	R# )	ÚTestFailureElementiÕ  z|
An L{Element} that can be used in place of L{FailureElement} to verify
that L{renderElement} can render failures properly.
zO<p xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">I failed.</p>Nc                ó*   <€ V ^8„  d   QhRS[ RS[RR/# )r(   Úfailurer°   r)   N)r   Úobject)r+   r,   s   "€r-   r.   ÚTestFailureElement.__annotate__á  s"   ø€ ÷ ñ ¡ð ±ð À4ñ r0   c                ó   € Wn         R # rá   ©rä  )r6   rä  r°   s   &&&r-   Ú__init__ÚTestFailureElement.__init__á  s   € ØŽr0   rè  rá   )
rT   rU   rV   rW   rX   r   r°   ré  rY   rZ   r[   s   @r-   râ  râ  Õ  s*   ø‡ € ññ
 ð	ó€F÷÷ ð r0   râ  c                   ó6   a € ] tR tRt o RtV 3R lR ltRtV tR# )ÚFailingElementiå  z4
An element that raises an exception when rendered.
c                ó4   <€ V ^8„  d   QhRS[ S[,          RR/# )r(   r˜   r)   r   )r   r   )r+   r,   s   "€r-   r.   ÚFailingElement.__annotate__ê  s    ø€ ÷ ñ ™h¡xÕ0ð °]ñ r0   c                ó   € ^*p^ pW#,           # )é*   r*   )r6   r˜   r2   Úbs   &&  r-   ra   ÚFailingElement.renderê  s   € ØˆØˆØ•&�Ðr0   r*   N)rT   rU   rV   rW   rX   ra   rY   rZ   r[   s   @r-   rì  rì  å  s   ø‡ € ñ÷ö r0   rì  c                   ó   € ] tR tRtRtRtRtR# )ÚFakeSiteið  zD
A minimal L{Site} object that we can use to test displayTracebacks
Fr*   N)rT   rU   rV   rW   rX   ÚdisplayTracebacksrY   r*   r0   r-   rô  rô  ð  s   † ñð Ôr0   rô  c                   óB   a a€ ] tR tRt oRtV3R lV 3R lltRtVtV ;t# )ÚDummyRenderRequestiø  z’
A dummy request object that has a C{site} attribute.

This does not implement the full IRequest interface, but enough of it
for this test suite.
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   ÚDummyRenderRequest.__annotate__  s   ø€ ÷ ñ ˜$ñ r0   c                óF   <€ \         SV `  R .4       \        4       V n        R# )r0   N)Úsuperré  rô  Úsite)r6   Ú	__class__s   &€r-   ré  ÚDummyRenderRequest.__init__  s   ø€ Ü‰Ñ˜#˜ÔÜ“JˆŽ	r0   )rü  )	rT   rU   rV   rW   rX   ré  rY   rZ   Ú__classcell__)rý  r,   s   @@r-   r÷  r÷  ø  s   ù‡ € ñ÷÷ ó r0   r÷  c                   ó�   a € ] tR tR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
RtV tR# )ÚRenderElementTestsi  z
Test L{renderElement}
c                ó   <€ V ^8„  d   QhRR/# r'   r*   )r+   r,   s   "€r-   r.   ÚRenderElementTests.__annotate__  s   ø€ ÷ ,ñ ,�tñ ,r0   c                ó$   € \        4       V n        R# )z(
Set up a common L{DummyRenderRequest}.
N)r÷  r˜   rL   s   &r-   rÍ  ÚRenderElementTests.setUp  s   € ô *Ó+ˆŽr0   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r'   ©r   )r+   r,   s   "€r-   r.   r    s   ø€ ÷ ñ ¡8¨D¥>ñ r0   c                óØ   a € \        4       pS P                  P                  4       pR V 3R llpVP                  V4       S P	                  \
        \        S P                  V4      4       V# )z‚
L{renderElement} returns NOT_DONE_YET and eventually
writes the rendered L{Element} to the request before finishing the
request.
c                ó(   € V ^8„  d   QhR\         RR/# ©r(   Ú_r)   N©rå  )r+   s   "r-   r.   Ú:RenderElementTests.test_simpleRender.<locals>.__annotate__  s   € ÷ 	3ñ 	3”Vð 	3 ñ 	3r0   c                 ó¼   <€ SP                  R P                  SP                  P                  4      R4       SP	                  SP                  P
                  4       R# )r0   s$   <!DOCTYPE html>
<p>Hello, world.</p>N)r3   Újoinr˜   ÚwrittenrÑ  Úfinished©r  r6   s   &€r-   ÚcheckÚ3RenderElementTests.test_simpleRender.<locals>.check  sB   ø€ Ø×ÑØ—‘˜Ÿ™×-Ñ-Ó.Ø<ôð �O‰O˜DŸL™L×1Ñ1Ö2r0   )rà  r˜   ÚnotifyFinishÚaddCallbackrb   r   r   ©r6   rc   Údr  s   f   r-   Útest_simpleRenderÚ$RenderElementTests.test_simpleRender  sV   ø€ ô “-ˆà�L‰L×%Ñ%Ó'ˆ÷	3ð 	3ð 	
�‰�eÔà×Ñœ\¬=¸¿¹ÀwÓ+OÔPàˆr0   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r'   r  )r+   r,   s   "€r-   r.   r  (  s   ø€ ÷ ñ ¡H¨T¥Nñ r0   c                óØ   a € \        4       pS P                  P                  4       pR V 3R llpVP                  V4       S P	                  \
        \        S P                  V4      4       V# )zg
L{renderElement} handles failures by writing a minimal
error message to the request and finishing it.
c                ó(   € V ^8„  d   QhR\         RR/# r
  r  )r+   s   "r-   r.   Ú;RenderElementTests.test_simpleFailure.<locals>.__annotate__1  s   € ÷ 	3ñ 	3”Vð 	3 ñ 	3r0   c                 ó  <€ SP                  \        4      pSP                  \        V4      ^4       SP                  RP	                  SP
                  P                  4      R4       SP                  SP
                  P                  4       R# )r¸  r0   s‚   <!DOCTYPE html>
<div style="font-size:800%;background-color:#FFF;color:#F00">An error occurred while rendering the response.</div>N)	ÚflushLoggedErrorsr   r3   rí   r  r˜   r  rÑ  r  )r  Úflushedr6   s   & €r-   r  Ú4RenderElementTests.test_simpleFailure.<locals>.check1  si   ø€ Ø×,Ñ,¬^Ó<ˆGØ×ÑœS ›\¨1Ô-Ø×ÑØ—‘˜Ÿ™×-Ñ-Ó.ðOô	ð �O‰O˜DŸL™L×1Ñ1Ö2r0   )rì  r˜   r  r  rb   r   r   r  s   f   r-   Útest_simpleFailureÚ%RenderElementTests.test_simpleFailure(  sW   ø€ ô
 !Ó"ˆà�L‰L×%Ñ%Ó'ˆ÷	3ð 	3ð 	
�‰�eÔà×Ñœ\¬=¸¿¹ÀwÓ+OÔPàˆr0   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r'   r  )r+   r,   s   "€r-   r.   r  F  s   ø€ ÷ ñ ±¸$µñ r0   c                ó,  a a€ \         P                  ! S \        4      oRS P                  P                  n        \        4       pS P                  P                  4       pR VV 3R llpVP                  V4       \        S P                  V\        R7       V# )z€
L{renderElement} will render a traceback when rendering of
the element fails and our site is configured to display tracebacks.
Tc                ó(   € V ^8„  d   QhR\         RR/# r
  r  )r+   s   "r-   r.   ÚHRenderElementTests.test_simpleFailureWithTraceback.<locals>.__annotate__R  s   € ÷ 		3ñ 		3”Vð 		3 ñ 		3r0   c                 ó²  <€ SP                  ^\        S4      4       S^ ,          R,          pSP                  VP                  \        4       SP                  \        4      pSP                  \        V4      ^4       SP                  RP                  SP                  P                  4      R4       SP                  SP                  P                  4       R# )r¸  Úlog_failurer0   s    <!DOCTYPE html>
<p>I failed.</p>N)ÚassertEqualsrí   rÖ  Úvaluer   r   r3   r  r˜   r  rÑ  r  )r  Úfr!  ÚlogObserverr6   s   &  €€r-   r  ÚARenderElementTests.test_simpleFailureWithTraceback.<locals>.checkR  s�   ø€ Ø×Ñ˜a¤ [Ó!1Ô2Ø˜A•˜}Õ-ˆAØ×!Ñ! !§'¡'¬>Ô:Ø×,Ñ,¬^Ó<ˆGØ×ÑœS ›\¨1Ô-Ø×ÑØ—‘˜Ÿ™×-Ñ-Ó.Ð0Tôð �O‰O˜DŸL™L×1Ñ1Ö2r0   )Ú_failElement)r	   ÚcreateWithCleanupr
   r˜   rü  rõ  rì  r  r  r   râ  )r6   rc   r  r  r.  s   f   @r-   Útest_simpleFailureWithTracebackÚ2RenderElementTests.test_simpleFailureWithTracebackF  sr   ù€ ô
 +×<Ò<¸TÔCUÓVˆØ.2ˆ�‰×ÑÔ+ä Ó"ˆà�L‰L×%Ñ%Ó'ˆ÷		3ñ 		3ð 	
�‰�eÔä�d—l‘l GÔ:LÕMàˆr0   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r'   r  )r+   r,   s   "€r-   r.   r  c  s   ø€ ÷ ñ ©°­ñ r0   c                ó´   a € \        4       pS P                  P                  4       pR V 3R llpVP                  V4       \	        S P                  VRR7       V# )z[
L{renderElement} will write the doctype string specified by the
doctype keyword argument.
c                ó(   € V ^8„  d   QhR\         RR/# r
  r  )r+   s   "r-   r.   Ú?RenderElementTests.test_nonDefaultDoctype.<locals>.__annotate__l  s   € ÷ 	ñ 	”Vð 	 ñ 	r0   c                 ór   <€ SP                  R P                  SP                  P                  4      R4       R# )r0   s‚   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<p>Hello, world.</p>N©r3   r  r˜   r  r  s   &€r-   r  Ú8RenderElementTests.test_nonDefaultDoctype.<locals>.checkl  s,   ø€ Ø×ÑØ—‘˜Ÿ™×-Ñ-Ó.ð,ör0   sm   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">©Údoctype©rà  r˜   r  r  r   r  s   f   r-   Útest_nonDefaultDoctypeÚ)RenderElementTests.test_nonDefaultDoctypec  sU   ø€ ô
 “-ˆà�L‰L×%Ñ%Ó'ˆ÷	ð 	ð 	
�‰�eÔäØ�L‰LØðIõ		
ð ˆr0   c                ó.   <€ V ^8„  d   QhRS[ R,          /# r'   r  )r+   r,   s   "€r-   r.   r  ƒ  s   ø€ ÷ ñ ¡(¨4¥.ñ r0   c                ó´   a € \        4       pS P                  P                  4       pR V 3R llpVP                  V4       \	        S P                  VRR7       V# )z[
L{renderElement} will not write out a doctype if the doctype keyword
argument is L{None}.
c                ó(   € V ^8„  d   QhR\         RR/# r
  r  )r+   s   "r-   r.   Ú9RenderElementTests.test_noneDoctype.<locals>.__annotate__Œ  s   € ÷ 	Vñ 	V”Vð 	V ñ 	Vr0   c                 ór   <€ SP                  R P                  SP                  P                  4      R4       R# )r0   r"  Nr9  r  s   &€r-   r  Ú2RenderElementTests.test_noneDoctype.<locals>.checkŒ  s'   ø€ Ø×Ñ˜SŸX™X d§l¡l×&:Ñ&:Ó;Ð=TÖUr0   Nr;  r=  r  s   f   r-   Útest_noneDoctypeÚ#RenderElementTests.test_noneDoctypeƒ  sM   ø€ ô
 “-ˆà�L‰L×%Ñ%Ó'ˆ÷	Vð 	Vð 	
�‰�eÔä�d—l‘l G°TÕ:àˆr0   )r˜   N)rT   rU   rV   rW   rX   rÍ  r  r#  r2  r>  rF  rY   rZ   r[   s   @r-   r  r    sG   ø‡ € ñ÷,ð ,÷ð ÷.ð ÷<ð ÷:ð ÷@ö r0   r  )FrX   r¹   Úior   Útypingr   r   Úzope.interfacer   Úzope.interface.verifyr   Útwisted.internet.deferr   r   Útwisted.internet.testingr	   Útwisted.loggerr
   Útwisted.python.failurer   Útwisted.python.filepathr   Útwisted.trial.unittestr   Útwisted.trial.utilr   ÚSUPPRESSÚtwisted.web._elementr   Útwisted.web.errorr   r   r   Útwisted.web.iwebr   r   Útwisted.web.serverr   Útwisted.web.templater   r   r   r   r   r   r   r   r   Útwisted.web.test._utilr   Útwisted.web.test.test_webr    rî   rÙ   r%   r]   rÅ   rÛ   rþ   r  r  r  r  rÈ  rà  râ  rì  rô  r÷  r  r*   r0   r-   Ú<module>r[     sS  ðñó Ý ß !å &Ý .ç 4Ý 9Ý -Ý *Ý ,Ý +Ý 3Ý 5ß XÑ Xß 6Ý +÷
÷ 
õ 
õ 3Ý 2áØð?ôÐ ô)@�hô )@ôXeT�8ô eTôP,�xô ,÷>21ñ 21ôj.˜8Ð%8ô .ô˜xÐ)<ô ô"6˜8Ð%8ô 6ô ˜xÐ)<ô  ô"S:˜oô S:ôl
:�_ô :ô:	�'ô 	ô˜ô ô �Wô ÷ñ ñ ˆXÓô
˜ó 
ó ð
ôM˜ö Mr0   