%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/hyperlink/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/hyperlink/test/__pycache__/test_url.cpython-312.pyc

�

G�_?�����ddlmZddlZddlZddlmZmZmZmZm	Z	m
Z
ddlmZddl
mZmZddlmZmZej&ddk(Zed	�Zd
ZdZgd�Zd
ZGd�de�Zy)�)�unicode_literalsN)�Any�Iterable�Optional�Text�Tuple�cast�)�HyperlinkTestCase�)�URL�
URLParseError)�	inet_pton�SCHEME_PORT_MAP��*http://www.foo.com/a/nice/path/?zot=23&zut�http://a/b/c/d;p?q)()�g�http://a/b/c/g)z./gr)zg/�http://a/b/c/g/)z/g�
http://a/g)z//gzhttp://g)z?yzhttp://a/b/c/d;p?y)zg?yzhttp://a/b/c/g?y)z#szhttp://a/b/c/d;p?q#s)zg#szhttp://a/b/c/g#s)zg?y#szhttp://a/b/c/g?y#s)z;xzhttp://a/b/c/;x)zg;xzhttp://a/b/c/g;x)zg;x?y#szhttp://a/b/c/g;x?y#s)rr)�.�
http://a/b/c/)z./r)�..�http://a/b/)z../r)z../g�http://a/b/g)z../..�	http://a/)z../../r)z../../gr)z
../../../gr)z
../../../../gr)z/./gr)z/../gr)zg.zhttp://a/b/c/g.)z.gzhttp://a/b/c/.g)zg..zhttp://a/b/c/g..)z..gzhttp://a/b/c/..g)z./../gr)z./g/.r)zg/./hzhttp://a/b/c/g/h)zg/../hzhttp://a/b/c/h)z	g;x=1/./yzhttp://a/b/c/g;x=1/y)z
g;x=1/../yzhttp://a/b/c/y)zg?y/./xzhttp://a/b/c/g?y/./x)zg?y/../xzhttp://a/b/c/g?y/../x)zg#s/./xzhttp://a/b/c/g#s/./x)zg#s/../xzhttp://a/b/c/g#s/../x)6zhttp://localhost�http://localhost/zhttp://127.0.0.1/zhttp://[::127.0.0.1]/z
http://[::1]/zhttp://localhost/foozhttp://localhost/foo/zhttp://localhost/foo!!bar/zhttp://localhost/foo%20bar/zhttp://localhost/foo%2Fbar/zhttp://localhost/foo?nzhttp://localhost/foo?n=vzhttp://localhost/foo?n=/a/bz%http://example.com/foo!@$bar?b!@z=123z$http://localhost/asd?a=asd%20sdf/345z6http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)z<http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)zG?sslrootcert=/Users/glyph/Downloads/rds-ca-2015-root.pem&sslmode=verifyz%http://googlewebsite.com/e-shops.aspxz?http://example.com:8080/search?q=123&business=Nothing%20Specialz*http://hatnote.com:9000/?arg=1&arg=2&arg=3�https://xn--bcher-kva.chz"http://xn--ggbla1c4e.xn--ngbc5azd/z.http://tools.ietf.org/html/rfc3986#section-3.4z:ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gzz.http://[1080:0:0:0:8:800:200C:417A]/index.htmlzssh://192.0.2.16:2222/z$https://[::101.45.75.219]:80/?hi=byez7ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)zFmailto:me@example.com?to=me@example.com&body=hi%20http://wikipedia.orgznews:alt.rec.motorcycleztel:+1-800-867-5309zurn:oasis:member:A00024:xamagnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337zhttps://%3A@example.com/zhttps://%40@example.com/zhttps://%2f@example.com/zhttps://a:%3a@example.com/zhttps://a:%40@example.com/zhttps://a:%2f@example.com/zhttps://a:%3f@example.com/zhttps://example.com/%2F/zhttps://example.com/%3F/zhttps://example.com/%23/zhttps://example.com/?%23=bzhttps://example.com/?%3D=bzhttps://example.com/?%26=bzhttps://example.com/?a=%23zhttps://example.com/?a=%26zhttps://example.com/?a=%3Dz https://example.com/?foo+bar=bazz https://example.com/?foo=bar+bazzChttp://(%2525):(%2525)@example.com/(%2525)/?(%2525)=(%2525)#(%2525)z8first_seg_rel_path__colon%3Anotok/second_seg__colon%3Aokc���eZdZdZd�Z	dNd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNyM)O�TestURLz
    Tests for L{URL}.
    c���|jt|jt�xs|jdut	|��|jt|j
t�xs|j
dut	|��|jD]+}|jt|�tt	|���-|jD]]\}}|jt�tt	|��|j|duxst|t�t	|���_|jt|j�tt	|��y)zl
        The given L{URL}'s components should be L{unicode}.

        @param u: The L{URL} to test.
        N)�
assertTrue�
isinstance�scheme�unicode�repr�host�path�assertEqual�type�query�fragment)�self�u�seg�_k�vs     �9/usr/lib/python3/dist-packages/hyperlink/test/test_url.py�assertUnicodedzTestURL.assertUnicoded�s��	
����q�x�x��)�=�Q�X�X��-=�t�A�w�	
�	
���
�1�6�6�7�3�E�q�v�v��~�t�A�w�O��6�6�	:�C����T�#�Y���a��9�	:��w�w�	J�G�R�����T�#�Y���a��9��O�O�A��I�?��A�w�)?��a��I�	J�	
����a�j�j�)�7�D��G�<�c	��|j|j|j|j|j|j
|jf}	||t|�t|�|||jf}
|j|	|
�y)a�
        The given L{URL} should have the given components.

        @param u: The actual L{URL} to examine.

        @param scheme: The expected scheme.

        @param host: The expected host.

        @param path: The expected path.

        @param query: The expected query.

        @param fragment: The expected fragment.

        @param port: The expected port.

        @param userinfo: The expected userinfo.
        N)	r%r(r)r,r-�port�userinfo�tupler*)r.r/r%r(r)r,r-r7r8�actual�expecteds           r3�	assertURLzTestURL.assertURL�sy��@
�H�H�
�F�F�
�F�F�
�G�G�
�J�J�
�F�F�
�J�J�
��
���$�K��%�L���
�J�J�
��	
�����*r5c	����fd�}|tdd��|tddgg��|tddggd��y)z@
        L{URL} should have appropriate default values.
        c
