CasperSecurity

Current Path : /usr/lib/python3/dist-packages/twisted/python/test/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/twisted/python/test/__pycache__/test_urlpath.cpython-310.pyc

o

�b�'�@sjdZddlmZddlmZGdd�d�ZGdd�deej�ZGdd	�d	eej�ZGd
d�deej�Z	dS)
z&
Tests for L{twisted.python.urlpath}.
�)�urlpath)�unittestc@steZdZdZdd�Zdd�Zefdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�_BaseURLPathTestsz5
    Tests for instantiated L{urlpath.URLPath}s.
    cC�T|�|jjt�|�|jjt�|�|jjt�|�|jjt�|�|jjt�dS)zQ
        All of the attributes of L{urlpath.URLPath} should be L{bytes}.
        N��assertIsInstance�path�scheme�bytes�netloc�query�fragment��self�r�B/usr/lib/python3/dist-packages/twisted/python/test/test_urlpath.py�test_partsAreBytes�
z$_BaseURLPathTests.test_partsAreBytescCs|�t|j���t�dS)zQ
        Calling C{str()} with a L{URLPath} will always return a L{str}.
        N)�assertEqual�typer�__str__�strrrrr�test_strReturnsStrsz$_BaseURLPathTests.test_strReturnsStrcCs�|d�|j_|�t|j�d�|d�|j_|�t|j�d�|d�|j_|�t|j�d�|d�|j_|�t|j�d�|d	�|j_|�t|j�d
�dS)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)rr	rrrrr
)r�
stringTyperrr�test_mutabilityWithText"s.

��
���z)_BaseURLPathTests.test_mutabilityWithTextcCs|�dd��dS)zC
        Same as L{test_mutabilityWithText} but for bytes.
        cSs
|�d�S)N�ascii)�encode)�xrrr�<lambda>Js
z<_BaseURLPathTests.test_mutabilityWithBytes.<locals>.<lambda>N)rrrrr�test_mutabilityWithBytesFsz*_BaseURLPathTests.test_mutabilityWithBytescCr)z<
        A created L{URLPath} has bytes attributes.
        Nrrrrr�test_allAttributesAreBytesLrz,_BaseURLPathTests.test_allAttributesAreBytescCs|�t|j�d�dS)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)rrrrrrr�test_stringConversionVs
�z'_BaseURLPathTests.test_stringConversioncCsV|�t|j�d��d�|�t|j�d��d��d�|�t|jjddd��d�dS)	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/hello�z!http://example.com/foo/bar/hello/T��	keepQueryz.http://example.com/foo/bar/hello?yes=no&no=yesN)rrr�childrrrr�test_childString_s���z"_BaseURLPathTests.test_childStringcCsV|�t|j�d��d�|�t|jjddd��d�|�t|j�d��d��d�dS)	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=yesr%zhttp://example.com/foo/bar/bazN)rrr�siblingr(rrrr�test_siblingStringps�	�z$_BaseURLPathTests.test_siblingStringcCs�|�t|j���d�|�t|jjdd��d�|�t|j�d����d�|�t|j�d����d�|�t|j�����������d�dS)	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/r*N)rrr�parentr(rrrr�test_parentString�s���z#_BaseURLPathTests.test_parentStringcCsP|�t|j���d�|�t|jjdd��d�|�t|j�d����d�dS)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.
        r-Tr&z%http://example.com/foo/?yes=no&no=yesr%zhttp://example.com/foo/bar/N)rrr�herer(rrrr�test_hereString�s��z!_BaseURLPathTests.test_hereStringcCs"|�t|j�d���d�d�dS)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/worldrshttp://example.com/hello/worldN)rrr�clickrrrrr�test_doubleSlash�s�z"_BaseURLPathTests.test_doubleSlashcCs`|�|j�d���gd��|�|j�d�jdd�gd��|�|j�d�jdd�gd��dS)	zL
        L{urlpath.URLPath.pathList} returns a L{list} of L{bytes}.
        �	%00%01%02)r%�foo�barr4F)�copyT)�unquote)r%r5r6sN)rrr(�pathListrrrr�
test_pathList�s�	��z_BaseURLPathTests.test_pathListN)�__name__�
__module__�__qualname__�__doc__rrrrr!r"r$r)r,r/r1r3r:rrrrr
s
$
	rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�BytesURLPathTestszL
    Tests for interacting with a L{URLPath} created with C{fromBytes}.
    cC�tj�d�|_dS)Ns/http://example.com/foo/bar?yes=no&no=yes#footer)r�URLPath�	fromBytesrrrrr�setUp��
�zBytesURLPathTests.setUpcC�r|�t��tj�d�Wd�n1swY|�t��tj�d�Wd�dS1s2wYdS)zE
        L{URLPath.fromBytes} must take a L{bytes} argument.
        N�someurl)�assertRaises�
ValueErrorrrArBrrrr�test_mustBeBytes���"�z"BytesURLPathTests.test_mustBeBytescCst��}|�t|�d�dS)zp
        An instantiation with no arguments creates a usable L{URLPath} with
        default arguments.
        zhttp://localhost/N)rrArr�r�urlrrr�test_withoutArguments�sz'BytesURLPathTests.test_withoutArgumentscCsftj�d�}|�|jd�|�|jd�|�|jd�|�|jd�|�|jd�|�t	|�d�dS)z�
        Leaving some optional arguments unfilled makes a L{URLPath} with those
        optional arguments filled with defaults.
        shttp://google.comshttps
google.com�/r%zhttp://google.com/N)
rrArBrr	rrr
rrrKrrr�test_partialArguments�sz'BytesURLPathTests.test_partialArgumentscC� tj�d�}|�t|�d�dS)zW
        L{URLPath.fromBytes} can interpret non-ASCII bytes as percent-encoded
        shttp://example.com/�zhttp://example.com/%FF%00N)rrArBrrrKrrr�test_nonASCIIBytes��z$BytesURLPathTests.test_nonASCIIBytesN)	r;r<r=r>rCrIrMrOrQrrrrr?�s
r?c@� eZdZdZdd�Zdd�ZdS)�StringURLPathTests�g
    Tests for interacting with a L{URLPath} created with C{fromString} and a
    L{str} argument.
    cCr@�Nr#�rrA�
fromStringrrrrrrCrDzStringURLPathTests.setUpcCrE)zN
        C{URLPath.fromString} must take a L{str} or L{str} argument.
        Nssomeurl)rGrHrrArXrrrr�test_mustBeStrrJz!StringURLPathTests.test_mustBeStrN)r;r<r=r>rCrYrrrrrT��rTc@rS)�UnicodeURLPathTestsrUcCr@rVrWrrrrrCrDzUnicodeURLPathTests.setUpcCrP)zF
        L{URLPath.fromString} can load non-ASCII characters.
        uhttp://example.com/ÿzhttp://example.com/%C3%BF%00N)rrArXrrrKrrr�test_nonASCIICharactersrRz+UnicodeURLPathTests.test_nonASCIICharactersN)r;r<r=r>rCr\rrrrr[rZr[N)
r>�twisted.pythonr�
twisted.trialrr�TestCaser?rTr[rrrr�<module>s<3
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY