%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f�'���dZddlmZddlmZGd�d�ZGd�deej�ZGd�d	eej�ZGd
�deej�Z	y)
z&
Tests for L{twisted.python.urlpath}.
�)�urlpath)�unittestc�\�eZdZdZd�Zd�Zefd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zy)�_BaseURLPathTestsz5
    Tests for instantiated L{urlpath.URLPath}s.
    c��|j|jjt�|j|jjt�|j|jjt�|j|jj
t�|j|jjt�y)zQ
        All of the attributes of L{urlpath.URLPath} should be L{bytes}.
        N��assertIsInstance�path�scheme�bytes�netloc�query�fragment��selfs �B/usr/lib/python3/dist-packages/twisted/python/test/test_urlpath.py�test_partsAreBytesz$_BaseURLPathTests.test_partsAreBytes���	
���d�i�i�.�.��6����d�i�i�.�.��6����d�i�i�n�n�e�4����d�i�i�o�o�u�5����d�i�i�0�0�%�8�c�r�|jt|jj��t�y)zQ
        Calling C{str()} with a L{URLPath} will always return a L{str}.
        N)�assertEqual�typer
�__str__�strrs r�test_strReturnsStrz$_BaseURLPathTests.test_strReturnsStrs&��	
����d�i�i�/�/�1�2�C�8rc�\�|d�|j_|jt|j�d�|d�|j_|jt|j�d�|d�|j_|jt|j�d�|d�|j_|jt|j�d�|d	�|j_|jt|j�d
�y)a?
        Setting attributes on L{urlpath.URLPath} should change the value
        returned by L{str}.

        @param stringType: a callable to parameterize this test for different
            text types.
        @type stringType: 1-argument callable taking L{str} and returning
            L{str} or L{bytes}.
        �httpsz0https://example.com/foo/bar?yes=no&no=yes#footerzanother.example.invalidz<https://another.example.invalid/foo/bar?yes=no&no=yes#footerz/helloz:https://another.example.invalid/hello?yes=no&no=yes#footerzalpha=omega&opposites=samezGhttps://another.example.invalid/hello?alpha=omega&opposites=same#footer�headerzGhttps://another.example.invalid/hello?alpha=omega&opposites=same#headerN)r
rrrr
rr)r�
stringTypes  r�test_mutabilityWithTextz)_BaseURLPathTests.test_mutabilityWithText"s���&�g�.��	�	�������	�	�N�N�	
�&�&?�@��	�	�������	�	�N�J�	
�$�H�-��	�	�������	�	�N�X�	
�%�%A�B��	�	�������	�	�N�
�	
�
(��1��	�	�������	�	�N�
�	
rc�(�|jd��y)zC
        Same as L{test_mutabilityWithText} but for bytes.
        c�$�|jd�S)N�ascii)�encode)�xs r�<lambda>z<_BaseURLPathTests.test_mutabilityWithBytes.<locals>.<lambda>Js��q�x�x��/@�rN)r rs r�test_mutabilityWithBytesz*_BaseURLPathTests.test_mutabilityWithBytesFs��	
�$�$�%@�Arc��|j|jjt�|j|jjt�|j|jjt�|j|jj
t�|j|jjt�y)z<
        A created L{URLPath} has bytes attributes.
        Nrrs r�test_allAttributesAreBytesz,_BaseURLPathTests.test_allAttributesAreBytesLrrc�N�|jt|j�d�y)zs
        Calling C{str()} with a L{URLPath} will return the same URL that it was
        constructed with.
        �/http://example.com/foo/bar?yes=no&no=yes#footerN)rrr
rs r�test_stringConversionz'_BaseURLPathTests.test_stringConversionVs ��
	
�����	�	�N�M�	
rc�^�|jt|jjd��d�|jt|jjd�jd��d�|jt|jjdd���d�y)	z�
        Calling C{str()} with a C{URLPath.child()} will return a URL which is
        the child of the URL it was instantiated with.
        shelloz http://example.com/foo/bar/hellorz!http://example.com/foo/bar/hello/T��	keepQueryz.http://example.com/foo/bar/hello?yes=no&no=yesN)rrr
