403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/test/__pycache__/test_urllib.cpython-312.opt-1.pyc
�

���g@)����dZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlmZddlmZddlZ	ddlZddlZddlZddlmZddlZej6se
j8d	��d
�Zdad/d�Zd�Z d0d
�Z!Gd�de"�Z#Gd�de"�Z$Gd�de
jJ�Z&Gd�de
jJ�Z'Gd�de
jJ�Z(Gd�de
jJe#e$�Z)Gd�de
jJ�Z*Gd�de
jJ�Z+Gd�de
jJe#�Z,Gd �d!e
jJ�Z-Gd"�d#e
jJ�Z.Gd$�d%e
jJ�Z/Gd&�d'e
jJ�Z0Gd(�d)e
jJ�Z1Gd*�d+e#e
jJ�Z2Gd,�d-e
jJ�Z3e4d.k(re
jj�yy#e$rdZY���wxYw)1z;Regression tests for what was in Python 2's "urllib" module�N)�patch)�support)�	os_helper)�
socket_helper)�warnings_helper)�	b64encodeztest requires gethostname()c�|�tt|��ddj�}t|�dk(rd|z}d|zS)z!Escape char as RFC 2396 specifies�N�z0%s�%)�hex�ord�upper�len)�char�hex_reprs  �%C:\Python312\\Lib\test\test_urllib.py�	hexescapers?���3�t�9�~�a�b�!�'�'�)�H�
�8�}����8�#����>��c���|�!tjj|��}nts
t�}|ant}|�|j	|�S|j	||�S)z.urlopen(url [, data]) -> open file-like object)�proxies)�urllib�request�FancyURLopener�
_urlopener�open)�url�datar�openers    r�urlopenr *s[�������.�.�w�.�?��
��!���
����|��{�{�3����{�{�3��%�%rc��tjdtf�5tjj�cddd�S#1swYyxYw)Nz8FancyURLopener style of invoking requests is deprecated.)r�check_warnings�DeprecationWarningrrr�rrrr:s=��	�	'�	'�
G��
 �
!��~�~�,�,�.�
!�
!�
!�s�A�A
c�����G�fd�dtj��G��fd�dtjj��|�_�S)Nc�8��eZdZdZ�fd�Zd�Zdd�Zdd�Zd�Zy)	�fakehttp.<locals>.FakeSocketrc���|�_y�N)�buf)�selfr�FakeHTTPConnections  �r�sendallz$fakehttp.<locals>.FakeSocket.sendallEs���%)��"rc�0�|xjdz
c_|S)Nr)�io_refs)r+�args�kwdss   r�makefilez%fakehttp.<locals>.FakeSocket.makefileHs���L�L�A��L��KrNc�\�|jrytjj||�S�Nr)�closed�io�BytesIO�read)r+�amts  rr8z!fakehttp.<locals>.FakeSocket.readLs!���{�{���:�:�?�?�4��-�-rc�\�|jrytjj||�Sr4)r5r6r7�readline)r+�lengths  rr;z%fakehttp.<locals>.FakeSocket.readlineQs#���{�{���:�:�&�&�t�V�4�4rc��|xjdzc_|jdk(r tjj|�yy)Nrr)r/r6r7�close�r+s rr>z"fakehttp.<locals>.FakeSocket.closeVs3���L�L�A��L��|�|�q� ��
�
� � ��&�!rr))	�__name__�
__module__�__qualname__r/r-r2r8r;r>)r,s�r�
FakeSocketr'Bs!�����	*�	�	.�
	5�
	'rrCc�*��eZdZdZ�fd�ZW�rd�Zyy)�$fakehttp.<locals>.FakeHTTPConnectionNc�h���|j�|_|jt|�_yr))�fakedata�sock�type�fakesock)r+rCs �r�connectz,fakehttp.<locals>.FakeHTTPConnection.connect`s#���"�4�=�=�1�D�I�"&�)�)�D��J�rc��yr)r$r?s rr>z*fakehttp.<locals>.FakeHTTPConnection.closei���r)r@rArBr*rKr>)rC�
mock_closes��rr,rE[s�����	,��

�rr,)r6r7�http�client�HTTPConnectionrG)rGrNr,rCs `@@r�fakehttprRAs:���'�R�Z�Z�'�2�T�[�[�7�7�� #+����rc��eZdZdd�Zd�Zy)�
FakeHTTPMixinc��t||��}tjj|_|tj_y)N�rN)rRrOrPrQ�_connection_class)r+rGrN�fake_http_classs    rrRzFakeHTTPMixin.fakehttpqs,��"�8�
�C��!%���!;�!;���%4����"rc�B�|jtj_yr))rWrOrPrQr?s r�
unfakehttpzFakeHTTPMixin.unfakehttpvs��%)�%;�%;����"rN�F)r@rArBrRrZr$rrrTrTps��5�
<rrTc��eZdZd�Zd�Zy)�FakeFTPMixinc��Gd�dt�}tjj|_|tj_y)Nc�$�eZdZ		dd�Zd�Zd�Zy)�,FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapperNc��yr)r$)r+�user�passwd�host�port�dirs�timeout�
persistents        r�__init__z5FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.__init__}s��rc�.�tj�dfS)Nr)r6r7)r+�filerIs   r�retrfilez5FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.retrfile�s���z�z�|�Q��&rc��yr)r$r?s rr>z2FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.close�rMr)NT)r@rArBrirlr>r$rr�FakeFtpWrapperr`|s��HL� $�
�
'�
rrn)�objectrr�
ftpwrapper�_ftpwrapper_class)r+rns  r�fakeftpzFakeFTPMixin.fakeftp{s.��		�V�		�"(���!:�!:���$2����!rc�B�|jtj_yr))rqrrrpr?s r�	unfakeftpzFakeFTPMixin.unfakeftp�s��$(�$:�$:����!rN)r@rArBrrrtr$rrr]r]zs��
3�;rr]c�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�urlopen_FileTestsz�Test urlopen() opening a temporary file.

    Try to test as much functionality as possible so as to cut down on reliance
    on connecting to the Net for testing.

    c���td|jjzd�|_t	t