�X���j|��j|ddggddd�y)N�httpr�P)r4r<)r/r.s �r3�checkz(TestURL.test_initDefaults.<locals>.check�s+�������"��N�N�1�f�b�"�b�"�b�"�=r5r?rN)r
)r.rAs` r3�test_initDefaultszTestURL.test_initDefaults�s@���	>�
	�c�&�"�o��
�c�&�"�b�"�%�&�
�c�&�"�b�"�b�)�*r5c	���tdddgddgd�}|j|�|j|dddgddgdd�|jtdd	d
gdgd�dd	d
gdgdd
�y)z=
        L{URL} should accept L{unicode} parameters.
        �s�h�p��kr2)rHN�fNr?�à�é)uλuπu⊥r@�r
r4r<�r.r/s  r3�	test_initzTestURL.test_init�s���

��S�3�%�*�k�!:�C�@�����A�����q�#�s�S�E�J��+D�c�4�P���������+?�*@�(�K���
�H�
!�"���	
r5c	�~�tdddgddgd�}|j|�|j|dddgddgdd�y)zN
        L{URL} should accept (and not interpret) percent characters.
        rDz%68z%70)�%6Bz%76)rPNz%66NrLrMs  r3�test_initPercentzTestURL.test_initPercent�sM��

��U�U�G�n�m�%D�e�L�����A�����
�s�E�E�7�^�]�$C�U�D�	
r5c�v�|jttdddgddgd���dtd	��d
��y)z�
        L{URL.__repr__} will display the canonical form of the URL, wrapped in
        a L{URL.from_text} invocation, so that it is C{eval}-able but still
        easy to read.
        r?�foo�bar)�bazNrG�frob�r%r(r)r,r-zURL.from_text(zhttp://foo/bar?baz&k=v#frob�)N)r*r'r
�r.s r3�	test_reprzTestURL.test_reprsF��	
�����!����(�*�5�#��
�$(�(E�#F�H�	
r5c�~�tjt�}|jt|j	��y)zc
        Round-tripping L{URL.from_text} with C{str} results in an equivalent
        URL.
        N)r
�	from_text�	BASIC_URLr*�to_text�r.�urlpaths  r3�test_from_textzTestURL.test_from_texts)���-�-�	�*������G�O�O�$5�6r5c��tD]9}tj|�jd��}|j	||��;y)z@
        L{URL.to_text} should invert L{URL.from_text}.
        T��
with_passwordN)�ROUNDTRIP_TESTSr
r\r^r*)r.�test�results   r3�test_roundtripzTestURL.test_roundtrip%s?��
$�	+�D��]�]�4�(�0�0�t�0�D�F����T�6�*�	+r5c���tD]i}tj|�}|j�}|j�}||k(sJ�|j	d��}|j	d��}||k(r�iJ�y)NTrc)rer
r\�to_irir^)r.rf�url�iri�
double_iri�iri_text�double_iri_texts       r3�test_roundtrip_double_iriz!TestURL.test_roundtrip_double_iri.sy��#�	/�D��-�-��%�C��*�*�,�C�����J��*�$�$�$��{�{��{�6�H�(�0�0�t�0�D�O���.�.�.�	/�	r5c���tjt�}|j|tjt��|j	|tjd��y)z�
        Two URLs decoded using L{URL.from_text} will be equal (C{==}) if they
        decoded same URL string, and unequal (C{!=}) if they decoded different
        strings.
        z:ftp://www.anotherinvaliddomain.com/foo/bar/baz/?zot=21&zutN)r
r\r]r*�assertNotEqualr_s  r3�
test_equalityzTestURL.test_equality;sK���-�-�	�*������#�-�-�	�":�;������M�M�O�
�	
r5c��|jtd��t��|jtjd�tjd��y)z�
        An URL created with the empty string for a fragment compares equal
        to an URL created with an unspecified fragment.
        r)r-zhttp://localhost/#rN)r*r
r\rYs r3�test_fragmentEqualityzTestURL.test_fragmentEqualityKsC��	
����b�)�3�5�1�����M�M�.�/��M�M�-�.�	
r5c��tjt�}|jd|j	d�j��|jd|j	d�j��|jd|j	d�j��|jd|j	d�j��y	)
zm
        L{URL.child} appends a new path segment, but does not affect the query
        or fragment.
        z.http://www.foo.com/a/nice/path/gong?zot=23&zut�gongz1http://www.foo.com/a/nice/path/gong%2F?zot=23&zutzgong/z7http://www.foo.com/a/nice/path/gong%2Fdouble?zot=23&zutzgong/doublez:http://www.foo.com/a/nice/path/gong%2Fdouble%2F?zot=23&zutzgong/double/N)r
r\r]r*�childr^r_s  r3�
test_childzTestURL.test_childWs����-�-�	�*�����<��M�M�&�!�)�)�+�	
�	
���?��M�M�'�"�*�*�,�	
�	
���E��M�M�-�(�0�0�2�	
�	
���H��M�M�.�)�1�1�3�	
r5c��tjd�}|j|jddd�j	�d�y)zg
        L{URL.child} receives multiple segments as C{*args} and appends each in
        turn.
        zhttp://example.com/a/b�c�d�ezhttp://example.com/a/b/c/d/eN)r
r\r*rxr^�r.rks  r3�test_multiChildzTestURL.test_multiChildos=���m�m�4�5������I�I�c�3��$�,�,�.�0N�	
r5c��td��jd�}|j|j�|j	d|j��y)zo
        L{URL.child} of a L{URL} without a path produces a L{URL} with a single
        path segment.
        �www.foo.com�r(r{zhttp://www.foo.com/cN)r
rxr#�rootedr*r^)r.�childURLs  r3�test_childInitRootzTestURL.test_childInitRootzsC���M�*�0�0��5��������(����/��1A�1A�1C�Dr5c�\�td��}|j|j�|�y)zT
        L{URL.child} without any new segments returns the original L{URL}.
        r�r�N)r
r*rxr~s  r3�test_emptyChildzTestURL.test_emptyChild�s$��
�}�%���������c�*r5c� �tjt�}|jd|j	d�j��d}tj|�}|jd|j	d�j��y)z
        L{URL.sibling} of a L{URL} replaces the last path segment, but does not
        affect the query or fragment.
        z0http://www.foo.com/a/nice/path/sister?zot=23&zut�sisterz)http://www.foo.com/a/nice/path?zot=23&zutz+http://www.foo.com/a/nice/sister?zot=23&zutN)r
r\r]r*�siblingr^)r.r`�url_texts   r3�test_siblingzTestURL.test_sibling�ss���-�-�	�*�����>��O�O�H�%�-�-�/�	
�
?���-�-��)�����9��O�O�H�%�-�-�/�	
r5c��tjt�}|jd|j	d�j��|jd|j	d�j��|jd|j	d�j��|jd|j	d�j��|j
d	|j	d
�j�v�tjd�}|jd|j	d
�j��tjd�}|j|j	d�j�d�tjd�}d}|j|j	d�j�|�|j|j	�j�|�tjd�}tjd�}|j	|�}|j|j�d�y)z�
        L{URL.click} interprets the given string as a relative URI-reference
        and returns a new L{URL} interpreting C{self} as the base absolute URI.
        rrz$http://www.foo.com/a/nice/path/click�clickzhttp://www.foo.com/clickz/clickz$http://www.foo.com/a/nice/path/?burpz?burpz//foobarzhttp://www.foo.com/foobarzhttp://www.foo.com/me/noqueryz!http://www.foo.com/me/17?spam=158z/me/17?spam=158zhttp://localhost/foo?abc=defzhttp://www.python.orgz$http://hatnote.com/a/b/../c/./d/e/..zhttp://hatnote.com/a/c/d/zhttp://localhost/foo/?abc=defrTzhttp://localhost/foo/barN)r
