Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/protocols/haproxy/test/__pycache__/test_parser.cpython-39.pyc
Ðазад
a k�h � @ s� d Z ddlmZmZ ddlmZmZmZmZ m Z mZ ddlm Z ddlmZ ddlmZ ddlmZ G d d � d e�ZG dd� de�Zd S )z1 Tests for L{twisted.protocols.haproxy._parser}. � )�Type�Union)�TCP4ServerEndpoint�TCP6ServerEndpoint�UNIXServerEndpoint�_parse�_WrapperServerEndpoint�serverFromString)� MemoryReactor)�SynchronousTestCase� )�unparseEndpoint)�HAProxyWrappingFactoryc @ st e Zd ZdZedd�dd�Zdd�dd�Zdd�d d �Zdd�dd�Zdd�d d�Z dd�dd�Z dd�dd�ZdS )�UnparseEndpointTestszg Tests to ensure that un-parsing an endpoint string round trips through escaping properly. N)�input�returnc C s | � tt|�� |� dS )aA Check that the input unparses into the output, raising an assertion error if it doesn't. @param input: an input in endpoint-string-description format. (To ensure determinism, keyword arguments should be in alphabetical order.) @type input: native L{str} N)ZassertEqualr � parseEndpoint)�selfr � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/protocols/haproxy/test/test_parser.py�check s zUnparseEndpointTests.check�r c C s | � d� dS )z% An individual word. �wordN�r �r r r r �test_basicUnparse) s z&UnparseEndpointTests.test_basicUnparsec C s | � d� dS )z% Multiple arguments. zone:twoNr r r r r �test_multipleArguments/ s z+UnparseEndpointTests.test_multipleArgumentsc C s | � d� dS )z$ Keyword arguments. zaleph=one:bet=twoNr r r r r � test_keywords5 s z"UnparseEndpointTests.test_keywordsc C s | � d� dS )z Escaped ":". zhello\:colon\:worldNr r r r r �test_colonInArgument; s z)UnparseEndpointTests.test_colonInArgumentc C s | � d� dS )z/ Escaped ":" in keyword value. zhello=\:Nr r r r r �test_colonInKeywordValueA s z-UnparseEndpointTests.test_colonInKeywordValuec C s | � d� dS )z. Escaped ":" in keyword name. z\:=helloNr r r r r �test_colonInKeywordNameG s z,UnparseEndpointTests.test_colonInKeywordName)�__name__� __module__�__qualname__�__doc__�strr r r r r r r r r r r r s r c @ sb e Zd ZdZeeee ee ee f e d�dd�Zdd�dd�Zdd�d d �Z dd�dd�ZdS ) �HAProxyServerParserTestsz@ Tests that the parser generates the correct endpoints. )�description� expectedClassr c C sJ t � }t||�}| �|t� t|t�s*J �| �|j|� | �|jt� |S )a% Test the C{haproxy} enpdoint prefix against one sub-endpoint type. @param description: A string endpoint description beginning with C{haproxy}. @type description: native L{str} @param expectedClass: the expected sub-endpoint class given the description. @type expectedClass: L{type} @return: the parsed endpoint @rtype: L{IStreamServerEndpoint} @raise twisted.trial.unittest.Failtest: if the parsed endpoint doesn't match expectations. ) r r ZassertIsInstancer � isinstanceZ_wrappedEndpointZassertIsZ_wrapperFactoryr )r r'