jd�}	|j|j�|j�t
j|_	tjj|j�|_
td|jz�|_y#|j�wxYw)Nztest_urllib: %s
�ascii�wb�file:%s)�bytes�	__class__r@�textrr�TESTFN�writer>�pathnamer�parse�quote�quoted_pathnamer �returned_obj)r+�fs  r�setUpzurlopen_FileTests.setUp�s����-����0G�0G�G�!�#��	���!�!�4�(��	�
�G�G�D�I�I��
�G�G�I�!�(�(��
�%�|�|�1�1�$�-�-�@���#�I��0D�0D�$D�E����
�G�G�I�s�C�C"c�~�|jj�tjtj
�y)zShut down the open objectN)r�r>�os�removerr~r?s r�tearDownzurlopen_FileTests.tearDown�s&�������!�
�	�	�)�"�"�#rc�d�dD]+}|jt|j|�d|z��-y)N)	r8r;�	readlines�filenor>�info�geturl�getcode�__iter__�/object returned by urlopen() lacks %s attribute)�
assertTrue�hasattrr��r+�attrs  r�test_interfacez urlopen_FileTests.test_interface�s6��G�D��O�O�G�D�$5�$5�t�<�J���
�Grc�l�|j|j|jj��yr))�assertEqualr}r�r8r?s r�	test_readzurlopen_FileTests.test_read�s%��������D�$5�$5�$:�$:�$<�=rc���|j|j|jj��|jd|jj�d�y)NrzKcalling readline() after exhausting the file did not return an empty string)r�r}r�r;r?s r�
test_readlinezurlopen_FileTests.test_readline�sK��������D�$5�$5�$>�$>�$@�A�����d�/�/�8�8�:�3�	4rc��|jj�}|jt|�dd�|j|d|jd�y)Nrz.readlines() returned the wrong number of linesrz"readlines() returned improper text)r�r�r�rr})r+�
lines_lists  r�test_readlinesz urlopen_FileTests.test_readlines�sM���&�&�0�0�2�
�����Z��!�I�	K�����A���	�	�=�	?rc���|jj�}|j|td�|j	tj|t|j��|jd�y)Nzfileno() did not return an intzTReading on the file descriptor returned by fileno() did not return the expected text)	r�r��assertIsInstance�intr�r�r8rr})r+�file_nums  r�test_filenozurlopen_FileTests.test_fileno�sW���$�$�+�+�-�����h��-M�N��������3�t�y�y�>�:�D�I�I�<�	=rc�8�|jj�yr))r�r>r?s r�
test_closezurlopen_FileTests.test_close�s��	
�����!rc��|j|jjtjj
�yr))r�r��headers�email�message�Messager?s r�test_headerszurlopen_FileTests.test_headers�s(�����d�/�/�7�7����9N�9N�Orc�d�|j|jj|j�yr))r�r�rr�r?s r�test_urlzurlopen_FileTests.test_url�s$������*�*�.�.��0D�0D�Erc�N�|j|jj�yr))�assertIsNoner��statusr?s r�test_statuszurlopen_FileTests.test_status�s�����$�+�+�2�2�3rc��|j|jj�tjj
�yr))r�r�r�r�r�r�r?s r�	test_infozurlopen_FileTests.test_info�s+�����d�/�/�4�4�6��
�
�8M�8M�Nrc�l�|j|jj�|j�yr))r�r�r�r�r?s r�test_geturlzurlopen_FileTests.test_geturl�s'������*�*�1�1�3�T�5I�5I�Jrc�V�|j|jj��yr))r�r�r�r?s r�test_getcodezurlopen_FileTests.test_getcode�s�����$�+�+�3�3�5�6rc�^�|jD]}|j||j�� yr))r�r�r})r+�lines  r�	test_iterzurlopen_FileTests.test_iter�s(���%�%�D����T�4�9�9�-�&rc�|�|jttjjd|j
z�y)Nz./)�assertRaises�
ValueErrorrrr r�r?s r�test_relativelocalfilez(urlopen_FileTests.test_relativelocalfile�s'�����*�V�^�^�%;�%;�D�4�=�=�<P�QrN)r@rArB�__doc__r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$rrrvrv�s]���F�$�
�>�4�?�=�"�
P�F�4�O�K�7�.�Rrrvc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�
ProxyTestsc���|jtj��|_t	t
j�D]0}d|j�vs�|jj|��2y)N�proxy)	�enterContextr�EnvironmentVarGuard�env�listr��environ�lower�unset)r+�ks  rr�zProxyTests.setUp�sN���$�$�Y�%B�%B�%D�E����b�j�j�!�A��!�'�'�)�#������q�!�"rc���|jjdd�tjj	�}|jd|d�|jjdd�|j
tjjd��|j
tjjd��|j
tjjd��y)N�NO_PROXY�	localhost�no�0localhost, anotherdomain.com, newdomain.com:1234�anotherdomain.com�anotherdomain.com:8888�newdomain.com:1234)r��setrr�getproxies_environmentr�r��proxy_bypass_environment�r+rs  r�+test_getproxies_environment_keep_no_proxiesz6ProxyTests.test_getproxies_environment_keep_no_proxies�s��������Z��-��.�.�7�7�9������g�d�m�4������Z�!S�T�������?�?�@S�T�U�������?�?�@X�Y�Z�������?�?�@T�U�Vrc��	|jjdd�tjj	�}|jd|d�|jjdd�tjj	�}|j
d|�|jjd�|jjd�y#|jjd�|jjd�wxYw)N�
HTTP_PROXY�http://somewhere:3128rO�REQUEST_METHOD�GET)r�r�rrr�r��assertNotInr�r�s  r�test_proxy_cgi_ignorez ProxyTests.test_proxy_cgi_ignores���		)��H�H�L�L��'>�?��n�n�;�;�=�G����4�g�f�o�F��H�H�L�L�)�5�1��n�n�;�;�=�G����V�W�-��H�H�N�N�+�,��H�H�N�N�<�(��
�H�H�N�N�+�,��H�H�N�N�<�(�s�BC�8Dc���tjj}|jj	dd�|j|d��|j|d��|j|d��|j|d��|j|d��|j|d��|j|d	��|j|d
��|j|d��|j|d��|j|d
��|j
|d��|j
|d��|j
|d��y)Nr�z8localhost, anotherdomain.com, newdomain.com:1234, .d.o.tr��	LocalHost�	LOCALHOSTz
.localhostr�z.newdomain.com:1234z	foo.d.o.tzd.o.tr�z.anotherdomain.com:8888zwww.newdomain.com:1234�prelocalhost�
newdomain.comznewdomain.com:1235�rrr�r�r�r��assertFalse�r+�bypasss  r�(test_proxy_bypass_environment_host_matchz3ProxyTests.test_proxy_bypass_environment_host_matchs �����8�8�������Z�O�	Q�����{�+�,�����{�+�,�����{�+�,�����|�,�-�����3�4�5�����4�5�6�����{�+�,�����w��(�����7�8�9�����8�9�:�����7�8�9������/�0������0�1����� 4�5�6rc��tjj}|jj	dd�|j|d��|j|d��|jj	dd�|j|d��|j
|d��|j
|d��y)Nr��*r�r�z*, anotherdomain.comr�r�r�s  r�*test_proxy_bypass_environment_always_matchz5ProxyTests.test_proxy_bypass_environment_always_matchs������8�8�������Z��%������/�0�����3�4�5������Z�!7�8�����2�3�4������0�1����� 4�5�6rc��tjj}|jj	dd�|j|d��|j|d��|j|d��y)Nr�r�z
localhost
zanotherdomain.com:8888
znewdomain.com:1234
)rrr�r�r�r�r�s  r�%test_proxy_bypass_environment_newlinez0ProxyTests.test_proxy_bypass_environment_newline)sb�����8�8�������Z�G�	I�����
�.�/����� :�;�<����� 6�7�8rN)	r@rArBr�r�r�r�r�r�r$rrr�r��s!��"�	W�
)�7�&7�9rr�c��eZdZd�Zd�Zd�Zy)�ProxyTests_withOrderedEnvc�h�tj|_tj�t_yr))r�r��
_saved_env�collections�OrderedDictr?s rr�zProxyTests_withOrderedEnv.setUp4s���*�*��� �,�,�.��
rc�.�|jt_yr))r�r�r�r?s rr�z"ProxyTests_withOrderedEnv.tearDown:s
���_�_��
rc�~�dtjd<dtjd<|jtjjd��|jtjjd��dtjd<dtjd<tjj
�}|ji|�d	tjd<d
tjd<|jtjjd��|jtjjd��|jtjjd��|jtjjd
��|jtjjd��dtjd<dtjd<tjj
�}|jd|d�y)N��no_proxyr��No_Proxy�	arbitrary�
http_proxyr�r�z%localhost, noproxy.com, my.proxy:1234zxyz.comznoproxy.com:5678z
my.proxy:1234zmy.proxyzhttp://somewhereelse:3128�
Http_ProxyrO)	r�r�r�rrr�r�r�r�r�s  r�,test_getproxies_environment_prefer_lowercasezFProxyTests_withOrderedEnv.test_getproxies_environment_prefer_lowercase=s���!#��
�
�:��!,��
�
�:��������@�@��M�N�������@�@��M�N�#%��
�
�<� �#:��
�
�<� ��.�.�7�7�9������W�%�!H��
�
�:��!*��
�
�:��������?�?��L�M�������?�?�@R�S�T�������?�?��P�Q�������@�@��L�M�������@�@��M�N�#:��
�
�<� �#>��
�
�<� ��.�.�7�7�9�����0�'�&�/�BrN)r@rArBr�r�r�r$rrr�r�2s��/�%�Crr�c��eZdZdZd�Zd�Zd�Zeje	d�d��Z
eje	d�d��Zeje	d�d��Zeje	d�d	��Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zej4ej8dd�d��Zd�Zd�Zd�Z eje	d�d��Z!y)�urlopen_HttpTestsz.Test urlopen() opening a fake http connection.c��|jd|zdz�	td�}|j|j�d�|j|j�d�|j|j	�d�|j|j�d�|j
�y#|j
�wxYw)NsHTTP/s 200 OK

Hello!�http://python.org/�Hello!r���rRr r�r;r�r�rZ)r+�ver�fps   r�
check_readzurlopen_HttpTests.check_readYs����
�
�h��n�'?�?�@�	��-�.�B����R�[�[�]�I�6����R�[�[�]�C�0����R�Y�Y�[�*>�?����R�Z�Z�\�3�/��O�O���D�O�O��s�BB5�5Cc���d}|jd�	tjj|�}|j	|j�|�|j
�y#|j
�wxYw)Nz-http://docs.python.org/library/urllib.html#OK�HTTP/1.1 200 OK

Hello!)rRrrr r�r�rZ)r+rrs   r�test_url_fragmentz#urlopen_HttpTests.test_url_fragmentdsX��=���
�
�6�7�	����'�'��,�B����R�Y�Y�[�#�.��O�O���D�O�O��s�?A%�%A7c���|jd�	td�}|j|jj�|j�y#|j�wxYw)Nr
�http://www.python.org)rRr r�r�
will_closerZ)r+�resps  r�test_willclosez urlopen_HttpTests.test_willclosensJ���
�
�6�7�	��2�3�D��O�O�D�G�G�.�.�/��O�O���D�O�O��s�0A�A&zssl module requiredc���ttdd��dgzD�]}t|�}d|�d�}|jd�	t	|�jdd�}tjj}|j|d	|���5tjjd
|���ddd�|j|d	|���5tjjd|���ddd�td
|���}|j||j��|j���y#1swY��xYw#1swY�WxYw#|j�wxYw)Nr�!�z//localhost:7777/test�/�HTTP/1.1 200 OK