r\r]r*r�r^r#�fromText)r.r`r/�res�u2�u3s      r3�
test_clickzTestURL.test_click�s����-�-�	�*�����8��M�M�"��%�%�'�	
�
	
���2��M�M�'�"�*�*�,�	
�
	
���&��
�
�h�(?�(G�(G�(I�	
�	
���2��M�M�'�"�*�*�,�	
�	
�����=�=�!<�=�E�E�G�
H�	
�
�M�M�9�:�����/�
�G�G�%�&�.�.�0�	
�
�M�M�8�9�����
�G�G�+�,�4�4�6�8O�	
�

�M�M�@�A��)����������,�,�.��4�	
�������*�*�,�c�2�
�L�L�8�9��
�]�]�5�
!��
�W�W�R�[���������'A�Br5c��tjt�}tD]4\}}|j	|j|�j
�|��6y)zQ
        L{URL.click} should correctly resolve the examples in RFC 3986.
        N)r
r\�relativeLinkBaseForRFC3986�relativeLinkTestsForRFC3986r*r�r^)r.�base�refr;s    r3�test_clickRFC3986zTestURL.test_clickRFC3986�sI��
�}�}�7�8��:�	B�O�S�(����T�Z�Z��_�4�4�6��A�	Br5c��tjt�}|jt|j
d�|jt|j
d�y)zM
        L{URL.click} should not accept schemes with relative paths.
        zg:hzhttp:hN)r
r\r��assertRaises�NotImplementedErrorr�)r.r�s  r3�test_clickSchemeRelPathzTestURL.test_clickSchemeRelPath�sA��
�}�}�7�8�����-�t�z�z�5�A����-�t�z�z�8�Dr5c
�2�tjd�}|j|j|j|j
|j|j|j|j�|�|j|j�|�y)zf
        Verify that L{URL.replace} doesn't change any of the arguments it
        is passed.
        zhttps://x:1/y?z=1#AN)
r
r\r*�replacer%r(r)r,r-r7r_s  r3�test_cloneUnchangedzTestURL.test_cloneUnchanged�sw���-�-� 5�6������O�O�����������
�
�� � ����

�
�
	
�	
������*�G�4r5c�.�gd�gd�gd�gd�gd�gd�gd�gd�gd	�gd
�gd�gd�gd
�g
}|D]g\}}}tj|�j|�j�}|j	||dj|t
|�||����iy)zd
        L{URL.click} collapses C{.} and C{..} according to RFC 3986 section
        5.2.4.
        )rrr)rrr)�http://localhost/a/b/crzhttp://localhost/a/b/)r�rzhttp://localhost/a/)r�z./d/ezhttp://localhost/a/b/d/e)r��../d/e�http://localhost/a/d/e)r�z/./d/e�http://localhost/d/e)r�z/../d/er�)zhttp://localhost/a/b/c/z
../../d/e/zhttp://localhost/a/d/e/)zhttp://localhost/a/./cr�r�)zhttp://localhost/a/./c/r�r�)zhttp://localhost/a/b/c/dz
./e/../f/../gzhttp://localhost/a/b/c/g)r�zd//ezhttp://localhost/a/b/d//ez1{start}.click({click}) => {actual} not {expected})�startr�r:r;N)r
r\r�r^r*�formatr')r.�testsr�r�r;r:s      r3�test_clickCollapsezTestURL.test_clickCollapses���
<�<�D�C�K�J�H�I�
�

I�K�
�

L�+
��.',�	�"�E�5�(��]�]�5�)�/�/��6�>�>�@�F������C�J�J���u�+�!�%�	K��	
�	r5c�j�|jdtjd�jdd�j	��|jdtd��jdd�j	��tjt
�}|jd|jd	�j	��|jd
|jd	d�j	��|jd|jd	d�jd
�j	��|jd|jd
�jd	d�j	��|jd|jd	d�jdd�j	��y)z3
        L{URL.add} adds query parameters.
        z'http://www.foo.com/a/nice/path/?foo=barzhttp://www.foo.com/a/nice/path/rSrTzhttp://www.foo.com/?foo=barr�r�z/http://www.foo.com/a/nice/path/?zot=23&zut&burp�burpz3http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxx�xxxz8http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxx&zing�zingz8http://www.foo.com/a/nice/path/?zot=23&zut&zing&burp=xxxz:http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxx&zot=32�zot�32N)r*r
r\�addr^r]r_s  r3�
test_queryAddzTestURL.test_queryAdd-sg��
	
���5��M�M�;�<�
�S���
�
�W�Y�		
�	
���)��]�#�'�'��u�5�=�=�?�	
��-�-�	�*�����=��K�K���'�'�)�	
�	
���A��K�K���&�.�.�0�	
�	
���F��K�K���&�*�*�6�2�:�:�<�	
�
	
���F��K�K���#�#�F�E�2�:�:�<�	
�
	
���H��K�K���&�*�*�5�$�7�?�?�A�	
r5c��tjt�}|jd|j	dd�j��|jd|j	d�j	dd�j��|jd|j
dd�j	dd�j��y)	z?
        L{URL.set} replaces query parameters by name.
        z*http://www.foo.com/a/nice/path/?zot=32&zutr�r�z0http://www.foo.com/a/nice/path/?zot&zut=itworked�zut�itworkedr�N)r
r\r]r*�setr^r�r_s  r3�
test_querySetzTestURL.test_querySetTs���
�-�-�	�*�����8��K�K��t�$�,�,�.�	
�
	
���>��K�K���"�"�5�*�5�=�=�?�	
�	
���8��K�K��u�%�)�)�%��6�>�>�@�	
r5c���tjd�}|j|jd�tjd��|j|jdd��tjd��|j|jdd��tjd��|j|jddd	�
�tjd��y)zG
        L{URL.remove} removes instances of a query parameter.
        z*https://example.com/a/b/?foo=1&bar=2&foo=3rSzhttps://example.com/a/b/?bar=2�1)�name�valuez$https://example.com/a/b/?bar=2&foo=3r
)r��limitr)r�r�r�N)r
r\r*�remover~s  r3�test_queryRemovezTestURL.test_queryRemovejs���
�m�m�H�I������J�J�u��s�}�}�-M�N�	
�	
����J�J�E��J�-��M�M�@�A�	
�
	
����J�J�E��J�+��M�M�@�A�	
�
	
