%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/web/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/web/test/__pycache__/test_stan.cpython-312.pyc

�

Ϫ�fT��n�dZddlZddlmZddlmZddlmZmZm	Z	m
Z
mZde
de
defd	�ZGd
�de�Z
y)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�$�td�|i|��S)z(
    Produce a new tag for testing.
    �hello)r	)r
rs  �</usr/lib/python3/dist-packages/twisted/web/test/test_stan.py�protors���3�w�<��!�b�!�!�c�p�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd	�Z
dd
�Zdd�Zdd�Z
dd
�Zdd�Zy)�TagTestsz
    Tests for L{Tag}.
    Nc��td��}|j|jd�|j|ji�y)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_renderAttributezTagTests.test_renderAttributes6��
�<�(��������\�2��������,rc���|jt�5}td��ddd�|jjj
dd�y#1swY�3xYw)z�
        Attempting to set an attribute named C{render} to something other than
        a string will raise L{TypeError}.
        �SrNrz0Value for "render" attribute must be str, got 83)�assertRaises�	TypeErrorrr�	exception�args)r�es  r�test_renderAttributeNonStringz&TagTests.test_renderAttributeNonString&sT��
�
�
�y�
)�	�Q����	����
�K�K���Q��!S�	
�	�	�s�
A�Ac�\�t�}|j||jd���y)z0
        L{Tag.fillSlots} returns self.
        �test)r'N)r�assertIdentical�	fillSlotsrs  r�test_fillSlotszTagTests.test_fillSlots1s&���g�����S�#�-�-�V�-�"<�=rc�b�dg}td|dd��}|jd��d|_d	|_d
|_|jd��}|j
|jd
d�|j|j|j�|j
|jd|g�|j|j|j�|j|jd|�|j
|j|j�|j|j|j�|j
|jd�|j
|jd	�|j
|jd
�|j
|jd�y)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�rr�bar��foo�foo/bar��F)�deepr�N�
rr)�filename�
lineNumber�columnNumber�clonerr�assertNotIdentical�childrenr(�slotDatar)r�	innerListrr=s    r�test_cloneShallowzTagTests.test_cloneShallow8sR��"�N�	��M�9�G�O�T���
�
�%�
� � ����������	�	�u�	�%������)�)�'�2�G�<����� 0� 0�#�.�.�A�������-��)C�D����������=����U�^�^�A�.�	�:�������u�~�~�6�������e�n�n�=��������3�����)�)�1�-�����+�+�R�0��������7rc���td�}dg}td||dd��}|jd��d	|_d
|_d|_|j�}|j
|jdd�|j|j|j�|j|j|j�|j|jd
|�|j|jd
|�|j|jd|�|j|jd|�|j
|j|j�|j|j|j�|j
|jd	�|j
|jd
�|j
|jd�|j
|jd�y)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/r0r1r2r4r5r6rr8�Nr9)r�innerTagrArr=s     r�test_cloneDeepzTagTests.test_cloneDeepQs�����>��!�N�	���8�Y�g�o�
��	�
�
�%�
� � ����������	�	�������)�)�'�2�G�<����� 0� 0�#�.�.�A����������=����S�\�\�!�_�h�7�������q� 1�8�<����S�\�\�!�_�i�8�������q� 1�9�=�������u�~�~�6�������e�n�n�=��������3�����)�)�1�-�����+�+�R�0��������7rc���td�td�D��}|jtdtj
tjj|j�y)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.
        c3�2K�|]}t|����y�w�N)�str)�.0�ns  r�	<genexpr>z:TagTests.test_cloneGeneratorDeprecation.<locals>.<genexpr>ys����.�q�C��F�.�s��
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=rs  r�test_cloneGeneratorDeprecationz'TagTests.test_cloneGeneratorDeprecationssM���.�E�"�I�.�.������
)�
�K�K����'�0�0��I�I�	
rc�"�dtfd�}|�}td|d�}	|jtdtj
tjj|j�|j�y#|j�wxYw)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��wrJ)�NotImplementedError�rr�	asyncFuncz:TagTests.test_cloneCoroutineDeprecation.<locals>.asyncFunc�s����%�%�s�	�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)rrrQrRrSrTr	rUrVr=�close)rr\�corors    r�test_cloneCoroutineDeprecationz'TagTests.test_cloneCoroutineDeprecation�st��	&��	&��{���E�4��'��	����"�-����C�N�N�+�4�4��	�	�
�
�J�J�L��D�J�J�L�s�AA<�<Bc��tdddd��}|j�|j|jg�|j|jddi�y)zk
        L{Tag.clear} removes all children from a tag, but leaves its attributes
        in place.
        z	these arer?�coolzthis-attribute)�andSoIsrdN)r�clearrr?rrs  r�
test_clearzTagTests.test_clear�sL��
�K��V�=M�N���	�	��������r�*�������)�5E�)F�Grc�v�td�}|�}|d��|j|jddi�y)z�
        L{Tag.__call__} accepts Python keywords with a suffixed underscore as
        the DOM attribute of that literal suffix.
        �divr
)�class_�classN)r	rr)rrrs   r�test_suffixzTagTests.test_suffix�s3��
�E�
���g���3��������'�3��8rc�L�|jttd��d�y)zo
        L{Comment.__repr__} returns a value which makes it easy to see what's
        in the comment.
        zhello therezComment('hello there')N)r�reprr�rs r�test_commentReprPy3zTagTests.test_commentReprPy3�s��
	
����g�m�4�5�7O�Prc�L�|jttd��d�y)zm
        L{CDATA.__repr__} returns a value which makes it easy to see what's in
        the comment.
        z	test datazCDATA('test data')N)rrmrrns r�test_cdataReprPy3zTagTests.test_cdataReprPy3�s��
	
����e�K�0�1�3G�Hrc�b�td�}|jtt|��d�y)zw
        L{CharRef.__repr__} returns a value which makes it easy to see what
        character is referred to.
        u☃z
CharRef(9731)N)�ordrrmr)r�snowmans  r�test_charrefReprzTagTests.test_charrefRepr�s(��
�m�$������g�g�.�/��Ar)rN)�__name__rU�__qualname__�__doc__rr%r*rBrGrWrarfrkrorqrur[rrrrsH���-�	
�>�8�2 8�D
�"�2H�9�Q�I�Brr)rxrS�typingr�twisted.trial.unittestr�twisted.web.templaterrrrr	rrr[rr�<module>r|sE�����+�J�J�"�k�"��"��"�mB�x�mBr

Zerion Mini Shell 1.0