�childrs r�test_childStringz"_BaseURLPathTests.test_childString_s���
	
�����	�	����)�*�,N�	
�	
�����	�	����)�/�/��4�5�/�	
�	
�����	�	����D��9�:�<�	
rc�^�|jt|jjd��d�|jt|jjdd���d�|jt|jj	d�jd��d�y)	z�
        Calling C{str()} with a C{URLPath.sibling()} will return a URL which is
        the sibling of the URL it was instantiated with.
        �bazzhttp://example.com/foo/bazTr.z(http://example.com/foo/baz?yes=no&no=yesrzhttp://example.com/foo/bar/bazN)rrr
�siblingr0rs r�test_siblingStringz$_BaseURLPathTests.test_siblingStringps���
	
����T�Y�Y�.�.�v�6�7�9U�V������	�	�!�!�&�D�!�9�:�6�	
�	
�����	�	����$�,�,�V�4�5�7W�	
rc��|jt|jj��d�|jt|jjd���d�|jt|jj	d�j��d�|jt|jj	d�j��d�|jt|jj�j�j�j�j��d�y)	z�
        Calling C{str()} with a C{URLPath.parent()} will return a URL which is
        the parent of the URL it was instantiated with.
        zhttp://example.com/Tr.z!http://example.com/?yes=no&no=yesr�http://example.com/foo/r3N)rrr
�parentr0rs r�test_parentStringz#_BaseURLPathTests.test_parentString�s���	
����T�Y�Y�-�-�/�0�2G�H������	�	� � �4� �0�1�3V�	
�	
����T�Y�Y�_�_�S�1�8�8�:�;�=V�W������	�	����'�.�.�0�1�3L�	
�	
�����	�	� � �"�)�)�+�2�2�4�;�;�=�D�D�F�G�!�	
rc�X�|jt|jj��d�|jt|jjd���d�|jt|jj	d�j��d�y)z�
        Calling C{str()} with a C{URLPath.here()} will return a URL which is
        the URL that it was instantiated with, without any file, query, or
        fragment.
        r7Tr.z%http://example.com/foo/?yes=no&no=yesrzhttp://example.com/foo/bar/N)rrr
�herer0rs r�test_hereStringz!_BaseURLPathTests.test_hereString�s~��	
����T�Y�Y�^�^�-�.�0I�J������	�	�����.�/�1X�	
�	
�����	�	����$�)�)�+�,�.K�	
rc��|jt|jjd��j	d�d�y)z�
        Calling L{urlpath.URLPath.click} on a L{urlpath.URLPath} with a
        trailing slash with a relative URL containing a leading slash will
        result in a URL with a single slash at the start of the path portion.
        s/hello/worldr#shttp://example.com/hello/worldN)rrr
�clickr$rs r�test_doubleSlashz"_BaseURLPathTests.test_doubleSlash�s5��	
�����	�	����0�1�8�8��A�-�	
rc�n�|j|jjd�j�gd��|j|jjd�jd��gd��|j|jjd�jd��gd��y)	zL
        L{urlpath.URLPath.pathList} returns a L{list} of L{bytes}.
        �	%00%01%02)r�foo�barrAF)�copyT)�unquote)rrBrCsN)rr
r0�pathListrs r�
test_pathListz_BaseURLPathTests.test_pathList�s���	
����I�I�O�O�L�)�2�2�4�/�	
�	
����I�I�O�O�L�)�2�2��2�>�/�	
�	
����I�I�O�O�L�)�2�2�4�2�@�2�	
rN)�__name__�
__module__�__qualname__�__doc__rrrr r'r)r,r1r5r9r<r?rG�rrrr
sJ���9�9�25�"
�HB�9�
�
�"
�&
�(

�	
�
rrc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�BytesURLPathTestszL
    Tests for interacting with a L{URLPath} created with C{fromBytes}.
    c�L�tjjd�|_y)Ns/http://example.com/foo/bar?yes=no&no=yes#footer)r�URLPath�	fromBytesr