����J�J�E��A�J�6��M�M�F�G�	
r5c�B�tjd�}|j|jd�dg�|j|j	�d�tjd�}|j|j
d�|j|j	�d�tjd�}|j
�}|j|jd�dg�|j|j�jd�dg�y	)
z�
        Every C{=}-sign after the first in a query parameter is simply included
        in the value of the parameter.
        zhttp://localhost/?=x=x=xr�x=x=xz!http://localhost/?foo=x=x=x&bar=y))rSr�)rT�yz7https://example.com/?argument=3&argument=4&operator=%3D�operator�=N)r
r\r*�getr^r,rj�to_uri)r.r/rls   r3�test_parseEqualSignInParamValuez'TestURL.test_parseEqualSignInParamValue�s���
�M�M�4�5��������r��W�I�.��������&@�A��M�M�=�>��������"B�C��������&I�J��M�M�E�
���h�h�j���������,�s�e�4��������)�)�*�5��u�=r5c�T�|jt�j�d�y)zG
        An empty L{URL} should serialize as the empty string.
        rN)r*r
r^rYs r3�
test_emptyzTestURL.test_empty�s��
	
��������"�-r5c�^�tdg��}|j|j�d�y)zP
        An L{URL} with query text should serialize as just query text.
        ��hello�world�r,z?hello=worldN)r
r*r^rMs  r3�test_justQueryTextzTestURL.test_justQueryText�s(��

�)�*�+���������n�5r5c�R�tjd�}|j||�y)z2
        L{URL} compares equal to itself.
        rN�r
r\r*rMs  r3�test_identicalEqualzTestURL.test_identicalEqual�s#��

�M�M�-�.������A�r5c�|�tjd�}tjd�}|j||�y)zG
        URLs with equivalent components should compare equal.
        �%http://u@localhost:8080/p/a/t/h?q=p#fNr��r.�u1r�s   r3�test_similarEqualzTestURL.test_similarEqual�s2��
�]�]�B�
C��
�]�]�B�
C������R� r5c��tjd�}tjd�}|j||k(|�d|���|j||�y)z|
        L{URL}s that refer to different resources are both unequal (C{!=}) and
        also not equal (not C{==}).
        �http://localhost/a�http://localhost/b� != N)r
r\�assertFalserrr�s   r3�test_differentNotEqualzTestURL.test_differentNotEqual�sK���]�]�/�
0��
�]�]�/�
0������r���R�#8�9����B��#r5c���tjd�}|j|dk(d�|j|t�k(d�|j	|d�|j	|t��y)z=
        L{URL} is not equal (C{==}) to other types.
        r�*zURL must not equal a number.zURL must not equal an object.N)r
r\r��objectrrrMs  r3�test_otherTypesNotEqualzTestURL.test_otherTypesNotEqual�sa��

�M�M�-�.������b��"@�A�����f�h��(G�H����A�r�"����A�v�x�(r5c�^�tjd�}|j||k7d|z�y)zJ
        Identical L{URL}s are not unequal (C{!=}) to each other.
        r�z%r == itselfN�r
r\r�rMs  r3�test_identicalNotUnequalz TestURL.test_identicalNotUnequal�s,��

�M�M�A�B������a���!�!3�4r5c��tjd�}tjd�}|j||k7|�d|���y)zU
        Structurally similar L{URL}s are not unequal (C{!=}) to each other.
        r�� == Nr�r�s   r3�test_similarNotUnequalzTestURL.test_similarNotUnequal�s;��
�]�]�B�
C��
�]�]�B�
C������r���R�#8�9r5c��tjd�}tjd�}|j||k7|�d|���y)zS
        Structurally different L{URL}s are unequal (C{!=}) to each other.
        r�r�r�N)r
r\r#r�s   r3�test_differentUnequalzTestURL.test_differentUnequal�s9��
�]�]�/�
0��
�]�]�/�
0������b���B�"7�8r5c��tjd�}|j|dk7d�|j|t�k7d�y)z;
        L{URL} is unequal (C{!=}) to other types.
        rr�zURL must differ from a number.z"URL must be differ from an object.N)r
r\r#r�rMs  r3�test_otherTypesUnequalzTestURL.test_otherTypesUnequal�s;��

�M�M�-�.������R��!A�B�����V�X�
�'K�Lr5c�\�d}tj|�}|j�}|j|jd�|j|j
dd�|j|j
�|�d}|j
�}|j|||�d|���y)z�
        L{URL.asURI} produces an URI which converts any URI unicode encoding
        into pure US-ASCII and returns a new L{URL}.
        �http://é.com/é?á=í#úué.comrué�.http://xn--9ca.com/%C3%A9?%C3%A1=%C3%AD#%C3%BAr�N)r
r\�asURIr*r(r)r^)r.�unicodeyrl�uri�expectedURI�	actualURIs      r3�
test_asURIzTestURL.test_asURI�s���
B�	��m�m�H�%���i�i�k��������#L�M�����H�H�Q�K�M�	
�	
��������1�F���K�K�M�	�����{�)�[�$I�	
r5c�\�d}tj|�}|j�}|j|jd�|j|j
dd�|j|j
�|�d}|j
�}|j|||�d|���y)z�
        L{URL.asIRI} decodes any percent-encoded text in the URI, making it
        more suitable for reading by humans, and returns a new L{URL}.
        r�zxn--9ca.comrz%C3%A9uhttp://é.com/é?á=í#úr�N)r
r\�asIRIr*r(r)r^)r.�asciiishr�rl�expectedIRI�	actualIRIs      r3�
test_asIRIzTestURL.test_asIRIs���D���m�m�H�%���i�i�k��������=�1�������!��h�/���������1�
3�	��K�K�M�	�����{�)�[�$I�	
r5c��d}tj|�}|j�}d}|j�}|j	|||�d|���y)z�
        Bad UTF-8 in a path segment, query parameter, or fragment results in
        that portion of the URI remaining percent-encoded in the IRI.
        z http://xn--9ca.com/%00%FF/%C3%A9uhttp://é.com/%00%FF/ér�N)r
r\r�r^r*)r.�
urlWithBinaryr�rlr�r�s      r3�test_badUTF8AsIRIzTestURL.test_badUTF8AsIRI#sS��;�
��m�m�M�*���i�i�k��
2�	�
�K�K�M�	�����{�)�[�$I�	
r5c��d}tj|�}|j�}|j|j	�|�y)zT
        A L{URL} composed of non-ASCII text will result in non-ASCII text.
        r�N)r
r\r�r*r^)r.r�rl�alsoIRIs    r3�test_alreadyIRIAsIRIzTestURL.test_alreadyIRIAsIRI6s?��
B�	��m�m�H�%���)�)�+��������*�H�5r5c��d}tj|�}|j�j�}|j	||�y)zH
        A L{URL} composed of encoded text will remain encoded.
        r�N)r
