§
    ÉtºfT  ã                   óv   — d Z ddlZddlmZ ddlmZ ddlmZmZm	Z	m
Z
mZ de
de
defd	„Z G d
„ de¦  «        ZdS )zW
Tests for L{twisted.web._stan} portion of the L{twisted.web.template}
implementation.
é    N)ÚNoReturn)ÚTestCase)ÚCDATAÚCharRefÚCommentÚFlattenableÚTagÚaÚkwÚreturnc                  ó,   —  t          d¦  «        | i |¤ŽS )z(
    Produce a new tag for testing.
    Úhello)r	   )r
   r   s     úY/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/web/test/test_stan.pyÚprotor      s   € ð �3ˆw‰<Œ<˜Ð!˜bÐ!Ð!Ð!ó    c                   ór   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd	„Z	dd
„Z
dd„Zdd„Zdd„Zdd„Zdd„ZdS )ÚTagTestsz
    Tests for L{Tag}.
    r   Nc                 ó’   — t          d¬¦  «        }|                      |j        d¦  «         |                      |j        i ¦  «         dS )zŠ
        Setting an attribute named C{render} will change the C{render} instance
        variable instead of adding an attribute.
        Ú
myRenderer©ÚrenderN)r   ÚassertEqualr   Ú
attributes©ÚselfÚtags     r   Útest_renderAttributezTagTests.test_renderAttribute   sJ   € õ
 ˜<Ð(Ñ(Ô(ˆØ×Ò˜œ \Ñ2Ô2Ð2Ø×Ò˜œ¨Ñ,Ô,Ð,Ð,Ð,r   c                 óÖ   — |                       t          ¦  «        5 }t          d¬¦  «         ddd¦  «         n# 1 swxY w Y   |                      |j        j        d         d¦  «         dS )z‚
        Attempting to set an attribute named C{render} to something other than
        a string will raise L{TypeError}.
        éS   r   Nr   z0Value for "render" attribute must be str, got 83)ÚassertRaisesÚ	TypeErrorr   r   Ú	exceptionÚargs)r   Úes     r   Útest_renderAttributeNonStringz&TagTests.test_renderAttributeNonString&   s­   € ð
 ×Ò�yÑ)Ô)ð 	¨QÝ˜ÐÑÔÐð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	à×ÒØŒKÔ˜QÔÐ!Sñ	
ô 	
ð 	
ð 	
ð 	
s   ›8¸<¿<c                 óv   — t          ¦   «         }|                      ||                     d¬¦  «        ¦  «         dS )z0
        L{Tag.fillSlots} returns self.
        Útest)r'   N)r   ÚassertIdenticalÚ	fillSlotsr   s     r   Útest_fillSlotszTagTests.test_fillSlots1   s7   € õ ‰gŒgˆØ×Ò˜S #§-¢-°V -Ñ"<Ô"<Ñ=Ô=Ð=Ð=Ð=r   c                 óJ  — dg}t          d|dd¬¦  «        }|                     d¬¦  «         d|_        d	|_        d
|_        |                     d¬¦  «        }|                      |j        d         d¦  «         |                      |j        |j        ¦  «         |                      |j	        d|g¦  «         |                      |j	        |j	        ¦  «         |  
                    |j	        d         |¦  «         |                      |j        |j        ¦  «         |                      |j        |j        ¦  «         |                      |j        d¦  «         |                      |j        d	¦  «         |                      |j        d
¦  «         |                      |j        d¦  «         dS )z´
        L{Tag.clone} copies all attributes and children of a tag, including its
        render attribute.  If the shallow flag is C{False}, that's where it
        stops.
        ú
inner listúHow are youÚworldÚaSampleMethod©r   r   Úbar©Úfooúfoo/baré   é   F)Údeepr   é   N©r   r)   ÚfilenameÚ
lineNumberÚcolumnNumberÚcloner   r   ÚassertNotIdenticalÚchildrenr(   ÚslotDatar   )r   Ú	innerListr   r=   s       r   Útest_cloneShallowzTagTests.test_cloneShallow8   s‡  € ð "�Nˆ	Ý�M 9°GÀOÐTÑTÔTˆØ�Š˜%ˆÑ Ô Ð Ø ˆŒØˆŒØˆÔØ—	’	˜u�	Ñ%Ô%ˆØ×Ò˜Ô)¨'Ô2°GÑ<Ô<Ð<Ø×Ò Ô 0°#´.ÑAÔAÐAØ×Ò˜œ¨-¸Ð)CÑDÔDÐDØ×Ò ¤°´Ñ=Ô=Ð=Ø×Ò˜Uœ^¨AÔ.°	Ñ:Ô:Ð:Ø×Ò˜œ u¤~Ñ6Ô6Ð6Ø×Ò ¤¨e¬nÑ=Ô=Ð=Ø×Ò˜œ¨Ñ3Ô3Ð3Ø×Ò˜Ô)¨1Ñ-Ô-Ð-Ø×Ò˜Ô+¨RÑ0Ô0Ð0Ø×Ò˜œ Ñ7Ô7Ð7Ð7Ð7r   c                 óò  — t          d¦  «        }dg}t          d||dd¬¦  «        }|                     d¬¦  «         d	|_        d
|_        d|_        |                     ¦   «         }|                      |j        d         d¦  «         |                      |j        |j        ¦  «         |                      |j	        |j	        ¦  «         |  
                    |j	        d         |¦  «         |                      |j	        d         |¦  «         |  
                    |j	        d         |¦  «         |                      |j	        d         |¦  «         |                      |j        |j        ¦  «         |                      |j        |j        ¦  «         |                      |j        d	¦  «         |                      |j        d
