Current File : //usr/lib/python3/dist-packages/twisted/web/test/__pycache__/test_webclient.cpython-312.pyc |
�
Ϫ�f. � �� � d Z ddlmZ ddlmZ ddlmZ G d� dej � Z G d� d� Z G d � d
e ej � Z
G d� de ej � Z G d
� de ej � Zy)z)
Tests L{twisted.web.client} helper APIs
� )�urlparse)�unittest)�clientc � � e Zd ZdZd� Zd� Zy)�URLJoinTestsz'
Tests for L{client._urljoin}.
c �� � | j t j dd� d� | j t j dd� d� | j t j dd� d� y)z�
L{client._urljoin} does not include a fragment identifier in the
resulting URL if neither the base nor the new path include a fragment
identifier.
� http://foo.com/bar� /quuxs http://foo.com/quuxs http://foo.com/bar#s /quux#N��assertEqualr �_urljoin��selfs �A/usr/lib/python3/dist-packages/twisted/web/test/test_webclient.py�test_noFragmentszURLJoinTests.test_noFragments sh � �
����O�O�1�8�<�>T�
�
����O�O�2�H�=�?U�
�
����O�O�1�9�=�?U�
� c �� � | j t j dd� d� | j t j dd� d� | j t j dd� d� y)a
L{client._urljoin} preserves the fragment identifier from either the
new path or the base URL respectively, as specified in the HTTP 1.1 bis
draft.
@see: U{https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2}
s http://foo.com/bar#fragr
s http://foo.com/quux#fragr s /quux#frag2s http://foo.com/quux#frag2Nr r s r �test_preserveFragmentsz#URLJoinTests.test_preserveFragments$ sh � �
����O�O�6��A�'�
�
����O�O�1�>�B�(�
�
����O�O�6��G�(�
r N)�__name__�
__module__�__qualname__�__doc__r r � r r r r s � ��
�
r r c �t � e Zd ZdZd� Z dd�Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zd� Zd� Zd� Zy)�URITestsa
Abstract tests for L{twisted.web.client.URI}.
Subclass this and L{unittest.TestCase}. Then provide a value for
C{host} and C{uriHost}.
@ivar host: A host specification for use in tests, must be L{bytes}.
@ivar uriHost: The host specification in URI form, must be a L{bytes}. In
most cases this is identical with C{host}. IPv6 address literals are an
exception, according to RFC 3986 section 3.2.2, as they need to be
enclosed in brackets. In this case this variable is different.
c �
� | j | j t � | j | j t � | j |t � | j d|� |j d| j � S )a�
Replace the string "HOST" in C{template} with this test's host.
Byte strings Python between (and including) versions 3.0 and 3.4
cannot be formatted using C{%} or C{format} so this does a simple
replace.
@type template: L{bytes}
@param template: A string containing "HOST".
@rtype: L{bytes}
@return: A string where "HOST" has been replaced by C{self.host}.
s HOST)�assertIsInstance�host�bytes�uriHost�assertIn�replace)r �templates r �
makeURIStringzURITests.makeURIStringI sa � �
���d�i�i��/����d�l�l�E�2����h��.��
�
�g�x�(��������6�6r c
�� � | j |||||||| f|j |j |j |j |j
|j |j |j f� y)aU
Assert that all of a L{client.URI}'s components match the expected
values.
@param uri: U{client.URI} instance whose attributes will be checked
for equality.
@type scheme: L{bytes}
@param scheme: URI scheme specifier.
@type netloc: L{bytes}
@param netloc: Network location component.
@type host: L{bytes}
@param host: Host name.
@type port: L{int}
@param port: Port number.
@type path: L{bytes}
@param path: Hierarchical path.
@type params: L{bytes}
@param params: Parameters for last path segment, defaults to C{b''}.
@type query: L{bytes}
@param query: Query string, defaults to C{b''}.
@type fragment: L{bytes}
@param fragment: Fragment identifier, defaults to C{b''}.
N) r �scheme�netlocr �port�path�params�query�fragment)
r �urir&