rs r�setUpzBytesURLPathTests.setUp�s���O�O�-�-�>�
��	rc�(�|jt�5tjj	d�ddd�|jt�5tjj	d�ddd�y#1swY�GxYw#1swYyxYw)zE
        L{URLPath.fromBytes} must take a L{bytes} argument.
        N�someurl)�assertRaises�
ValueErrorrrPrQrs r�test_mustBeBytesz"BytesURLPathTests.test_mustBeBytes�su���
�
�z�
*�	,��O�O�%�%�d�+�	,��
�
�z�
*�	1��O�O�%�%�i�0�	1�	1�	,�	,��	1�	1��� A<� B�<B�Bc�b�tj�}|jt|�d�y)zp
        An instantiation with no arguments creates a usable L{URLPath} with
        default arguments.
        zhttp://localhost/N)rrPrr�r�urls  r�test_withoutArgumentsz'BytesURLPathTests.test_withoutArguments�s%��
�o�o�������S��#6�7rc��tjjd�}|j|jd�|j|j
d�|j|jd�|j|jd�|j|jd�|jt|�d�y)z�
        Leaving some optional arguments unfilled makes a L{URLPath} with those
        optional arguments filled with defaults.
        shttp://google.comshttps
google.com�/rzhttp://google.com/N)
rrPrQrrr
r
rrrrZs  r�test_partialArgumentsz'BytesURLPathTests.test_partialArguments�s����o�o�'�'�(<�=��������W�-�������]�3�������4�(�������s�+�������C�(�����S��#7�8rc�x�tjjd�}|jt	|�d�y)zW
        L{URLPath.fromBytes} can interpret non-ASCII bytes as percent-encoded
        shttp://example.com/�zhttp://example.com/%FF%00N)rrPrQrrrZs  r�test_nonASCIIBytesz$BytesURLPathTests.test_nonASCIIBytes�s.���o�o�'�'�(F�G������S��#>�?rN)	rHrIrJrKrRrWr\r_rarLrrrNrN�s!���
�
1�8�
9�@rrNc��eZdZdZd�Zd�Zy)�StringURLPathTests�g
    Tests for interacting with a L{URLPath} created with C{fromString} and a
    L{str} argument.
    c�L�tjjd�|_y�Nr+�rrP�
fromStringr
rs rrRzStringURLPathTests.setUp����O�O�.�.�=�
��	rc�(�|jt�5tjj	d�ddd�|jt�5tjj	d�ddd�y#1swY�GxYw#1swYyxYw)zN
        C{URLPath.fromString} must take a L{str} or L{str} argument.
        Nssomeurl)rUrVrrPrhrs r�test_mustBeStrz!StringURLPathTests.test_mustBeStrsu���
�
�z�
*�	-��O�O�&�&�t�,�	-��
�
�z�
*�	3��O�O�&�&�z�2�	3�	3�	-�	-��	3�	3�rXN)rHrIrJrKrRrkrLrrrcrc�s���

�
3rrcc��eZdZdZd�Zd�Zy)�UnicodeURLPathTestsrdc�L�tjjd�|_yrfrgrs rrRzUnicodeURLPathTests.setUprirc�x�tjjd�}|jt	|�d�y)zF
        L{URLPath.fromString} can load non-ASCII characters.
        uhttp://example.com/ÿzhttp://example.com/%C3%BF%00N)rrPrhrrrZs  r�test_nonASCIICharactersz+UnicodeURLPathTests.test_nonASCIICharacterss.���o�o�(�(�)F�G������S��#A�BrN)rHrIrJrKrRrprLrrrmrms���

�
CrrmN)
rK�twisted.pythonr�
twisted.trialrr�TestCaserNrcrmrLrr�<module>rtsc��
�#�"�x
�x
�v0@�)�8�+<�+<�0@�f3�*�H�,=�,=�3�,C�+�X�->�->�Cr

Zerion Mini Shell 1.0