HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/hyperlink/test/__pycache__/test_decoded_url.cpython-38.pyc
U

��\s�@sLddlmZddlmZddlmZddlmZdZdZ	Gd	d
�d
e�Z
dS)�)�unicode_literals�)�
DecodedURL)�_percent_decode�)�HyperlinkTestCasezhttp://example.com/#uahttps://%75%73%65%72:%00%00%00%00@xn--bcher-kva.ch:8080/a/nice%20nice/./path/?zot=23%25&zut#frégc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestURLcCs�t�t�}|jdkst�|jdks&t�|jdks4t�|jdksBt�|jdksPt�t�t	�}|jdksht�|jdksvt�|jdks�t�|jd	ks�t�|jd
ks�t�|�
d�dgks�t�|jd
ks�t�|jdks�t�dS)NZhttpzexample.com�P)�r
Zhttpsu
bücher.chi�)�az	nice nice�.�pathr
ufrég�zot�23%�user)rz)
r�	from_text�	BASIC_URL�scheme�AssertionError�host�portr
�fragment�	TOTAL_URL�getr�userinfo)�selfZbdurl�durl�r�A/usr/lib/python3/dist-packages/hyperlink/test/test_decoded_url.py�test_durl_basics

zTestURL.test_durl_basiccCsht�t�}|�d�jddks"t�|�d�jddks:t�|��|ksJt�|��|ksZt�|�d�jddksrt�|jdks�t�d|jks�t�d|�	�jks�t�|�
�jdks�t�d	|��jd
ks�t�|j
dd�tks�t�|js�t�|js�t�||j��k�st�tjtdd
�}||jjdd
�k�s*t�tt�t��d	��dk�sHt�|d
k�rVt�|d
k�sdt�dS)Nzte%t���z	../test2%�/r
rrz	fr%C3%A9g� rT)Z
with_password)Zlazyzhttp://example.com/%20)rrrZsiblingr
rZchild�clickrZ	normalize�to_urirZto_iri�to_textZabsolute�rootedZencoded_urlZget_decoded_url�strr�rr�durl2rrr�test_passthroughs#s(


zTestURL.test_passthroughscCs,t�t�}t|�dt|j�dks(t�dS)NzDecodedURL(url=�))rrr�repr�_urlr�rrrrr�	test_reprDs
zTestURL.test_reprcCsZt�t�}|�d�dgkst�|�dd�}|�d�dgks>t�|�dd�}|�d�dgks^t�t|��d�}|�d�dgks�t�|�d�}|�d�gks�t�t�d�}|�d�d	d
gks�t�|�dd��d�dgks�t�t�d�}|�d
�t�d�ks�t�|jd
dd�t�d�k�st�|jd
dd�t�d�k�s6t�|jd
ddd�t�d�k�sVt�dS)Nrrr"Zspacezspa%ed)Zurlz/?%61rg=b&arg=c�arg�b�c�du.https://example.com/a/b/?fóó=1&bar=2&fóó=3ufóózhttps://example.com/a/b/?bar=2�1)�valueu&https://example.com/a/b/?bar=2&fóó=3r)�limitr)r5r6)	rrrrr�add�setr$�remover.rrr�test_query_manipulationHs$



zTestURL.test_query_manipulationcCs�t�t�}t�t�}t�t�}|��}||ks2t�||ks>t�||ksJt�|dksVt�||jksdt�i}|||<|||<t|�dks�t�|||<t|�dks�t�|||<t|�dks�t�dS)Nrr�)rrrrr$rr-�len)rrr)ZburlZdurl_uriZdurl_maprrr�test_equality_and_hashabilityas"


z%TestURL.test_equality_and_hashabilitycCsHt�t�}|j|j|j|j|j|j|j	|j
|j|jd�	}||ksDt
�dS)N)	rrr
�queryrrr&r�uses_netloc)rrr�replacerrr
r>rrr&rr?rr(rrr�test_replace_roundtrip{s
�
zTestURL.test_replace_roundtripc	Cs6t�t�}|�t��|jdddgd�W5QRXdS)NrZpwZthiswillcauseafailure)r)rrr�assertRaises�
ValueErrorr@r.rrr�test_replace_userinfo�s
zTestURL.test_replace_userinfocCsTt�t�}|t�t�kst�dt|�ks,t�dt|�ks<t�|��|��ksPt�dS)Nr%�asText)rrrZfromTextr�dirr%rEr.rrr�test_twisted_compat�s

zTestURL.test_twisted_compatcCstddd�dkst�dS)Nz%00F�Zsubencoding�)rr�rrrr�test_percent_decode_bytes�sz!TestURL.test_percent_decode_bytesc	Csntd�dkst�td�dks t�|�t��tddd�W5QRXtddd�d	ksVt�td
dd�d
ksjt�dS)Nuabcdé%C3%A9éfguabcdéééfgu
abcdé%C3éfgT)Zraise_subencoding_excza%00bFrHsabué%25é�ascii)rrrB�UnicodeDecodeErrorrJrrr�test_percent_decode_mixed�sz!TestURL.test_percent_decode_mixedcCsPt�t�}t�d�}|�|�}|j|jks.t�|j|jks>t�|jdksLt�dS)Nu/tëst)utëst)rrrr#rrr
)rrZ	durl_destZclickedrrr�test_click_decoded_url�s


zTestURL.test_click_decoded_urlN)�__name__�
__module__�__qualname__rr*r/r:r=rArDrGrKrNrOrrrrr
s!rN)Z
__future__rr
rr-r�commonrrrrrrrr�<module>s