Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/twisted/web/test/__pycache__/ |
Upload File : |
o �b. � @ s� d Z ddlmZ ddlmZ ddlmZ G dd� dej�ZG dd� d�Z G d d � d e ej�Z G dd� de ej�ZG d d� de ej�ZdS )z) Tests L{twisted.web.client} helper APIs � )�urlparse)�unittest)�clientc @ s e Zd ZdZdd� Zdd� ZdS )�URLJoinTestsz' Tests for L{client._urljoin}. c C s@ | � t�dd�d� | � t�dd�d� | � t�dd�d� dS )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��self� r �A/usr/lib/python3/dist-packages/twisted/web/test/test_webclient.py�test_noFragments s ���zURLJoinTests.test_noFragmentsc C s@ | � t�dd�d� | � t�dd�d� | � t�dd�d� dS )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 r r r �test_preserveFragments$ s � � �z#URLJoinTests.test_preserveFragmentsN)�__name__� __module__�__qualname__�__doc__r r r r r r r s r c @ s� e Zd ZdZdd� Z d$dd�Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#S )%�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 C sB | � | jt� | � | jt� | � |t� | �d|� |�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 �templater r r � makeURIStringI s zURITests.makeURIString� c C s@ | � |||||||| f|j|j|j|j|j|j|j|jf� dS )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 r r r! r"