Sindbad~EG File Manager
�
'Μg�% � �8 � d dl Z d dlmZ d dlmZ d dlmZ d dlZd dlZd dlZ d dl
Z d dlZd dlZ
d dlZ ej d� G d� de j � Z G d� d e j � Z G d
� de j � Zedk( r e j* � yy)
� N)�support)� os_helper)�
socket_helper�networkc � � e Zd Zd� Zd� Zd� Zy)�URLTimeoutTestc �J � t j t j � y �N)�socket�setdefaulttimeoutr �INTERNET_TIMEOUT��selfs �0/usr/local/lib/python3.12/test/test_urllibnet.py�setUpzURLTimeoutTest.setUp s � �� � ��!9�!9�:� c �. � t j d � y r
)r r r s r �tearDownzURLTimeoutTest.tearDown s � �� � ��&r c � � | j t j j � t j j t j � j }t j |� 5 t j j t j � }|j � d d d � y # 1 sw Y y xY wr
)
�
addCleanup�urllib�request�
urlcleanup�parse�urlparser �
TEST_HTTP_URL�netlocr �transient_internet�urlopen�read)r �domain�fs r �testURLreadzURLTimeoutTest.testURLread su � �������1�1�2����&�&�w�'<�'<�=�D�D��
�
-�
-�f�
5����&�&�w�'<�'<�=�A�
�F�F�H� 6�
5�
5�s �6>B=�=CN)�__name__�
__module__�__qualname__r r r# � r r r r s � �;�'�r r c � � e Zd ZdZdZd� Zej d� � Zd� Z d� Z
d� Zd� Zd � Z
ej d
� d� � Zy)
�urlopenNetworkTestsaA Tests urllib.request.urlopen using the network.
These tests are not exhaustive. Assuming that testing using files does a
good job overall of some of the basic interface features. There are no
tests exercising the optional 'data' and 'proxies' arguments. No tests
for transparent redirection have been written.
setUp is not used for always constructing a connection to
http://www.pythontest.net/ since there a few tests that don't use that address
and making a connection is expensive enough to warrant minimizing unneeded
connections.
�http://www.pythontest.net/c �V � | j t j j � y r
�r r r r r s r r zurlopenNetworkTests.setUp6 � � �������1�1�2r c / � K � |d }t j |� 5 t j j |i |��} |�� |j � d d d � y # |j � w xY w# 1 sw Y y xY w�w�Nr )r r r r r �close)r �args�kwargs�resource�rs r r zurlopenNetworkTests.urlopen: sf � �� ���7��
�
-�
-�h�
7����&�&��7��7�A�
������ � 8�
7��
��� �� 8�
7�s3 �A=� A1�A�A1� A=�A.�.A1�1A:�6A=c �� � | j | j � 5 }dD ]! }| j t ||� d|z � �# | j |j � d� d d d � y # 1 sw Y y xY w)N)r �readline� readlines�filenor0 �info�geturlz3object returned from urlopen lacks the %s attributezcalling 'read' failed)r �url�
assertTrue�hasattrr )r �open_url�attrs r �
test_basiczurlopenNetworkTests.test_basicD sh � �
�\�\�$�(�(�
#�x�+�������$� 7� :A�CG�:H� I�+�
�O�O�H�M�M�O�-D�E� $�
#�
#�s �AA,�,A5c � � | j | j � 5 }| j |j � t d� | j |j � t d� d d d � y # 1 sw Y y xY w)Nz readline did not return a stringzreadlines did not return a list)r r; �assertIsInstancer6 �bytesr7 �list)r r>