¦  «         |                      |j        d¦  «         |                      |j        d¦  «         dS )zø
        L{Tag.clone} copies all attributes and children of a tag, including its
        render attribute.  In its normal operating mode (where the deep flag is
        C{True}, as is the default), it will clone all sub-lists and sub-tags.
        Úinnerr,   r-   r.   r/   r0   r1   r2   r4   r5   r6   r   r8   é   Nr9   )r   ÚinnerTagrA   r   r=   s        r   Útest_cloneDeepzTagTests.test_cloneDeepQ   sÏ  € õ ˜‘>”>ˆØ!�Nˆ	ÝØ˜8 Y°gÀoð
ñ 
ô 
ˆð 	�Š˜%ˆÑ Ô Ð Ø ˆŒØˆŒØˆÔØ—	’	‘”ˆØ×Ò˜Ô)¨'Ô2°GÑ<Ô<Ð<Ø×Ò Ô 0°#´.ÑAÔAÐAØ×Ò ¤°´Ñ=Ô=Ð=à×Ò˜Sœ\¨!œ_¨hÑ7Ô7Ð7à×Ò ¤¨qÔ 1°8Ñ<Ô<Ð<à×Ò˜Sœ\¨!œ_¨iÑ8Ô8Ð8à×Ò ¤¨qÔ 1°9Ñ=Ô=Ð=Ø×Ò˜œ u¤~Ñ6Ô6Ð6Ø×Ò ¤¨e¬nÑ=Ô=Ð=Ø×Ò˜œ¨Ñ3Ô3Ð3Ø×Ò˜Ô)¨1Ñ-Ô-Ð-Ø×Ò˜Ô+¨RÑ0Ô0Ð0Ø×Ò˜œ Ñ7Ô7Ð7Ð7Ð7r   c                 óÔ   — t          d„ t          d¦  «        D ¦   «         ¦  «        }|                      t          dt          j        t          j                 j        |j	        ¦  «         dS )zì
        Cloning a tag containing a generator is unsafe. To avoid breaking
        programs that only flatten the clone or only flatten the original,
        we deprecate old behavior rather than making it an error immediately.
        c              3   ó4   K  — | ]}t          |¦  «        V — Œd S ©N)Ústr)Ú.0Úns     r   ú	<genexpr>z:TagTests.test_cloneGeneratorDeprecation.<locals>.<genexpr>y   s(   è è € Ð.Ð.˜q•C˜‘F”FÐ.Ð.Ð.Ð.Ð.Ð.r   é
   z´Cloning a Tag which contains a generator is unsafe, since the generator can be consumed only once; this is deprecated since Twisted 21.7.0 and will raise an exception in the futureN)