Hello.�\�\\�contain control.*�http:�https:)r��range�chrrR�repr�replacerOrP�
InvalidURL�assertRaisesRegexrrr r�r�rZ)r+�char_nor�schemeless_url�escaped_char_reprrrs       r�(test_url_path_with_control_char_rejectedz:urlopen_HttpTests.test_url_path_with_control_char_rejectedvsH���E�!�T�N�+�t�f�4�G��w�<�D�4�T�F�!�<�N��M�M�:�;�
"�%)��J�$6�$6�t�U�$C�!�!�[�[�3�3�
��+�+��"3�4E�3F� G�I��N�N�*�*�U�>�2B�+C�D�I��+�+��"3�4E�3F� G�I��N�N�*�*�V�N�3C�+D�E�I���~�&6�7�8��� � ��t�{�{�}�5����!�/5�I�I��I�I�����!�s=�A
E�#D8�.E�#E�.6E�8E	�=E�E
	�	E�E"c��|jd�d}d|zdz}	tjj}|j	|d�5t
jjd|���ddd�|j	|d�5t
jjd|���ddd�td|���}|jd	|j��|jd
|j��|jd|j��|j�y#1swY��xYw#1swY��xYw#|j�wxYw)Nrz:localhost:7777?a=1 HTTP/1.1
X-injected: header
TEST: 123�//�:8080/test/?test=az*contain control.*\\r.*(found at least . .)r�contain control.*\\nr� �
�
)rRrOrPrr rrr r�r�rZ)r+rdr"rrs     r�4test_url_path_with_newline_header_injection_rejectedzFurlopen_HttpTests.test_url_path_with_newline_header_injection_rejected�s%���
�
�6�7�O�����';�;��	����/�/�J��'�'��I�K����&�&��~�.>�'?�@�K��'�'�
�4K�L����&�&���/?�'@�A�M��U�>�"2�3�4�D����S�$�+�+�-�0����T�4�;�;�=�1����T�4�;�;�=�1��O�O��K�K��M�L��
�O�O��s<�,E�	#D0�,E�#D<�)A6E�0D9�5E�<E�E�Ec��ttdd��dgzD]�}t|�}d|�d�}|jd�	t	|�jdd�}tjj}|j|d	|���5td
|���ddd�|j|d	|���5td|���ddd�|j���y#1swY�HxYw#1swY�(xYw#|j�wxYw)Nrrrz//localhostz/test/rrrrrr)r�rrrRrrrOrPrr r rZ)r+r!rr"r#rs      r�(test_url_host_with_control_char_rejectedz:urlopen_HttpTests.test_url_host_with_control_char_rejected�s���E�!�T�N�+�t�f�4�G��w�<�D�*�4�&��7�N��M�M�:�;�	
"�$(��J�$6�$6�t�U�$C�!�!�[�[�3�3�
��+�+��"3�4E�3F� G�I��e�N�#3�4�5�I��+�+�J�:K�L]�K^�8_�`��f�^�$4�5�6�a����!�5�I�I��a�`�����!�s=�A
C8�
C �C8�6C,�C8� C)	�%C8�,C5	�1C8�8D
c��|jd�d}d|zdz}	tjj}|j	|d�5td|���ddd�|j	|d�5td|���ddd�|j
�y#1swY�CxYw#1swY�&xYw#|j
�wxYw)	Nrzlocalhost
X-injected: header
r&r'zcontain control.*\\rrr(r)rRrOrPrr r rZ)r+rdr"rs    r�4test_url_host_with_newline_header_injection_rejectedzFurlopen_HttpTests.test_url_host_with_newline_header_injection_rejected�s����
�
�6�7�4�����';�;��	����/�/�J��'�'��3�5��%��/�0�1�5��'�'�
�4K�L��&�� 0�1�2�M�
�O�O��
5�5��M�L��
�O�O��s;�,B2�	B�B2�2B&�B2�B#�B2�&B/�+B2�2Cc�&�|jd�y)Ns0.9�rr?s r�
test_read_0_9zurlopen_HttpTests.test_read_0_9�s��	
����rc�&�|jd�y)Ns1.0r2r?s r�
test_read_1_0zurlopen_HttpTests.test_read_1_0��������rc�&�|jd�y)Ns1.1r2r?s r�
test_read_1_1zurlopen_HttpTests.test_read_1_1�r6rc�d�|jdd��	|jtjj�5}tj
j
d�ddd�jj�|j�y#1swY�4xYw#|j�wxYw)Ns�HTTP/1.1 401 Authentication Required
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Connection: close
Content-Type: text/html; charset=iso-8859-1
TrVr)
rRr�r�error�	HTTPErrorrr �	exceptionr>rZ)r+�cms  r�test_read_bogusz!urlopen_HttpTests.test_read_bogus�s����
�
��
�	�	�	��"�"�6�<�<�#9�#9�:�b����&�&�';�<�;��L�L��� ��O�O��	;�:��
�O�O��s"�)B� B�"B�B�B�B/c�j�|jdd��	d}|jtjj|�5}tj
j
d�ddd�jj�|j�y#1swY�4xYw#|j�wxYw)Ns�HTTP/1.1 302 Found
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Location: file://guidocomputer.athome.com:/python/license
Connection: close
Content-Type: text/html; charset=iso-8859-1
TrVzRedirection to url 'file:r)
rRr rr:r;rr r<r>rZ)r+�msgr=s   r�test_invalid_redirectz'urlopen_HttpTests.test_invalid_redirect�s����
�
���
	�	�	�-�C��'�'����(>�(>��D�����&�&�';�<�E��L�L��� ��O�O��	E�D��
�O�O��s#�,B � B�!"B �B�B � B2c��tt�j�D]U}|jdd��	|j	t
jjtd�|j��Wy#|j�wxYw)Ns_HTTP/1.1 302 Found
Location: file://guidocomputer.athome.com:/python/license
Connection: close
TrV�http://something)
rr�maxtriesrRr�rr:r;r rZ)r+�is  r�test_redirect_limit_independentz1urlopen_HttpTests.test_redirect_limit_independent�su���~�'�0�0�1�A��M�M���
�
�
"��!�!�&�,�,�"8�"8�'�&�(����!�2�����!�s�/A7�7B	c��|jd�	|jttd�|j	�y#|j	�wxYw)NrrC)rRr��OSErrorr rZr?s r�test_empty_socketz#urlopen_HttpTests.test_empty_sockets=��	
�
�
�c��	����g�w�0B�C��O�O���D�O�O��s	�?�Ac�*�|jtjj�5}t	d�ddd�|jjj�|j|jj�y#1swY�TxYw)Nz/file://localhost/a/file/which/doesnot/exists.py)	r�rr:�URLErrorr r�r<�filename�reason�r+�es  r�test_missing_localfilez(urlopen_HttpTests.test_missing_localfile
s_��
�
�
�v�|�|�4�4�
5���E�F�6�������,�,�-�������*�*�+�6�
5���B	�	Bc���tj�\}}d|jtjj
d�z}	|j
tjj|��t|�5}|j
|�ddd�tj|�tj|�|jtjj|��|jtjj�5t|�ddd�y#1swY��xYw#tj|�tj|�wxYw#1swYyxYw)Nzfile://localhost/r)�tempfile�mkstemprr��path�sepr��existsr r>�unlinkr�r�rr:rK)r+�fd�tmp_file�tmp_fileurl�fobjs     r�test_file_notexistsz%urlopen_HttpTests.test_file_notexistss����'�'�)���H�)�H�,<�,<�R�W�W�[�[�#�,N�N��	 ��O�O�B�G�G�N�N�8�4�5���%������%�&�
�H�H�R�L��I�I�h�����������1�2�
�
�
�v�|�|�4�4�
5��K� �6�
5�
&�%��
�H�H�R�L��I�I�h���
5�
5�s0�9D;�?D/�D;�E*�/D8�4D;�;,E'�*E3c�.�d}|jtjj�5}t	|�ddd�|jjj�|j|jj�y#1swY�TxYw)Nzftp:///path�
r�rr:rKr r�r<rLr�rM)r+�test_ftp_urlrOs   r�test_ftp_nohostz!urlopen_HttpTests.test_ftp_nohost"se��$��
�
�
�v�|�|�4�4�
5���L�!�6�������-�-�.�������*�*�+�6�
5�s�B�Bc�*�|jtjj�5}t	d�ddd�|jjj�|j|jj�y#1swY�TxYw)Nz.ftp://localhost/a/file/which/doesnot/exists.pyr_rNs  r�test_ftp_nonexistingz&urlopen_HttpTests.test_ftp_nonexisting)sa��
�
�
�v�|�|�4�4�
5���D�E�6�������-�-�.�������*�*�+�6�
5�rQ�MAXFTPCACHErc��|j�	tjjddddg�tjjd<td�|j
�y#|j
�wxYw)Nrb�passr���testzftp://localhost)rrrrrp�ftpcacher rtr?s r�test_ftp_cache_pruningz(urlopen_HttpTests.test_ftp_cache_pruning/s]������	�.4�n�n�.G�.G��PV�Xc�eg�ik�.l�F�N�N�#�#�F�+��%�&��N�N���D�N�N��s�A	A,�,A>c��|jd�	td�}|j|j�d�|j|j�d�|j|j	�d�|j|j�d�|j
�y#|j
�wxYw)N�HTTP/1.0 200 OK

