%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__/test_parser.cpython-312.pyc

�

Ϫ�f����dZddlmZmZddlmZmZmZmZ	m
Z
mZddlm
Z
ddlmZddlmZddlmZGd	�d
e�ZGd�de�Zy
)z1
Tests for L{twisted.protocols.haproxy._parser}.
�)�Type�Union)�TCP4ServerEndpoint�TCP6ServerEndpoint�UNIXServerEndpoint�_parse�_WrapperServerEndpoint�serverFromString)�
MemoryReactor)�SynchronousTestCase�)�unparseEndpoint)�HAProxyWrappingFactoryc�P�eZdZdZdeddfd�Zdd�Zdd�Zdd�Zdd	�Z	dd
�Z
dd�Zy)
�UnparseEndpointTestszg
    Tests to ensure that un-parsing an endpoint string round trips through
    escaping properly.
    �input�returnNc�F�|jtt|��|�y)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)�assertEqualr�
parseEndpoint)�selfrs  �L/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_parser.py�checkzUnparseEndpointTests.checks��	
����-��*>�?��G�c�&�|jd�y)z%
        An individual word.
        �wordN�r�rs r�test_basicUnparsez&UnparseEndpointTests.test_basicUnparse)s��	
�
�
�6�rc�&�|jd�y)z%
        Multiple arguments.
        zone:twoNrrs r�test_multipleArgumentsz+UnparseEndpointTests.test_multipleArguments/s��	
�
�
�9�rc�&�|jd�y)z$
        Keyword arguments.
        zaleph=one:bet=twoNrrs r�
test_keywordsz"UnparseEndpointTests.test_keywords5s��	
�
�
�&�'rc�&�|jd�y)z
        Escaped ":".
        zhello\:colon\:worldNrrs r�test_colonInArgumentz)UnparseEndpointTests.test_colonInArgument;s��	
�
�
�*�+rc�&�|jd�y)z/
        Escaped ":" in keyword value.
        zhello=\:Nrrs r�test_colonInKeywordValuez-UnparseEndpointTests.test_colonInKeywordValueA���	
�
�
�;�rc�&�|jd�y)z.
        Escaped ":" in keyword name.
        z\:=helloNrrs r�test_colonInKeywordNamez,UnparseEndpointTests.test_colonInKeywordNameGr(r�rN)�__name__�
__module__�__qualname__�__doc__�strrrr!r#r%r'r*�rrrrs;���

H�3�
H�4�
H���(�,� � rrc�Z�eZdZdZdedeeeeeee	fde
fd�Zd
d�Zd
d�Z
d
d	�Zy)�HAProxyServerParserTestsz@
    Tests that the parser generates the correct endpoints.
    �description�
expectedClassrc��t�}t||�}|j|t�t	|t�sJ�|j|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.
        )	rr
�assertIsInstancer	�
isinstance�_wrappedEndpoint�assertIs�_wrapperFactoryr)rr4r5�reactor�endpoints     r�	onePrefixz"HAProxyServerParserTests.onePrefixSsi��4 �/��#�G�[�9�����h�(>�?��(�$:�;�;�;����h�7�7��G��
�
�h�.�.�0F�G��rNc�0�|jdt�y)zG
        Test if the parser generates a wrapped TCP4 endpoint.
        zhaproxy:tcp:8080N)r>rrs r�	test_tcp4z"HAProxyServerParserTests.test_tcp4us��	
���)�+=�>rc�0�|jdt�y)zG
        Test if the parser generates a wrapped TCP6 endpoint.
        zhaproxy:tcp6:8080N)r>rrs r�	test_tcp6z"HAProxyServerParserTests.test_tcp6{s��	
���*�,>�?rc�0�|jdt�y)zG
        Test if the parser generates a wrapped UNIX endpoint.
        z haproxy:unix:address=/tmp/socketN)r>rrs r�	test_unixz"HAProxyServerParserTests.test_unix�s��	
���9�;M�Nrr+)r,r-r.r/r0rrrrrr	r>r@rBrDr1rrr3r3Ns_��� �� ���#�$��#�$��#�$�
&�
� �
 � �D?�@�Orr3N)r/�typingrr�twisted.internet.endpointsrrrrrr	r
�twisted.internet.testingr�twisted.trial.unittestr�TestCase�_parserr�_wrapperrrr3r1rr�<module>rLsB������3�B�%�-�4 �8�4 �n7O�x�7Or

Zerion Mini Shell 1.0