r\r�r^r*)r.r�r�r�s    r3�test_alreadyURIAsURIzTestURL.test_alreadyURIAsURIFs<��
G���m�m�K�(���I�I�K�'�'�)�	�����K�0r5c���tjd�}|j|jd�d�|j|jd�d�|j|jd�|j|j
d�|j|j
�d�|j|jd�	�j
�d
�y)z{
        L{URL.from_text} will parse the C{userinfo} portion of the URI
        separately from the host and port.
        z<http://someuser:somepassword@example.com/some-segment@ignoreTz!someuser:somepassword@example.comFzsomeuser:@example.comzsomeuser:somepassword�someuserz0http://someuser:@example.com/some-segment@ignore�r8z/http://someuser@example.com/some-segment@ignoreN)r
r\r*�	authorityr8�userr^r�r~s  r3�
test_userinfozTestURL.test_userinfoPs����m�m�J�
��	
����M�M�$��!D�	
�	
������u�-�/F�G�������'>�?�������:�.�����K�K�M�M�	
�	
����K�K��K�,�4�4�6�=�	
r5c��tjd�}|j|jd�|j|j	�d�y)zJ
        L{URL.from_text} parses custom port numbers as integers.
        zhttp://www.example.com:8080/i�N)r
r\r*r7r^)r.�portURLs  r3�
test_portTextzTestURL.test_portTextgs?��
�-�-� >�?��������t�,�������*�,J�Kr5c�j�|jtjd�j�d�y)a
        Although L{URL} instances are mainly for dealing with HTTP, other
        schemes (such as C{mailto:}) should work as well.  For example,
        L{URL.from_text}/L{URL.to_text} round-trips cleanly for a C{mailto:}
        URL representing an email address.
        zmailto:user@example.comN)r*r
r\r^rYs r3�test_mailtozTestURL.test_mailtops+��	
����M�M�3�4�<�<�>�%�	
r5c��tjd�}|j|jd�|j|jd�|j|j
d�|j|j
�d�y)zj
        An HTTP URL without a hostname, but with a path, should also round-trip
        cleanly.
        zhttp:relative-pathr)z
relative-pathFN)r
r\r*r(r)�uses_netlocr^)r.�without_hosts  r3�test_httpWithoutHostzTestURL.test_httpWithoutHost}sp���}�}�%9�:������*�*�B�/�����*�*�,>�?�����1�1�5�9�����-�-�/�1E�Fr5c��d}tdg��}|j|j|�tddi��}|j|j|�y)z�
        When a L{URL} is created with a C{query} argument, the C{query}
        argument is converted into an N-tuple of 2-tuples, sensibly
        handling dictionaries.
        )��alpha�betarr�rrN)r
r*r,)r.r;rks   r3�test_queryIterablezTestURL.test_queryIterable�sN��(���*�+�,��������H�-���&�)�*��������H�-r5c�X�tddg��}|j|jd�y)zr
        When a L{URL} is created with a C{path} argument, the C{path} is
        converted into a tuple.
        r�r��r)r�N)r
r*r)r~s  r3�test_pathIterablezTestURL.test_pathIterable�s(�����)�*��������#5�6r5c	�
����Gd�dt��tturdnd}�fd��|f���fd�	}|d�|d�|d	�|d
d�|d�|d
d��jt�5}tt
t���g��ddd��|d��jt�5}tdt
t���fg��ddd��||dzd��jt�5}tt
t���dfg��ddd��||d��jt�5tt
tttf���g��ddd��jt�5tt
tttfd�g��ddd��jt�5tt
tttfd�g��ddd�tjd�}�jt�5}|jt
t����ddd��||d��jt�5}|jt
t����ddd��||d��jt�5}|jt
t����ddd��||d�y#1swY��|xYw#1swY��?xYw#1swY���xYw#1swY���xYw#1swY��~xYw#1swY��ExYw#1swY��xYw#1swY��xYw#1swY�zxYw)a�
        Passing an argument of the wrong type to any of the constructor
        arguments of L{URL} will raise a descriptive L{TypeError}.

        L{URL} typechecks very aggressively to ensure that its constitutent
        parts are all properly immutable and to prevent confusing errors when
        bad data crops up in a method call long after the code that called the
        constructor is off the stack.
        c��eZdZd�Zd�Zy)�1TestURL.test_invalidArguments.<locals>.Unexpectedc��y)N�wrong�rYs r3�__str__z9TestURL.test_invalidArguments.<locals>.Unexpected.__str__�s��r5c��y)N�<unexpected>rrYs r3�__repr__z:TestURL.test_invalidArguments.<locals>.Unexpected.__repr__�s��%r5N)�__name__�
__module__�__qualname__rr!rr5r3�
Unexpectedr�s��
�
&r5r%r&�strc�r���jt|j�dj||d��y)Nzexpected {0} for {1}, got {2}r )r*r&�	exceptionr�)�raised�expectationr�r.s   �r3�assertRaisedz3TestURL.test_invalidArguments.<locals>.assertRaised�s4�������F�$�$�%�/�6�6���~��
r5c����jt�5}tdi|��i��ddd��||�y#1swY�xYw)Nr)r��	TypeErrorr
)�paramr*r)r%r+r.s   ���r3rAz,TestURL.test_invalidArguments.<locals>.check�sH����"�"�9�-�
-���,�u�j�l�+�,�
-�
���e�4�
-�
-�s	�=�Ar%r(r-r��boolr8r7zint or NoneTyperNzpath segmentr�r�z or NoneTypezquery parameter valuer�zquery parameter name)rHr2�vv)rHzhttps://valid.example.com/zrelative URL)r��bytesr&r�r-r
r	rr�
ValueErrorr\rxr�r�)r.�defaultExpectationrAr)rkr%r+s`    @@r3�test_invalidArgumentszTestURL.test_invalidArguments�s����	&��	&�+0�3�,�Y�E��	�&8�	5�	�h��
�f�
�
�j��
�h���
�j��
�f�'�(�
�
�
�y�
)�	1�V��d�4���.�/�0�	1�	�V�/��@�
�
�
�y�
)�	<�V����T�:�<� 8�9�:�;�	<�	��&��7�9P�	
��
�
�y�
)�	=�V���T�:�<�0�'�:�;�<�	=�	�V�/�1G�H��
�
�y�
)�	?��t�E�$��*�-�z�|�<�=�>�	?��
�
�z�
*�	C��t�E�$��*�-�/?�@�A�B�	C��
�
�z�
*�	9��t�E�$��*�-�v�6�7�8�	9��m�m�8�9��
�
�
�y�
)�	0�V��I�I�d�4���.�/�	0��V�/��@�
�
�
�y�
)�	2�V��K�K��T�:�<�0�1�	2��V�/��@�
�
�
�y�
)�	0�V��I�I�d�4���.�/�	0��V�/��@�K	1�	1��
	<�	<��	=�	=��	?�	?��	C�	C��	9�	9��	0�	0��	2�	2��	0�	0�sl�8!L�#L �
#L-�.L:�")M�()M�%M!�%M-�%M9�L� L*�-L7�:M�M�M�!M*�-M6�9Nc���|jt�5}td��ddd�|jt	j
�dj
td���y#1swY�GxYw)z�
        Technically, L{str} (or L{unicode}, as appropriate) is iterable, but
        C{URL(path="foo")} resulting in C{URL.from_text("f/o/o")} is never what
        you want.
        rSrNz,expected iterable of text for path, not: {0})r�r-r
r*r&r(r�r')r.r)s  r3�!test_technicallyTextIsIterableButz)TestURL.test_technicallyTextIsIterableBut�s^���
�
�y�
)�	�V��U�O�	������ � �!�:�A�A�$�u�+�N�	
�	�	�s�
A)�)A2c��td��}|j|jd�|j|j�d�|jtjd�jd�|jtjd�jd�|jtjd�jd�tdd��}|j|jd�|j|j�d�td	��}|j|jd�|j|j�d
�td��}|j|jd�|j|j�d�td
��}|j|jd�|j|j�d�tjd�}|j|jd�tjd�}|j|jd�y)N�https�r%Tzhttps://zhttps:Fzhttps:/)r%r
z	git+httpszgit+https://�mailtozmailto:�ztpzztp:zztp://test.comzztp:test:com)r
r*r
r^r\r~s  r3�test_netloczTestURL.test_netlocs�����!��������$�/��������
�3�������x�0�<�<�e�D�������y�1�=�=�u�E�������z�2�>�>��E���e�4��������%�0���������1���%��������$�/���������7���"��������%�0��������	�2�����������$�/���������/��m�m�,�-��������$�/��m�m�N�+��������%�0r5c��d}tj|�}|jdk(sJ�|jdk(sJ�t|j
|jk7sJ�y)Nz5https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80/z'2001:0db8:85a3:0000:0000:8a2e:0370:7334r@)r
r\r(r7rr%)r.�trks   r3�test_ipv6_with_portzTestURL.test_ipv6_with_port$sS��C���m�m�A����x�x�D�D�D�D��x�x�2�~��~��s�z�z�*�c�h�h�6�6�6r5c�H�d}tj|�}|jdk(sJ�|jdk(sJ�|jdk(sJ�|j
dk(sJ�|jdk(sJ�d}tj|�}|jdk(sJ�|jdk(sJ�|jdk(sJ�|j
dk(sJ�d	}tj|�}|jdk(sJ�|jdk(sJ�|jd
k(sJ�|j
dk(sJ�y)Nz3https://user:pass@example.com/path/to/here?k=v#nicer8�	user:pass�example.com)r)�to�here�nicez1https://user:pass@127.0.0.1/path/to/here?k=v#nicez	127.0.0.1z-https://user:pass@[::1]/path/to/here?k=v#nicez::1)r
r\r%r8r(r)r-�r.�textrks   r3�
test_basiczTestURL.test_basic,s(��D���m�m�D�!���z�z�W�$�$�$��|�|�{�*�*�*��x�x�=�(�(�(��x�x�1�1�1�1��|�|�v�%�%�%�B���m�m�D�!���z�z�W�$�$�$��|�|�{�*�*�*��x�x�;�&�&�&��x�x�1�1�1�1�>���m�m�D�!���z�z�W�$�$�$��|�|�{�*�*�*��x�x�5� � � ��x�x�1�1�1�1r5c�N�|jttjd�y)Nz#

�r�rr
r\rYs r3�test_invalid_urlzTestURL.test_invalid_urlDs�����-�����@r5c�N�|jttjd�y)Nzhttp://abc:

/#rJrYs r3�test_invalid_authority_urlz"TestURL.test_invalid_authority_urlHs�����-����8K�Lr5c���gd�}|D]c}d|zdz}|jtjttj|�|jt
tj|��ey)N)z2001::0234:C1ab::A0:aabc:003Fz2001::1::3F�:z::::z::256.0.0.1zhttp://[�])r��socket�errorr�AF_INET6rr
r\)r.�invalid_ipv6_ips�ipr�s    r3�test_invalid_ipv6zTestURL.test_invalid_ipv6Ls]��
��#�	F�B�!�B���,�H����f�l�l�I�v����K����m�S�]�]�H�E�	Fr5c��|jttjd�|jttjd�y)Nzftp://portmouth:smashz+http://reader.googlewebsite.com:neverforget)r�rr
r\r2rYs r3�test_invalid_portzTestURL.test_invalid_portZs4�����-����8O�P������M�M�9�	
r5c��tjd�}|j|jd�|j|j	�d�|j|j�j	�d�tjd�}|j|jd�|j|j	�d�|j|j
�j	�d�y)Nuhttp://bücher.chu
bücher.chzhttp://xn--bcher-kva.chrzxn--bcher-kva.chuhttps://bücher.ch)r
r\r*r(r^r�rjr�s   r3�	test_idnazTestURL.test_idnacs���
�]�]�.�
/��������,�/��������':�;��������,�,�.�0I�J�
�]�]�5�
6��������"4�5��������'A�B��������,�,�.�0D�Er5c��tjd�}|j|jd�|j|j	�d�tjd�}|j|jd�|j|j	�d�tjd�}|j|jd�|j|j	�d�tjd�}|j|jd�|j|j	�d�tjd	�}|j|jd
�|j|j	�d	�tjd�}|j|jd�|j|j	�d�td
dd��}|j|j	�d�td
ddd��}|j|j	�d�tjd�}|jd��}|j|j	�d�d}tj|�}|jd��}|j|j	�d�|jd��}|j|j	�|�y)Nzmailto:mahmoud@hatnote.comr:zhttp://hatnote.comr?znewscheme:a:b:c�	newschemeznewerscheme://a/b/c�newerschemez%git+ftp://gitstub.biz/glyph/lefkowitzzgit+ftpz'what+mailto:freerealestate@enotuniq.orgzwhat+mailtor;)�xr��zT)r%r)r�z
ztp:/x/y/z)r^r�r_r)r%r)r�r
zgit+ftp:///x/y/z/zfile:///path/to/heckr9zmailto:/path/to/heckzunregisteredscheme:///a/b/cF)r
zunregisteredscheme:/a/b/c)r
r\r*r%r^r�)r.rk�url2r��
no_netloc_url�
netloc_urls      r3�test_netloc_slasheszTestURL.test_netloc_slashesos_���m�m�8�9��������X�.��������(D�E��m�m�0�1��������V�,��������(<�=��m�m�-�.��������[�1��������(9�:��m�m�1�2��������]�3��������(=�>��m�m�C�D��������Y�/��������(O�P��m�m�E�F��������]�3�����K�K�M�D�	
���_�T�B����������5���$���	
��	
�������(;�<��m�m�2�3���{�{�(�{�+���������)?�@�0���m�m�H�%�������6�
�����.�.�0�2M�N��[�[�T�[�2�
�����+�+�-�x�8�r5c���tdg��}|j|j�d�|jd��}|j|j�d�|j	||�y)z�
        On host-relative URLs, the C{rooted} flag can be updated to indicate
        that the path should no longer be treated as absolute.
        r�rT)r�z/helloN)r
r*r^r�rr)r.�a�bs   r3�test_rooted_to_relativezTestURL.test_rooted_to_relative�s\��
�g�Y����������g�.�
�I�I�T�I�"���������h�/����A�q�!r5c��tddgd��}|j|jd�tdgd��}|j|jd�|j||�tddgd��}tddg��}|j||�|j|jd�|j|jd�y	)
a	
        The C{rooted} flag can be updated in some cases, but it cannot be made
        to conflict with other facts surrounding the URL; for example, all URLs
        involving an authority (host) are inherently rooted because it is not
        syntactically possible to express otherwise; also, once an unrooted URL
        gains a path that starts with an empty string, that empty string is
        elided and it becomes rooted, because these cases are syntactically
        indistinguisable in real URL text.
        rrSF)r)r�TrT)r(r)r�)r(r)N)r
r*r�)r.�relative_path_rooted�relative_flag_rooted�attempt_unrooted_absolute�normal_absolutes     r3�test_autorootedzTestURL.test_autorooted�s��� #��U��E�B�����-�4�4�d�;�"����=�����-�4�4�d�;����-�/C�D�$'�U�%���$O�!��5��w�7�����2�O�D�����/�/��6����2�9�9�4�@r5c���tddd��}tdd��}tddd��}|j|jd�|j|jd�|j|jd�tjd�}|jt	|�t	|��|jt	|�t	|��|j|j�|j��|j||�|j||�|j||�|j||�|j||�y)	a�
        URLs which include a ``://`` netloc-separator for any reason are
        inherently rooted, regardless of the value or presence of the
        ``rooted`` constructor argument.

        They may include a netloc-separator because their constructor was
        directly invoked with an explicit host or port, or because they were
        parsed from a string which included the literal ``://`` separator.
        �udpi$F)r%r7r�)r%r7Tzudp://:4900N)r
r*r�r\r&�asText)r.�directly_constructed�directly_constructed_implict�directly_constructed_rooted�parseds     r3�!test_rooted_with_port_but_no_hostz)TestURL.test_rooted_with_port_but_no_host�s-�� #�%�d�5�I��'*�%�d�'C�$�&)��T�$�&O�#����-�4�4�d�;����5�<�<�d�C����4�;�;�T�B����}�-������1�2�C��K�@�����9�:�C��K�H����-�4�4�6��
�
��H����-�v�6����-�/K�L����-�/J�K����5�v�>����4�f�=r5c���|jt�5tt�ddd�|jt�5td�ddd�y#1swY�3xYw#1swYyxYw)N�HTTP_____more_like_imHoTTeP)r�r2r
r]rYs r3�test_wrong_constructorzTestURL.test_wrong_constructor�s_��
�
�
�z�
*�	��	�N�	��
�
�z�
*�	/��-�.�	/�	/�	�	��	/�	/�s�A�A$�A!�$A-c�:�tjd�}|jdk(sJ�|jd��}|j	�}|jd��dk(sJ�|jd��d	k(sJ�|j
�jd��d
k(sJ�y)Nzhttp://user:pass@example.comrAz
us%20her:passrTrczhttp://us her:pass@example.comFzhttp://us her:@example.comz http://us%20her:pass@example.com)r
r\r8r�rjr^r��r.rkrls   r3�test_encoded_userinfozTestURL.test_encoded_userinfo�s����m�m�:�;���|�|�{�*�*�*��k�k�?�k�3���j�j�l���K�K�d�K�+�/O�O�	
�O��{�{��{�/�3O�O�O�O��J�J�L� � �t� �4�1�
2�	
�
2r5c�v�i}tjd�}t|�t|�k(sJ�d||<tjd�}|jdd�}d||<t	|�dk(sJ�t|j
��dgk(sJ�tt��tt��k(sJ�y)Nz.http://blog.hatnote.com/ask?utm_source=geocityr
zhttp://blog.hatnote.com/ask�
utm_source�geocityr)r
r\�hashr��len�list�values)r.�url_map�url1r`s    r3�	test_hashzTestURL.test_hashs������}�}�M�N���D�z�T�$�Z�'�'�'����
��}�}�:�;���x�x��i�0�����
��7�|�q� � � ��G�N�N�$�%�!��,�,�,��C�E�{�d�3�5�k�)�)�)r5c�~�t�}t|�}t|�dkDsJ�d|vsJ�d|vsJ�d|vsJ�d|vsJ�y)N�r�rpr�r�)r
�dirr�)r.rkr�s   r3�test_dirzTestURL.test_dirsZ���e���#�h���3�x�"�}��}���$�$�$��s�"�"�"��c�!�!�!��c�!�!�!r5c��tjd�}|j�dk(sJ�|j�j�dk(sJ�y)Nu"http://example.com/a%20té%C3%A9stz&http://example.com/a%20t%C3%A9%C3%A9st)r
r�rpr�r~s  r3�test_twisted_compatzTestURL.test_twisted_compatsD���l�l�?�@���z�z�|�C�C�C�C��y�y�{�!�!�#�'O�O�O�Or5c��tjd�}|jdd�}|jdd�}|j	�dk(sJ�y)Nzhttp://example.com/?a=b&cr^r�z!http://example.com/?a=b&x=x&c&x=y)r
r\r�r�r^r~s  r3�test_set_orderingzTestURL.test_set_ordering%sH���m�m�7�8���g�g�c�3����g�g�c�3����{�{�}� C�C�C�Cr5c���tjd�}tj|j��}||k(sJ�tj|j�j��}||k(sJ�||k(sJ�tjd�}|j�}|j�dk(sJ�tj|j��j	�}||k(sJ�y)zSee issue #4z#urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoobz1first-segment/urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoobz'first-segment/urn:ietf:wg:oauth:2.0:oobN)r
r\r^rjr�)r.r�r�r��u4�u5�u6s       r3�test_schemeless_pathzTestURL.test_schemeless_path0s����]�]�@�
A��
�]�]�2�:�:�<�
(���R�x��x�
�]�]�2�9�9�;�.�.�0�
1���R�x��x��R�x��x��]�]�N�
O��
�Y�Y�[���z�z�|�H�H�H�H�
�]�]�2�:�:�<�
(�
/�
/�
1���R�x��xr5c�n�tjd�}|j�}|j�y)z4See issue #7, affecting only narrow builds (2.6-3.3)zhttps://xn--vi8hiv.wsN)r
r\rjr^rzs   r3�test_emoji_domainzTestURL.test_emoji_domainCs'���m�m�3�4���j�j�l�����
r5c���|jttdd��|jttd��|jttd��|jttd��y	)
zPer issue #6 and #8r?za/c)r%r()�?r)�#)�&rfr�N)r�r2r
rYs r3�test_delim_in_paramzTestURL.test_delim_in_paramKsZ��	
���*�c�&�u��E����*�c���7����*�c���7����*�c�-��Ar5c��tjd�}tjd�}||k(sJ�tjd�}tjd�}||k(sJ�tjd�}tjd�}||k(sJ�tjd�}tjd�}||k(sJ�y)Nzhttp://example.com/zhttp://example.com)r
r\r�s   r3�test_empty_paths_eqzTestURL.test_empty_paths_eqSs���
�]�]�0�
1��
�]�]�/�
0���R�x��x�
�]�]�/�
0��
�]�]�/�
0���R�x��x�
�]�]�/�
0��
�]�]�0�
1���R�x��x�
�]�]�0�
1��
�]�]�0�
1���R�x��xr5c���tjd�jdk(sJ�|jttjd�|jttjt��y)Nz#ok�oks
bytes://x.y.z)r
r\r-r�r-r�rYs r3�test_from_text_typezTestURL.test_from_text_typeisN���}�}�U�#�,�,��4�4�4����)�S�]�]�4D�E����)�S�]�]�F�H�=r5c�
�|jttjd�|jttjd�|jttjd�|jttjd�|jttjd�|jttjd�|jttjd�y)Nzhttp://[::1/zhttp://::1]/zhttp://[[::1]/zhttp://[::1]]/zhttp://127.0.0.1:zhttp://127.0.0.1:hizhttp://127.0.0.1::80rJrYs r3�test_from_text_bad_authorityz$TestURL.test_from_text_bad_authorityos���	
���-�����G����-�����G����-����8H�I����-����8H�I�	
���-����8K�L����-����8M�N����-����8N�Or5c�4�tjd�}|jd�gk(sJ�|jd�dgk(sJ�t|j�dk(sJ�|j�}|jdk(sJ�|jdk(sJ�|jdk(sJ�|jd�d	gk(sJ�|jd
k(sJ�|j�dk(sJ�|jddddd�
�}||k(sJ�tjd�}|j�}|j�dk(sJ�tjd�}|j�}|j�dk(sJ�td��jd��j�dk(sJ�td��j�j�dk(sJ�tdddgdgdd��}|jd��d k(sJ�|j�jd��d!k(sJ�y)"Nz0HTTP://Example.com/A%61/./../A%61?B%62=C%63#D%64�BbzB%62zC%63�r?rB)�Aa�Cc�Ddzhttp://example.com/Aa?Bb=Cc#DdFrWzhttp://example.iozhttp://example.io/z/a%2fb/cd%3f?k%3d=v%23#testz/a%2Fb/cd%3F?k%3D=v%23#test)rz%te%stsr)�percentsz/%te%stsz/%25te%25sts�ftpz%%%z%a%b)�%z%%r�z%:%)r%r)r,r-r8Trczftp://%:%@/%%%/%a%b?%=%%#%z0ftp://%25:%25@/%25%25%25/%25a%25b?%25=%25%25#%25)
r
r\r�r�r)�	normalizer%r(r-r^)	r.rk�norm_url�
noop_norm_url�
slashless_url�slashful_url�
delimited_url�norm_delimited_url�percenty_urls	         r3�test_normalizezTestURL.test_normalizesJ���m�m�N�O���w�w�t�}��"�"�"��w�w�v��6�(�*�*�*��3�8�8�}��!�!�!��=�=�?�����&�(�(�(��}�}�
�-�-�-��}�}��'�'�'��|�|�D�!�d�V�+�+�+�� � �D�(�(�(����!�%E�E�E�E��
�
��u�5���&�
�
���#�#�#��
�
�&9�:�
�$�.�.�0���#�#�%�)=�=�=�=��
�
�&C�D�
�*�4�4�6��!�)�)�+�/L�L�L�L�
�_�%�/�/��/�?�G�G�I��
�	
�
���(�2�2�4�<�<�>�.�P�P�P�������-���
��
� � �t� �4�+�
,�	
�
,�
�"�"�$�,�,�4�,�@�A�
B�	
�
Br5c�X�d}tj|�}t|�|k(sJ�t|�dk(sJ�tr7tt
|�t�sJ�tt|�t�sJ�ytt
|�t�sJ�tt|�t�sJ�y)Nu&http://example.com/á/y%20a%20y/?b=%25s*http://example.com/%C3%A1/y%20a%20y/?b=%25)r
r\r&r1�PY2r$r&rFs   r3�test_strzTestURL.test_str�s���8���m�m�D�!���s�|�t�#�#�#��S�z�J�J�J�J���c�#�h��.�.�.��g�c�l�G�4�4�4��c�#�h��0�0�0��e�C�j�%�0�0�0r5c�.�tjd�}|j�jdk(sJ�|j	�jdk(sJ�tjd�}|j�jdk(sJ�|j	�jdk(sJ�|j	�j�jdk(sJ�d}tj|�j	�j�jdk(sJ�y)	Nuhttp://abé.com/uabé.comzxn--ab-cja.comu(http://ドメイン.テスト.co.jp#testuドメイン.テスト.co.jpzxn--eckwd4c7c.xn--zckzah.co.jpzhttp://Example.comrB)r
r\rjr(r��get_decoded_url)r.rkrGs   r3�test_idna_cornerszTestURL.test_idna_corners�s����m�m�.�/���z�z�|� � �J�.�.�.��z�z�|� � �$4�4�4�4��m�m�F�G���z�z�|� � �$B�B�B�B��z�z�|� � �$D�D�D�D��z�z�|�+�+�-�2�2�6T�T�T�T�#���M�M�$��&�&�(�8�8�:�?�?�=�P�	
�Pr5N)r)Or"r#r$�__doc__r4r<rBrNrQrZrarhrprsruryrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	rrrrr4r6r<r?rHrKrMrVrXrZrcrgrmrurxr{r�r�r�r�r�r�r�r�r�r�r�r�r�rr5r3r!r!�s����=�6�1+�f
+�
�&	
�
�(7�+��
� 

�
�0	
�E�+�
�&<C�|B�E�5�((�T%
�N
�,
�2>�*.�6��!�	$�	)�5�:�9�M�
�4
�0
�&6� 1�
�.L�
�
G�.�7�SA�j
� 1�D7�2�0A�M�F�
�
F�9�v
"�A�.>�6/�

�*�$
"�P�D��&�B��,>�P� 7
�r1� 
r5r!)�
__future__r�sysrQ�typingrrrrrr	�commonrrr
r�_urlrr�version_infor�r+r&r]r�r�rer!rr5r3�<module>r�so��(�
�
�=�=�%�!�-�
���q��Q���
�r�(��
9�	�2��1��hA��HF
��F
r5

Zerion Mini Shell 1.0