Hello!zhttp://user:pass@python.org/rrrr)r+rs  r�test_userpass_inurlz%urlopen_HttpTests.test_userpass_inurl8s����
�
�6�7�	��7�8�B����R�[�[�]�I�6����R�[�[�]�C�0����R�Y�Y�[�*H�I����R�Z�Z�\�3�/��O�O���D�O�O��s�BB/�/Cc��|jd�	d}dj|�}tjj}dt|j
d��jd�z}t|�}|j||jjd��|j|j�d�|j|j�d�|j|j�|�|j|j�d	�|j!�y#|j!�wxYw)
Nrlza b:c dzhttp://{}@python.org/zAuthorization: Basic %s
�ASCIIzUTF-8rrr)rR�formatrOrPrQr�encode�decoder �assertInr*r�r;�assertNotEqualr�r�rZ)r+�userpassr�fakehttp_wrapper�
authorizationrs      r�test_userpass_inurl_w_spacesz.urlopen_HttpTests.test_userpass_inurl_w_spacesCs����
�
�6�7�	� �H�)�0�0��:�C�#�{�{�9�9��:�&�x���w�'?�@�G�G��P�Q�M����B��M�M�-�)9�)=�)=�)D�)D�W�)M�N����R�[�[�]�I�6����R�[�[�]�C�0�����	�	��S�1����R�Z�Z�\�3�/��O�O���D�O�O��s�DD3�3Ec��tjdtf�5tjj�ddd�y#1swYyxYw�Nr�)rr"r#rr�	URLopenerr?s r�test_URLopener_deprecationz,urlopen_HttpTests.test_URLopener_deprecationVs3��
�
+�
+�R�0B�,C�
D��N�N�$�$�&�E�
D�
D�s�A�A
c�$�tj�}tjdtf�5|jt�5tjjdd|��ddd�ddd�y#1swY�xYw#1swYyxYw)Nr�zhttps://localhostz/nonexistent/path)�cafile�context)
�ssl�create_default_contextrr"r#r�r�rrr )r+rs  r�test_cafile_and_contextz)urlopen_HttpTests.test_cafile_and_contextZsp���,�,�.��
�
+�
+�R�1C�,D�
E��"�"�:�.����&�&�'�0C�W�'��/�F�
E�.�.��F�
E�s#�B�#A:�)B�:B	�?B�BN)"r@rArBr�rrr�unittest�
skipUnlessr�r$r,r.r0r3r5r8r>rArFrIrPr]rarcrrorrrjrmrxr|r�r$rrrrVs5��8�	����X����3�4�"�5�"�4�X����3�4��5��2�X����3�4�"�5�"� �X����3�4��5�� �
 � �
��""��,�!�,�,��U�\�\�&�.�.�-��3��4��	��&'��X����3�4��5�rrc�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�urlopen_DataTestsz"Test urlopen() opening a data URL.c�
�|jtjj�d|_d|_d|_d|_d|_|jtjj|j��|_|jtjj|j��|_|jtjj|j��|_
y)Nutest data URLs :;,%=& ö Ä sU�PNG


IHDR{@��sRGB���IDAT�c```���?�
o/IEND�B`�zZdata:text/plain;charset=UTF-8,test%20data%20URLs%20%3A%3B%2C%25%3D%26%20%C3%B6%20%C3%84%20zPdata:text/plain;charset=ISO-8859-1;base64,dGVzdCBkYXRhIFVSTHMgOjssJT0mIPYgxCA%3Dz�data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7
QOjdAAAAAXNSR0IArs4c6QAAAA9JREFUCNdj%0AYGBg%2BP//PwAGAQL%2BCm8 vHgAAAABJRU5ErkJggg%3D%3D%0A%20)�
addCleanuprr�
urlcleanupr}�image�text_url�text_url_base64�	image_urlr�r �
text_url_resp�text_url_base64_resp�image_url_respr?s rr�zurlopen_DataTests.setUpgs���������1�1�2�;��	�
F�	
�
�
(�	
�
�
�	
��
.�	
��
"�.�.��N�N�"�"�4�=�=�1�3���$(�$5�$5��N�N�"�"�4�#7�#7�8�%:��!�"�/�/����0F�0F�t�~�~�0V�W��rc�d�dD]+}|jt|j|�d|z��-y)N)r8r;r�r>r�r�r�r�r�)r�r�r�r�s  rr�z urlopen_DataTests.test_interface�s6��G�D��O�O�G�D�$6�$6��=�J���
�Grc�L�|j|jj�tjj
�|j
|jj�j�ddg�|j
|jj�dtt|j���tjjd�}|j
|j�j�ddg�|j!�y)N)z
text/plainr�)�charsetz
ISO-8859-1zcontent-lengthzdata:,)r�zUS-ASCII)r�r�r�r�r�r�r�r��
get_paramsr��strrr�rrr r>)r+�rs  rr�zurlopen_DataTests.test_info�s������d�0�0�5�5�7����9N�9N�O�����2�2�7�7�9�D�D�F�
�!:�;�	=�����,�,�1�1�3�4D�E���D�J�J�� �	"��N�N�"�"�8�,���������,�,�.�
�!8�9�	;�	���	rc�<�|j|jj�|j�|j|jj�|j
�|j|jj�|j�yr))r�r�r�r�r�r�r�r�r?s rr�zurlopen_DataTests.test_geturl�sp������+�+�2�2�4�d�m�m�D�����2�2�9�9�;�� � �	"�����,�,�3�3�5�t�~�~�Frc���|j|jj�jt	|jj�j
��d�|j�y�Nr�)r�r�r8rr�dictr�r�r}r?s r�test_read_textz urlopen_DataTests.test_read_text�sZ������+�+�0�0�2�9�9���#�#�(�(�*�5�5�7�8��C�E�FJ�i�i�	Qrc���|j|jj�jt	|jj�j
��d�|j�yr�)r�r�r8rrr�r�r�r}r?s r�test_read_text_base64z'urlopen_DataTests.test_read_text_base64�sY������2�2�7�7�9�@�@���*�*�/�/�1�<�<�>�?�	�J�L��I�I�	rc�l�|j|jj�|j�yr))r�r�r8r�r?s r�test_read_imagez!urlopen_DataTests.test_read_image�s%������,�,�1�1�3�T�Z�Z�@rc�b�|jttjjd�y)Nzdata:text/plain�r�r�rrr r?s r�test_missing_commaz$urlopen_DataTests.test_missing_comma�s�����*�V�^�^�%;�%;�<M�Nrc�b�|jttjjd�y)Nzdata:;base64,Cg=r�r?s r�test_invalid_base64_dataz*urlopen_DataTests.test_invalid_base64_data�s�����*�V�^�^�%;�%;�<N�OrN)
r@rArBr�r�r�r�r�r�r�r�r�r�r$rrr�r�ds9��,�X�@�	�G�Q��
A�O�Prr�c�T�eZdZdZd�Zd�Zd�Zdd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�urlretrieve_FileTestsz(Test urllib.urlretrieve() on local filesc��|jtjj�g|_|jtj�d|_	ttjd�}|j|j�|j�|j�y#YyxYw#j�w#YwxYwxYw)Nstesting urllib.urlretrievery)r�rrr��	tempFiles�registerFileForCleanUprr~r}rrr>)r+�FILEs  rr�zurlretrieve_FileTests.setUp�s���������1�1�2����	
�#�#�I�$4�$4�5�1��	�	��	�(�(�$�/�D��J�J�t�y�y�!��J�J�L�������D��������D�s1�AB5�B.�.B2�5C�6C�C�C�	Cc�^�|jD]}tj|��y#Y�xYwr))r�r�r�)r+�eachs  rr�zurlretrieve_FileTests.tearDown�s"���N�N�D����4��#���D�s�(�,c��tjj|�}dtjj|�zS)Nz	file://%s)r�rU�abspathrr�pathname2url)r+�filePaths  r�constructLocalFileUrlz+urlretrieve_FileTests.constructLocalFileUrl�s.���7�7�?�?�8�,���V�^�^�8�8��B�B�Brc�.�tj�\}}	|j|�tj|d�}|j|�|j
�|j
�|S#Y|SxYw#j
�w#YwxYwxYw)z�Creates a new temporary file containing the specified data,
        registers the file for deletion during the test fixture tear down, and
        returns the absolute path of the file.ry)rSrTr�r��fdopenrr>)r+r�newFd�newFilePath�newFiles     r�createNewTempFilez'urlretrieve_FileTests.createNewTempFile�s��
&�-�-�/���{�	��'�'��4��i�i��t�,�G��M�M�$���M�M�O��������
�D����������D�s0�AA;�!A3�3A8�;B�<B
�B�
B�Bc�:�|jj|�yr))r��append)r+�fileNames  rr�z,urlretrieve_FileTests.registerFileForCleanUp�s�������h�'rc��tjjdtjz�}|j|dtj�|j
|dtjjd�y)NrzrrzFdid not get an email.message.Message instance as second returned value)
rr�urlretrieverr~r�r�r�r�r�)r+�results  r�
test_basicz urlretrieve_FileTests.test_basic�sb�����+�+�I�	�8H�8H�,H�I��������I�$4�$4�5����f�Q�i����)>�)>�9�	:rc�F�dtjz}|j|�tjj|j
tj�|�}|j||d�|jtjj|�d�t|d�}	|j�}|j�|j�|j|j|�y#Y�!xYw#|j�w#YwxYwxYw)N�%s.2rzcopy of the file was not made�rb)rr~r�rrr�r�r�r�r�rUrWrr8r>r})r+�second_tempr�r�r}s     r�	test_copyzurlretrieve_FileTests.test_copy�s����y�/�/�/���#�#�K�0����+�+�D�,F�,F����-�*�,������f�Q�i�0���������{�3�69�	:��K��&��	��9�9�;�D��J�J�L�����������D�)��
�D��������D�s0�3 D�D�D�D �D�D �D�D c����dgf�fd�	}dtjz}�j|�tjj�j
tj�||�y)Nrc�����j|t��j|t��j|t��j||d�|ddz|d<y)Nrr)r�r�r�)�block_count�block_read_size�	file_size�count_holderr+s    �r�
hooktesterz9urlretrieve_FileTests.test_reporthook.<locals>.hooktester	sY����!�!�+�s�3��!�!�/�3�7��!�!�)�S�1����[�,�q�/�:�*�1�o��1�L��Orr�)rr~r�rrr�r�)r+r�r�s`  r�test_reporthookz%urlretrieve_FileTests.test_reporthooksX���NO�S�	2��y�/�/�/���#�#�K�0����"�"��&�&�y�'7�'7�8���	%rc��g}|fd�}|j�}tjj|j	|�t
j|�|jt|�d�|j|ddd�y)Nc�,�|j|||f�yr)�r��r�r�r��_reports    rr�zAurlretrieve_FileTests.test_reporthook_0_bytes.<locals>.hooktester����N�N�K��)�D�Errrr
�	r�rrr�r�rr~r�r�r+�reportr��srcFileNames    r�test_reporthook_0_bytesz-urlretrieve_FileTests.test_reporthook_0_bytesst����HN�	F��,�,�.�����"�"�4�#=�#=�k�#J����j�	*�����V��a�(�������1��q�)rc�F�g}|fd�}|jd�}tjj|j	|�t
j|�|jt|�d�|j|ddd�|j|ddd�y)Nc�,�|j|||f�yr)r�r�s    rr�zAurlretrieve_FileTests.test_reporthook_5_bytes.<locals>.hooktester%r�rsxxxxxr
r�rr�r�s    r�test_reporthook_5_bytesz-urlretrieve_FileTests.test_reporthook_5_bytes s�����HN�	F��,�,�X�6�����"�"�4�#=�#=�k�#J����j�	*�����V��a�(�������1��q�)�������1��q�)rc��g}|fd�}|jddz�}tjj|j	|�t
j|�|jt|�d�|j|ddd�|j|ddd�|j|ddd�|j|ddd�y)	Nc�,�|j|||f�yr)r�r�s    rr�zDurlretrieve_FileTests.test_reporthook_8193_bytes.<locals>.hooktester3r�r�xi �rr
ri r�r�s    r�test_reporthook_8193_bytesz0urlretrieve_FileTests.test_reporthook_8193_bytes.s�����HN�	F��,�,�T�D�[�9�����"�"�4�#=�#=�k�#J����j�	*�����V��a�(�������1��t�,�������1��t�,�������1��t�,�������1��t�,rN)r)r@rArBr�r�r�r�r�r�r�r�r�r�r�r�r$rrr�r��s=��2��0�C�� (�:�*�$%�	*�*�-rr�c��eZdZdZd�Zd�Zy)�urlretrieve_HttpTestsz5Test urllib.urlretrieve() using fake http connectionsc��|jtjj�|j	d�d�}|jtjj�5	tjjtj|��|j�	ddd�y#|j�wxYw#1swYyxYw)N��HTTP/1.1 200 OK
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Connection: close
Content-Length: 100
Content-Type: text/html; charset=iso-8859-1

FF
c��yr)r$)�par1�par2�par3s   r�_reporthookzYurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError.<locals>._reporthookOs��r)�
reporthook�r�rrr�rRr�r:�ContentTooShortErrorr�r�
TEST_HTTP_URLrZ)r+r�s  r�.test_short_content_raises_ContentTooShortErrorzDurlretrieve_HttpTests.test_short_content_raises_ContentTooShortErrorBs���������1�1�2��
�
��	�	��
�
�v�|�|�@�@�
A�
"����*�*�7�+@�+@�6A�+�C����!�B�
A��
���!��B�
A�s$�'C�)/B2�C�2C�C�Cc��|jtjj�|j	d�|jtjj�5	tjjtj�|j�	ddd�y#|j�wxYw#1swYyxYw)Nr�r�r?s r�Atest_short_content_raises_ContentTooShortError_without_reporthookzWurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError_without_reporthookYs���������1�1�2��
�
��	��
�
�v�|�|�@�@�
A�
"����*�*�7�+@�+@�A����!�	B�
A�����!��	B�
A�s$�$C�&-B-�C�-B?�?C�CN)r@rArBr�r�r�r$rrr�r�?s��?�"�."rr�c�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�QuotingTestsauTests for urllib.quote() and urllib.quote_plus()

    According to RFC 3986 (Uniform Resource Identifiers), to escape a
    character you write it as '%' + <2 character US-ASCII hex value>.
    The Python code of ``'%' + hex(ord(<character>))[2:]`` escapes a
    character properly. Case does not matter on the hex letters.

    The various character sets specified are:

    Reserved characters : ";/?:@&=+$,"
        Have special meaning in URIs and must be escaped if not being used for
        their special meaning
    Data characters : letters, digits, and "-_.!~*'()"
        Unreserved and do not need to be escaped; can be, though, if desired
    Control characters : 0x00 - 0x1F, 0x7F
        Have no use in URIs so must be escaped
    space : 0x20
        Must be escaped
    Delimiters : '<>#%"'
        Must be escaped
    Unwise : "{}|\^[]`"
        Must be escaped

    c�
�djgd��}tjj|�}|j	||d|�d|���tjj|�}|j	||d|�d|���y)Nr�)�ABCDEFGHIJKLMNOPQRSTUVWXYZ�abcdefghijklmnopqrstuvwxyz�
0123456789z_.-~�using quote(): � != �using quote_plus(): )�joinrr�r�r��
quote_plus)r+�do_not_quoter�s   r�test_never_quotezQuotingTests.test_never_quote�su���x�x�!)�*�����#�#�L�1������v�6B�F�K�	M����(�(��6������v�:F��O�	Qrc�r�|jtjjjdd�y)Nrr)r�rr�r��__defaults__r?s r�test_default_safezQuotingTests.test_default_safe�s'��������+�+�8�8��;�S�Arc���d}tjj||��}|j||d|�d|���tjj	||��}|j||d|�d|���tjj|d��}|j||d|�d|���tjjddd	�
�}tjjddd�
�}|j||d|�d|���tjjddd�
�}tjjddd�
�}|j||d|�d|���y)
Nz<>��safer�r�r�s<>uaüb�latin-1�ü)�encodingrr���)rr�r�r�r�)r+�quote_by_defaultr��expects    r�	test_safezQuotingTests.test_safe�s\�������#�#�$4�;K�#�L�����)�6�6F��O�	Q����(�(�)9�.>�)�@�����)�6�*�F�4�	5����#�#�$4�5�#�A�����)�6�6F��O�	Q����#�#�H�y�v�#�N�����#�#�H�y�r�#�J������� �&�*�	+����#�#�H�y�w�#�O�����#�#�H�y�r�#�J������� �&�*�	+rc���td�D�cgc]
}t|���}}|jd�|jtd��dj|�}|D]�}tj
j
|�}|jt|�|d|�dt|��d|���tj
j|�}|jt|�|d|�d	t|��d|�����~d
}d}tj
j
|�}|j||d|�d|���tj
j|�}|j||d|�d|���ycc}w)
N� z
<>#%"{}|\^[]`rr�r�z should be escaped to z, not r�z should be escapes to zab[]cdz
ab%5B%5Dcdr�)
rrr�r�rr�r�r�rr�)r+�num�should_quoterr��
partial_quote�expecteds       r�test_default_quotingz!QuotingTests.test_default_quoting�sE��-2�"�I�6�I�S��C��I��6����,�-����C��H�%��w�w�|�,�� �D��\�\�'�'��-�F����Y�t�_�f�#�I�d�O�V�=�
>��\�\�,�,�T�2�F����Y�t�_�f�#�I�d�O�V�=�
>�!�
� �
������#�#�M�2������6�6>��G�	I����(�(��7������6�;C�V�L�	N��-7s�E5c
�@�tjjd�}|j|t	d�d|�dt	d����tjjd�}|j|dd|z�d}|j
dt	d��}tjj|�}|j||d|�d|���|j
dd�}tjj|�}|j||d|�d|���y)Nr)r�r��+zusing quote_plus(): %r != +z
a b cd e fr�)rr�r�r�rr�r)r+r��givenrs    r�test_quoting_spacezQuotingTests.test_quoting_space�s������#�#�C�(�������3��6<�i��n�M�	O����(�(��-�������6��?�	A������s�I�c�N�3�����#�#�E�*�������6<�f�E�	G����s�C�(�����(�(��/�������;A�6�J�	Lrc��|jtjjd�d�|jtjjdd�d�|jtjjd�d�|jtjjdd�d�y)Nzalpha+beta gammazalpha%2Bbeta+gammarzalpha+beta+gammasalpha+beta gamma�+)r�rr�r�r?s r�test_quoting_pluszQuotingTests.test_quoting_plus�s���������0�0�1C�D�-�	/�������0�0�1C�S�I�+�	-�	
������0�0�1D�E�-�	/�	
������0�0�1C�T�J�+�	-rc�N�d}d}tjj|�}|j||d|�d|���|j	t
tjj|d��tjj
|�}|j||d|�d|���y)N���ab��%A2%D8ab%FFr�r�r�rzusing quote_from_bytes(): )rr�r�r�r��	TypeError�quote_from_bytes�r+rrr�s    r�test_quote_byteszQuotingTests.test_quote_bytes�s���!�������#�#�E�*�������6<�f�E�	G�	
���)�V�\�\�%7�%7��%.�	�	0����.�.�u�5�������"�F�,�	-rc�H�d}d}tjj|�}|j||d|�d|���tjj|dd��}|j||d|�d|���d}d}tjj|d��}|j||d|�d|���d	}d
}tjj|�}|j||d|�d|���d	}|j	t
tjj|d��d	}d}tjj|dd��}|j||d|�d|���d	}d
}tjj|dd��}|j||d|�d|���y)Nu¢Øabÿz%C2%A2%C3%98ab%C3%BFr�r��r�errorsrrr�漢字�%E6%BC%A2%E5%AD%97z%3F%3Frz%26%2328450%3B%26%2323383%3B�xmlcharrefreplace)rr�r�r�r��UnicodeEncodeErrorrs    r�test_quote_with_unicodez$QuotingTests.test_quote_with_unicode�s��� ��'�����#�#�E�*�������6<�f�E�	G����#�#�E�D��#�F�������6<�f�E�	G�!�������#�#�E�I�#�>�������6<�f�E�	G���%�����#�#�E�*�������6<�f�E�	G������,�f�l�l�.@�.@�%�-6�	�	8��������#�#�E�I�+4�$�6�������6<�f�E�	G���/�����#�#�E�I�+>�$�@�������6<�f�E�	Grc��d}d}tjj|d��}|j||d|�d|���d}d}tjj|dd	�
�}|j||d|�d|���y)Nu¢Ø ÿz
%A2%D8+%FFrrr�r�uab漢字 cdzab%3F%3F+cdrr!)rr�r�r�rs    r�test_quote_plus_with_unicodez)QuotingTests.test_quote_plus_with_unicode)s����������(�(���(�C�������;A�6�J�	L�$�������(�(���09�)�;�������;A�6�J�	LrN)
r@rArBr�r�r�r	rrrrr'r)r$rrr�r�ls;���2Q�B�+�:N�8L�&
-�-� (G�T
Lrr�c�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�UnquotingTestszwTests for unquote() and unquote_plus()

    See the doc string for quoting_Tests for details on quoting and such.

    c	��g}td�D]�}tt|��}t|�}tjj|�}|j