r   ÚrangeÚassertWarnsÚDeprecationWarningÚsysÚmodulesr	   Ú
__module__Ú__file__r=   r   s     r   Útest_cloneGeneratorDeprecationz'TagTests.test_cloneGeneratorDeprecations   sf   € õ Ð.Ð.¥E¨"¡I¤IÐ.Ñ.Ô.Ñ.Ô.ˆØ×ÒÝð)õ ŒK�œÔ'Ô0ØŒIñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó0  — dt           fd„} |¦   «         }t          d|d¦  «        }	 |                      t          dt          j        t          j                 j        |j	        ¦  «         | 
                    ¦   «          dS # | 
                    ¦   «          w xY w)zì
        Cloning a tag containing a coroutine is unsafe. To avoid breaking
        programs that only flatten the clone or only flatten the original,
        we deprecate old behavior rather than making it an error immediately.
        r   c               “   ó   K  — t           ‚rJ   )ÚNotImplementedError© r   r   Ú	asyncFuncz:TagTests.test_cloneCoroutineDeprecation.<locals>.asyncFunc‹   s   è è € Ý%Ð%r   Ú123Ú789z¬Cloning a Tag which contains a coroutine is unsafe, since the coroutine can run only once; this is deprecated since Twisted 21.7.0 and will raise an exception in the futureN)r   r   rQ   rR   rS   rT   r	   rU   rV   r=   Úclose)r   r\   Úcoror   s       r   Útest_cloneCoroutineDeprecationz'TagTests.test_cloneCoroutineDeprecation„   s›   € ð	&¥ð 	&ð 	&ð 	&ð 	&ð ˆy‰{Œ{ˆÝ�E˜4 Ñ'Ô'ˆð	Ø×ÒÝ"ð-õ ”�CœNÔ+Ô4Ø”	ñô ð ð �JŠJ‰LŒLˆLˆLˆLøˆD�JŠJ‰LŒLˆLˆLøøøs   ¨AA? Á?Bc                 óÄ   — t          dddd¬¦  «        }|                     ¦   «          |                      |j        g ¦  «         |                      |j        ddi¦  «         dS )zk
        L{Tag.clear} removes all children from a tag, but leaves its attributes
        in place.
        z	these arer?   Úcoolzthis-attribute)ÚandSoIsrd   N)r   Úclearr   r?   r   r   s     r   Ú
test_clearzTagTests.test_clear�   sd   € õ
 �K ¨VÐ=MÐNÑNÔNˆØ�	Š	‰ŒˆØ×Ò˜œ rÑ*Ô*Ð*Ø×Ò˜œ¨)Ð5EÐ)FÑGÔGÐGÐGÐGr   c                 óŠ   — t          d¦  «        } |¦   «         } |d¬¦  «         |                      |j        ddi¦  «         dS )z‰
        L{Tag.__call__} accepts Python keywords with a suffixed underscore as
        the DOM attribute of that literal suffix.
        Údivr
   )Úclass_ÚclassN)r	   r   r   )r   r   r   s      r   Útest_suffixzTagTests.test_suffix§   sK   € õ
 �E‘
”
ˆØˆe‰gŒgˆØˆ�3ˆ‰ŒˆØ×Ò˜œ¨'°3¨Ñ8Ô8Ð8Ð8Ð8r   c                 óf   — |                       t          t          d¦  «        ¦  «        d¦  «         dS )zo
        L{Comment.__repr__} returns a value which makes it easy to see what's
        in the comment.
        zhello therezComment('hello there')N)r   Úreprr   ©r   s    r   Útest_commentReprPy3zTagTests.test_commentReprPy3±   s1   € ð
 	×Ò��g mÑ4Ô4Ñ5Ô5Ð7OÑPÔPÐPÐPÐPr   c                 óf   — |                       t          t          d¦  «        ¦  «        d¦  «         dS )zm
        L{CDATA.__repr__} returns a value which makes it easy to see what's in
        the comment.
        z	test datazCDATA('test data')N)r   rm   r   rn   s    r   Útest_cdataReprPy3zTagTests.test_cdataReprPy3¸   s1   € ð
 	×Ò��e KÑ0Ô0Ñ1Ô1Ð3GÑHÔHÐHÐHÐHr   c                 ó„   — t          d¦  «        }|                      t          t          |¦  «        ¦  «        d¦  «         dS )zw
        L{CharRef.__repr__} returns a value which makes it easy to see what
        character is referred to.
        u   â˜ƒzCharRef(9731)N)Úordr   rm   r   )r   Úsnowmans     r   Útest_charrefReprzTagTests.test_charrefRepr¿   s=   € õ
 �mÑ$Ô$ˆØ×Ò��g gÑ.Ô.Ñ/Ô/°ÑAÔAÐAÐAÐAr   )r   N)Ú__name__rU   Ú__qualname__Ú__doc__r   r%   r*   rB   rG   rW   ra   rf   rk   ro   rq   ru   r[   r   r   r   r      s!  € € € € € ðð ð-ð -ð -ð -ð	
ð 	
ð 	
ð 	
ð>ð >ð >ð >ð8ð 8ð 8ð 8ð2 8ð  8ð  8ð  8ðD
ð 
ð 
ð 
ð"ð ð ð ð2Hð Hð Hð Hð9ð 9ð 9ð 9ðQð Qð Qð QðIð Ið Ið IðBð Bð Bð Bð Bð Br   r   )rx   rS   Útypingr   Útwisted.trial.unittestr   Útwisted.web.templater   r   r   r   r	   r   r   r[   r   r   ú<module>r|      sÙ   ððð ð €
€
€
Ø Ð Ð Ð Ð Ð à +Ð +Ð +Ð +Ð +Ð +Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ Jð"ˆkð " ð "°ð "ð "ð "ð "ðmBð mBð mBð mBð mBˆxñ mBô mBð mBð mBð mBr   