Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_urllib_response.cpython-311.pyc |
�
�Ke� � � � d Z ddlZddlZddlZddlZddlmZ ej r ej d� � � G d� dej
� � Zedk r ej
� � dS dS )z'Unit tests for code in urllib.response.� N)�supportzCannot create socket on WASIc �2 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�TestResponsec � � t j t j t j � � | _ | j � d� � | _ ddd�| _ d S )N�rbzwww.python.org�close)�Host�
Connection)�socket�AF_INET�SOCK_STREAM�sock�makefile�fp�test_headers��selfs �C/usr/local/apps/python3/lib/python3.11/test/test_urllib_response.py�setUpzTestResponse.setUp sL � ��M�&�.�&�2D�E�E�� ��)�$�$�T�*�*���%5�+2�4� 4����� c �` �� t j � | j � � �| � �t
j � � �fd�}| � | j j � � |� � | � | j j � � | �
t |� � d S )Nc �@ �� �5 } d d d � � d S # 1 swxY w Y d S �N� )�spam�addbases �r �fz!TestResponse.test_with.<locals>.f sm �� ��
�D��
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
s ���)�urllib�responser r �assertIsInstance�tempfile�_TemporaryFileWrapper�assertFalse�closed�
assertTrue�assertRaises�
ValueError)r r r s @r � test_withzTestResponse.test_with s� �� ��/�)�)�$�'�2�2�����g�x�'E�F�F�F� � � � � �
������(�(�(� �����������'�'�'����*�a�(�(�(�(�(r c �� �� d��fd�}t j � | j |� � }|� � � | � | j j � � | � �� � d S )NFc � �� d� d S )NTr )�closehook_calleds �r � closehookz1TestResponse.test_addclosehook.<locals>.closehook% s �� �#���r )r r �addclosehookr r r% r$ )r r, r+ s @r �test_addclosehookzTestResponse.test_addclosehook"