||d|�d|���tjj|�}|j
||d|�d|���|j|���dj|�}~tjj|�}|j
|jd�dd|z�y)	N��using unquote(): r��using unquote_plus(): r�rrz/using unquote(): not all characters escaped: %s)rrrrr��unquoter��unquote_plusr�r��count)r+�escape_listrrrr��
escape_strings       r�test_unquotingzUnquotingTests.test_unquoting@s�������:�C��c�#�h�'�E���X�F��\�\�)�)�%�0�F����V�V�<B�F�K�
M��\�\�.�.�u�5�F����V�V�$�f�.�
/�
���u�%������,�
�����%�%�m�4��������c�*�A�� &�'�	(rc���|jttftjj
d�|jttftjj
d�y)Nr$)r�r�AttributeErrorrr�r0r?s r�#test_unquote_rejects_none_and_tuplez2UnquotingTests.test_unquote_rejects_none_and_tupleUsD�����9�n�5�v�|�|�7K�7K�T�R����9�n�5�v�|�|�7K�7K�R�Prc���d}|}tjj|�}|j||d|�d|���d}|}tjj|�}|j||d|�d|���d}|}tjj|�}|j||d|�d|���d}t	|d�}tjj|�}|j||d|�d|���d}t	|d�}tjj|�}|j||d|�d|���d}t	|d�}tjj|�}|j||d|�d|���|j
ttftjj
d�|j
ttftjj
d�y)	Nz%xabr.r�z%xrrx�using unquote_to_bytes(): r$)	rr�r0r�r{�unquote_to_bytesr�rr7rs    r�test_unquoting_badpercentz(UnquotingTests.test_unquoting_badpercentYs����������%�%�e�,�������"�F�*,�	-��������%�%�e�,�������"�F�*,�	-��������%�%�e�,�������"�F�*,�	-����u�g�&�����.�.�u�5�������"�F�*,�	-����u�g�&�����.�.�u�5�������"�F�*,�	-����u�g�&�����.�.�u�5�������"�F�*,�	-����9�n�5�v�|�|�7T�7T�VZ�[����9�n�5�v�|�|�7T�7T�VX�Yrc�|�d}d}tjj|�}|j||d|�d|���y)Nz%Ab%eAs��r:r��rr�r;r�rs    r�test_unquoting_mixed_casez(UnquotingTests.test_unquoting_mixed_case}s<���������.�.�u�5�������"�F�,�	-rc��dtd�z}d}tjj|�}|j	||d|�d|���tjj|�}|j	||d|�d|���y)Nzab%sd�c�abcdr�r�r/)rrr�r0r�r1rs    r�test_unquoting_partsz#UnquotingTests.test_unquoting_parts�su���)�C�.�(�������%�%�e�,�������6<�f�E�	G����*�*�5�1�������=C�V�L�	Nrc��d}|}tjj|�}|j||d|�d|���|j	dd�}tjj|�}|j||d|�d|���y)Nzare+there+spaces...r.r�rr)r/)rr�r0r�rr1rs    r�test_unquoting_plusz"UnquotingTests.test_unquoting_plus�sz��%�������%�%�e�,�������8>��G�	I����s�C�(�����*�*�5�1�������=C�V�L�	Nrc���d}d}tjj|�}|j||d|�d|���tjjd�}d}|j||d|�d|���d}d}tjj|�}|j||d|�d|���d	}d}tjj|�}|j||d|�d|���y)
N�"br%C3%BCckner_sapporo_20050930.docsbrückner_sapporo_20050930.docr:r��	漢%C3%BCs漢üs%A2%D8ab%FFrs	%A2�ab%FFr>rs    r�test_unquote_to_bytesz$UnquotingTests.test_unquote_to_bytes�s���4��8�����.�.�u�5�������"�F�,�	-����.�.�~�>��(�������"�F�,�	-���"�����.�.�u�5�������"�F�,�	-�
 ��"�����.�.�u�5�������"�F�,�	-rc�6�d}d}tjj|�}|j||d|�d|���tjj|dd��}|j||d|�d|���tjjdd��}d}|j||d|�d|���d	}d
}tjj|�}|j||d|�d|���d}d}tjj|�}|j||d|�d|���tjj|d
��}|j||d|�d|���d}d}tjj|d��}|j||d|�d|���tjjd�}d}|j||d|�d|���tjjdd��}d}|j||d|�d|���y)NrGubrückner_sapporo_20050930.docr.r�r!zbr%FCckner_sapporo_20050930.docrrr$r#z%F3%B1u�r)r"r��ignorerHu漢üu漢%FC�rr�r0r�rs    r�test_unquote_with_unicodez(UnquotingTests.test_unquote_with_unicode�s��4��5�����%�%�e�,�������8>��G�	I����%�%�e�d�4�%�H�������8>��G�	I����%�%�&G�/8�&�:��5�������8>��G�	I�%�������%�%�e�,�������8>��G�	I��������%�%�e�,�������8>��G�	I����%�%�e�I�%�>�������8>��G�	I��������%�%�e�H�%�=�������8>��G�	I����%�%�n�5���������8>��G�	I�
���%�%�k�I�%�F���������8>��G�	Irc�l�d}d}tjj|�}|j||d|�d|���d}d}tjj|�}|j||d|�d|���d}d}tjj|�}|j||d|�d|���y)	Nsblueberryjam�blueberryjamr.r�sblåbærsyltetøyublåbærsyltetøysbl%c3%a5b%c3%a6rsyltet%c3%b8jublåbærsyltetøjrLrs    r�test_unquoting_with_bytes_inputz.UnquotingTests.test_unquoting_with_bytes_input�s����������%�%�e�,�������8>��G�	I�7��0�����%�%�e�,�������8>��G�	I�1��0�����%�%�e�,�������8>��G�	IrN)
r@rArBr�r5r8r<r?rCrErIrMrPr$rrr+r+9s<���(�*Q�"Z�H-�
N�
N�-�>8I�tIrr+c�X�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�urlencode_TestszTests for urlencode()c��gd�}tjj|�}|D]}|j||d|�d|�d|���� |j	|jd�dd|�d|jd����|j
d�}||dz
}||dz}|j|j�xr|j�d|�d	|���|j	t|�d
d|�dt|��dd
���y
)aHelper method for testing different input types.

        'given' must lead to only the pairs:
            * 1st, 1
            * 2nd, 2
            * 3rd, 3

        Test cannot assume anything about order.  Docs make no guarantee and
        have possible dictionary input.

        )z1st=1z2nd=2z3rd=3ztesting z: z not found in �&r
z: expected 2 '&'s; got rz%: '&' not located in proper place in �z#: unexpected number of characters: r�N)
rr��	urlencodersr�r2�indexr��isdigitr)	r+r�	test_type�expect_somewherer�r�amp_location�on_amp_left�on_amp_rights	         r�help_inputtypezurlencode_Tests.help_inputtypes���7�����'�'��.��(�H��M�M�(�F�#�X�v�7�
8�)�	
������c�*�A�#�V�\�\�#�%6�8�	9��|�|�C�(���\�A�-�.���l�Q�.�/������+�+�-�H�,�2F�2F�2H����)�	*�	
����V��k�$�S��[�+�?�	@rc�0�|jdddd�d�y)N�1�2�3)�1st�2nd�3rdzusing dict as input type�r^r?s r�test_using_mappingz"urlencode_Tests.test_using_mapping1s�����3�c��=�6�	8rc�,�|jgd�d�y)N))rcr`)rdra)rerbz*using sequence of two-item tuples as inputrfr?s r�test_using_sequencez#urlencode_Tests.test_using_sequence6s�����F�H�	Jrc��ddi}td��dtd���}tjj|�}|j	||�ddi}d}tjj|�}|j	||�y)NrT�=zkey namezA bunch of pluseszkey+name=A+bunch+of+pluses)rrr�rVr�rs    r�test_quotingzurlencode_Tests.test_quoting;su���S�	��%�c�N�I�c�N�;�����'�'��.�������(��/�0��-�����'�'��.�������(rc��dgd�i}dtjjtgd���z}tjj	|�}|j||�tjj	|d�}|dD]}d|z}|j
||��|j|jd�dd|jd�z�y)N�sequence)r`rarbzsequence=%sTrTr
zExpected 2 '&'s, got %s)rr�r�r�rVr�rsr2)r+rrr��values     r�
test_doseqzurlencode_Tests.test_doseqFs����O�,������!8�!8��_�9M�!N�N�����'�'��.�������(����'�'��t�4���:�&�E�"�U�*�F��M�M�&�&�)�'�	
������c�*�A�2�V�\�\�#�5F�F�	Hrc��|jdtjji��|jdtjjg��yrz�r�rr�rVr?s r�test_empty_sequencez#urlencode_Tests.test_empty_sequenceSs@������V�\�\�3�3�B�7�8�����V�\�\�3�3�B�7�8rc���|jdtjjddi��|jdtjjddi��y)Nza=1�arza=Nonerrr?s r�test_nonstring_valuesz%urlencode_Tests.test_nonstring_valuesWsH��������� 6� 6��Q�x� @�A�����6�<�<�#9�#9�3��+�#F�Grc�f�|jdtjjdddgid��|jdtjjdddgid��t	j
ddg�}|jd	tjjd|id��y)
Nza=1&a=2rurr
Tz
a=None&a=a)rur)�brza=a&a=b)r�rr�rVr�r�)r+rs  r�test_nonstring_seq_valuesz)urlencode_Tests.test_nonstring_seq_values[s�������F�L�L�$:�$:�C�!�Q��=�$�$O�P��������/�/��t�S�k�0B�D�I�	K��&�&��(�';�<���������/�/��d��T�B�	Drc�L�d}d}tjj|dd��}|j||�d}d}tjj|�}|j||�d}d}tjj|d�	�}|j||�y)
N�)� �Á�%3F=%3Frorr!�
%C2%A0=%C3%81�%A0=%C1rr�rr�rVr�rs    r�test_urlencode_encodingz'urlencode_Tests.test_urlencode_encodingcs���'�������'�'���	�'�R�������(�(�� �����'�'��.�������(�(�������'�'��	�'�B�������(rc��d}d}tjj|ddd��}|j||�d}d}tjj|ddd�	�}|j||�d}d
}tjj|d�}|j||�d}d}tjj|d�}|j||�d}d
}tjj|dd��}|j||�d}d}tjj|dd��}|j||�y)Nr{r~Tror)�doseqrr"))r|)rr}z
%3F=1&%3F=%3Fr!r))r|)�*r}z%C2%A0=42&%C2%A0=%C3%81r�rrz%A0=42&%A0=%C1r�rs    r�test_urlencode_encoding_doseqz-urlencode_Tests.test_urlencode_encoding_doseqvsL��'�������'�'��T�18��(�L�������(�-�� �����'�'��t�18��(�L�������(�(�� �����'�'��t�4�������(�-��*�����'�'��t�4�������(�(�������'�'��t�i�'�H�������(�-��!�����'�'��t�i�'�H�������(rc�>�d}d}tjj|�}|j||�tjj|d�}|j||�d}d}tjj|d�}|j||�y)N�)��$��$z
%A0%24=%C1%24T))r�)r�r�z%A0%24=42&%A0%24=%C1%24r�rs    r�test_urlencode_bytesz$urlencode_Tests.test_urlencode_bytes�s���-�� �����'�'��.�������(����'�'��t�4�������(�4��*�����'�'��t�4�������(rc��d}tjj|d��}d}|j||�d}tjj|dd��}d}|j||�d}d}tjj|dd��}|j||�d}tjj|dd	�
�}d}|j||�d}d}tjj|ddd	��}d}d}tjj|ddd	�
�}|j||�y)Nr�z:$rz	%A0$=%C1$T)r�r))r�)r��
r�z%A0$=%C1$&%A0$=13&%A0$=42r)rr)r�rrr�)r+rr�rs    r�&test_urlencode_encoding_safe_parameterz6urlencode_Tests.test_urlencode_encoding_safe_parameter�sI��
.�����'�'��D�'�9���������(�-�����'�'��T��'�E���������(�9��,�����'�'��t�$�'�?�������(�.�����'�'��D�1:�(�<���������(�-�������'�'��T��1:�(�<��9��,�����'�'��t�$�1:�(�<�������(rN)r@rArBr�r^rgrirlrprsrvryr�r�r�r�r$rrrRrRsH���@�@8�
J�
	)�H�9�H�D�)�&#)�J)�&)rrRc���eZdZdZd�Zd�Zejejdk(d�d��Z
ejejdk(d�d��Zeje
jd	�d
��Zejejdk(d�d��Zejejdk(d�d��Zeje
jd	�d
��Zy)�Pathname_Testsz&Test pathname2url() and url2pathname()c�,�tjjdddd�}d}tjj|�}|j
||d|�d|���tjj|�}|j
||d|�d|���y)	N�parts�ofrurUzparts/of/a/path�pathname2url() failed; r�zurl2pathame() failed; )r�rUr�rrr�r��url2pathname)r+�
expected_path�expected_urlr�s    rr�zPathname_Tests.test_basic�s��������W�d�C��@�
�(�����,�,�]�;������v� �,�0�	1����,�,�\�:������� �-�1�	2rc��tjjddd�}dtjjd�z}tjj|�}|j||d|�d|���|}tjj|�}|j||d|�d|���tjjdd	�}d
tjjd�z}tjj|�}|j||d|�d|���d}tjjdd
�}tjj|�}|j||d|�d|���y)N�needszquot=ing�herez
needs/%s/herer�r�zurl2pathname() failed; z	make sure�using_quotez%s/using_quotezmake+sure/using_unquotez	make+sure�
using_unquote)
r�rUr�rr�r�rr�r�r�rs    rrlzPathname_Tests.test_quoting�sD�������W�j�&�9�� �6�<�<�#5�#5�j�#A�A�����,�,�U�3������� �&�*�	+������,�,�V�4������� �&�*�	+������[�-�8��!�F�L�L�$6�$6�{�$C�C�����,�,�U�3������� �&�*�	+�*�������k�?�;�����,�,�U�3������� �&�*�	+r�win32z#test specific to Windows pathnames.c��tjj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d	�d
�|j|d�d�|j|d
�d�|j|d�d�|j|d�d�|j|d�d�|j	t
|d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d �d!�|j|d"�d
�|j|d�d�|j|d#�d�|j|d$�d�gd%�}|D]7}|j|tjj
|��|��9y)&Nz
\\?\C:\dirz	///C:/dirz\\?\unc\server\share\dirz//server/share/dir�C:�///C:�C:\�///C:/zC:\a\b.cz///C:/a/b.cz	C:\a\b.c\z///C:/a/b.c/z	C:\a\\b.cz///C:/a//b.cz	C:\a\b%#cz///C:/a/b%25%23cuC:\a\béz///C:/a/b%C3%A9�C:\foo\bar\spam.foo�///C:/foo/bar/spam.foozXX:\z
\folder\test\�
/folder/test/z\\folder\test\z//folder/test/z\\\folder\test\z///folder/test/z
\\some\share\z
//some/share/z\\some\share\a\b.cz//some/share/a/b.cu\\some\share\a\b%#céz//some/share/a/b%25%23c%C3%A9zC:/a/b.cz
//?/C:/dirz//?/unc/server/share/dir)r�r�r�)rrr�r�r��IOErrorr�)r+�fn�urlsrs    r�test_pathname2url_winz$Pathname_Tests.test_pathname2url_win�s���^�^�
(�
(������,�-�{�;�����<�=�?S�T�����D��7�+�����F��X�.�����L�)�=�9�����N�+�^�<�����N�+�^�<�����M�*�,>�?�����N�+�->�?�����4�5�7O�P����'�2�w�/�����.�/��A�����0�1�3C�D�����2�3�5F�G�����/�0�/�B�����5�6�8L�M�����:�;�=\�]�����J���7�����0�1�3G�H�����L�)�;�7�����6�7�9M�N�*���C����R���� ;� ;�C� @�A�3�G�rz test specific to POSIX pathnamesc�X�tjj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d	�y)
Nrz/a/b.cz//a/b.cz	////a/b.cz///a/b.cz
/////a/b.cz//////a/b.cz/a/b%#cz/a/b%25%23c)rrr�r��r+r�s  r�test_pathname2url_posixz&Pathname_Tests.test_pathname2url_posix s����^�^�
(�
(������C��#�&�����H��x�0�����I���4�����J���6�����K��-�8�����I��
�6rzneed os_helper.FS_NONASCIIc�.�tj�}tj�}tjjtj||��}|jtjjtj�|�y�Nr!)�sys�getfilesystemencoding�getfilesystemencodeerrorsrr�r�r�FS_NONASCIIr�rr��r+rr"rs    r�test_pathname2url_nonasciiz)Pathname_Tests.test_pathname2url_nonascii+se���,�,�.���.�.�0���l�l� � ��!6�!6��RX� �Y��������4�4�Y�5J�5J�K�S�Qrc�f�tjj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d	�d
�|j|d�d�|j|d
�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j	t
|d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d �d�|j|d!�d"�|j|d#�d�|j|d$�d%�|j|d&�d'�gd(�}|D]7}|j|tjj
|��|��9y))Nz/C:/r�z///C|r�r�r�z/C|//zC:\\z
///C|/pathzC:\pathz
///C/test/z\C\test\z////C/test/z	\\C\test\zC:/path/to/filezC:\path\to\filezC:/path/to/file/zC:\path\to\file\zC:/path/to//filezC:\path\to\\filezC|/path/to/filez/C|/path/to/filez///C|/path/to/filez///C|/foo/bar/spam.foor�u///è|/z//server/path/to/filez\\server\path\to\filez////server/path/to/filez/////server/path/to/filez//localhost/C:/path/to/filez//localhost/C|/path/to/filez//localhost/path/to/filez
\path\to\filez //localhost//server/path/to/filezC:/foo%2fbarz
C:\foo/barz//server/share/foo%2fbarz\\server\share\foo/bar)r�z	\C\test\\r�)rrr�r�r�r�r�)r+r��pathsrUs    r�test_url2pathname_winz$Pathname_Tests.test_url2pathname_win2sm���^�^�
(�
(������F��V�,�����G��d�+�����G��d�+�����H��v�.�����G��h�/�����L�)�:�6�����L�)�=�9�����M�*�O�<�����-�.�0D�E�����.�/�1G�H�����.�/�1G�H�����-�.�0D�E�����.�/�1E�F�����0�1�3G�H�����4�5�7O�P����'�2�}�5�����3�4�6R�S�����5�6�8T�U�����6�7�9U�V�����9�:�<P�Q�����9�:�<P�Q�����6�7�9K�L�����>�?�A]�^�����N�+�]�;�����6�7�9U�V�)���D����R���� ;� ;�D� A�B�D�I�rc�(�tjj}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�y)Nz/foo/barz	//foo/barz
///foo/barz////foo/barz//localhost/foo/bar)rrr�r�r�s  r�test_url2pathname_posixz&Pathname_Tests.test_url2pathname_posix\s{���^�^�
(�
(������J���4�����K��+�6�����L�)�:�6�����M�*�K�8�����1�2�J�?rc��tj�}tj�}tj}|jtjj|�tj�tjj|||��}|jtjj|�tj�yr�)r�r�r�rr�r�rrr�r�r�r�s    r�test_url2pathname_nonasciiz)Pathname_Tests.test_url2pathname_nonasciifs����,�,�.���.�.�0���#�#��������4�4�S�9�9�;P�;P�Q��l�l� � ��x�� �G��������4�4�S�9�9�;P�;P�QrN)r@rArBr�r�rlr�r�r��platformr��skipIfr�rr�r�r�r�r�r$rrr�r��s-��0�2�+�6�X�������0�>�@� H�@� H�D�X�_�_�S�\�\�W�,�7�9�7�9�7��X����.�.�0L�M�R�N�R��X�������0�>�@�&J�@�&J�P�X�_�_�S�\�\�W�,�7�9�@�9�@��X����.�.�0L�M�R�N�Rrr�c��eZdZdZd�Zy)�
Utility_Testsz=Testcase to test the various utility functions in the urllib.c�h�|jtjj�t�y)zATest the urllib.request.thishost utility function returns a tupleN)r�rr�thishost�tupler?s r�
test_thishostzUtility_Tests.test_thishostrs�����f�n�n�5�5�7��?rN)r@rArBr�r�r$rrr�r�os��G�@rr�c��eZdZdZd�Zeje��d��Zeje��d��Z	eje��d��Z
y)�URLopener_Testsz4Testcase to test the open method of URLopener class.c�B�Gd�dtjj�}tjdt
f�5|j
|�jd�d�|j
|�jd�d�ddd�y#1swYyxYw)Nc��eZdZd�Zy)�8URLopener_Tests.test_quoted_open.<locals>.DummyURLopenerc��|Sr)r$�r+rs  r�	open_spamzBURLopener_Tests.test_quoted_open.<locals>.DummyURLopener.open_spam|����
rN)r@rArBr�r$rr�DummyURLopenerr�{���
rr�z8DummyURLopener style of invoking requests is deprecated.zspam://example/ /z//example/%20/z,spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/z'//c:|windows%/:=&?~#+!$,;'@()*[]|/path/)rrr{rr"r#r�r)r+r�s  r�test_quoted_openz URLopener_Tests.test_quoted_openzs���	�V�^�^�5�5�	��
+�
+�K�"�$�%�
���^�-�2�2�#�%�%5�
7�
���^�-�2�2�>�@�9�
;�%�%�%�s�A
B�B)�categoryc���tj�5}tj|��\}}t	j
|�dtjj|�z}tjj�j|�\}}|jtjj|�tjj|��ddd�y#1swYyxYw)N)�dirzfile:)r�temp_dirrSrTr�r>rrr�r{�retriever�rU�normcase)r+�tmpdirrY�tmpfile�fileurlrL�_s       r�test_urlopener_retrieve_filez,URLopener_Tests.test_urlopener_retrieve_file�s���
�
�
�
!�V�"�*�*�v�6�K�B���H�H�R�L����� ;� ;�G� D�D�G� �.�.�2�2�4�=�=�g�F�K�H�a����R�W�W�-�-�h�7����9I�9I�'�9R�S�
"�
!�
!�s�C
C+�+C4c�$�d}|jd�|j|j�tjj�j
|�\}}|jtjj|�dd�y)Nzhttp://www.python.org/file.txtr
rz.txt)rRr�rZrrr{r�r�r�rU�splitext)r+rrLr�s    r�test_urlopener_retrieve_remotez.URLopener_Tests.test_urlopener_retrieve_remote�si��.���
�
�6�7�������(��n�n�.�.�0�9�9�#�>���!�������)�)�(�3�A�6��?rc�B�Gd�dtjj�}dD]�}|jttjj
|�|jttjj�j|�|jttjj�j|�|jt|�j|�|jt|�j|���y)Nc��eZdZd�Zy)�<URLopener_Tests.test_local_file_open.<locals>.DummyURLopenerc��|Sr)r$r�s  r�open_local_filezLURLopener_Tests.test_local_file_open.<locals>.DummyURLopener.open_local_file�r�rN)r@rArBr�r$rrr�r��r�rr�)zlocal_file://examplezlocal-file://example)rrr{r�rHr rr�)r+r�rs   r�test_local_file_openz$URLopener_Tests.test_local_file_open�s���	�V�^�^�5�5�	�D�C����g�v�~�~�'=�'=�s�C����g�v�~�~�'?�'?�'A�'F�'F��L����g�v�~�~�'?�'?�'A�'J�'J�C�P����g�~�'7�'<�'<�c�B����g�~�'7�'@�'@�#�F�DrN)r@rArBr�r�r�ignore_warningsr#r�r�r�r$rrr�r�wsy��>�
;�%�_�$�$�.@�A�T�B�T�%�_�$�$�.@�A�@�B�@�%�_�$�$�.@�A�
G�B�
Grr�c��eZdZdZd�Zd�Zy)�RequestTestsz&Unit tests for urllib.request.Request.c���tjj}|d�}|j|j	�d�|di�}|j|j	�d�y)Nr
r��POST)rr�Requestr��
get_method�r+r�rs   r�test_default_valuesz RequestTests.test_default_values�s[���.�.�(�(���1�2������+�+�-�u�5��1�2�6������+�+�-�v�6rc���tjj}|dd��}|j|jd�|j|j�d�|did��}|j|jd�|j|j�d�|dd��}|j|j�d�d|_|j|j�d�y)Nr
�HEAD)�methodr�)rrr�r�r�r�r�s   r�test_with_method_argz!RequestTests.test_with_method_arg�s����.�.�(�(���1�&�A���������0�����+�+�-�v�6��1�2�f�E���������0�����+�+�-�v�6��1�%�@������+�+�-�u�5��������+�+�-�v�6rN)r@rArBr�r�r�r$rrr�r��s��0�7�7rr��__main__)NNr[)6r��urllib.parser�urllib.request�urllib.error�http.clientrO�
email.messager�r6r��
unittest.mockrrhr�test.supportrrrr�r��ImportErrorr�rS�base64rr��has_gethostname�SkipTestrrr rrRrorTr]�TestCaservr�r�rr�r�r�r�r+rRr�r�r�r�r@�mainr$rr�<module>r�s���A������	����"�&�(�	��������$�$�
�(�
�
�9�
:�:���
�
&� /�,�^<�F�<�;�6�;�(ZR��)�)�ZR�zD9��"�"�D9�N!C�� 1� 1�!C�HK��)�)�=�,�K�\MP��)�)�MP�`H-�H�-�-�H-�V*"�H�-�-�}�*"�ZJL�8�$�$�JL�ZRI�X�&�&�RI�jA)�h�'�'�A)�F\R�X�&�&�\R�|@�H�%�%�@�/G�m�X�%6�%6�/G�d7�8�$�$�7�0�z���H�M�M�O���_5��
�C��s�G�G)�(G)

Youez - 2016 - github.com/yon3zu
LinuXploit