+
    Dfj                         R t ^ RIHtHt ^ RIHtHtHtHt	H
t
Ht ^ RIHt ^ RIHt ^RIHt ^RIHt  ! R R]4      t ! R	 R
]4      tR# )z1
Tests for L{twisted.protocols.haproxy._parser}.
)TypeUnion)TCP4ServerEndpointTCP6ServerEndpointUNIXServerEndpoint_parse_WrapperServerEndpointserverFromString)MemoryReactor)SynchronousTestCase)unparseEndpoint)HAProxyWrappingFactoryc                      a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltRtV tR# )UnparseEndpointTestsz[
Tests to ensure that un-parsing an endpoint string round trips through
escaping properly.
c                $   < V ^8  d   QhRS[ RR/# )   inputreturnN)str)format__classdict__s   "L/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_parser.py__annotate__!UnparseEndpointTests.__annotate__   s     
H 
H3 
H4 
H    c                J    V P                  \        \        V4      !  V4       R# )a	  
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)selfr   s   &&r   checkUnparseEndpointTests.check   s     	-*>?Gr   c                   < V ^8  d   QhRR/# r   r   N )r   r   s   "r   r   r   )   s      4 r   c                (    V P                  R4       R# )z
An individual word.
wordNr   r   s   &r   test_basicUnparse&UnparseEndpointTests.test_basicUnparse)   s     	

6r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   r   /   s       r   c                (    V P                  R4       R# )z
Multiple arguments.
zone:twoNr&   r'   s   &r   test_multipleArguments+UnparseEndpointTests.test_multipleArguments/   s     	

9r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   r   5   s     ( (t (r   c                (    V P                  R4       R# )z
Keyword arguments.
zaleph=one:bet=twoNr&   r'   s   &r   test_keywords"UnparseEndpointTests.test_keywords5   s     	

&'r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   r   ;   s     , ,d ,r   c                (    V P                  R4       R# )z
Escaped ":".
zhello\:colon\:worldNr&   r'   s   &r   test_colonInArgument)UnparseEndpointTests.test_colonInArgument;   s     	

*+r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   r   A   s        $  r   c                (    V P                  R4       R# )z
Escaped ":" in keyword value.
zhello=\:Nr&   r'   s   &r   test_colonInKeywordValue-UnparseEndpointTests.test_colonInKeywordValueA        	

;r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   r   G   s          r   c                (    V P                  R4       R# )z
Escaped ":" in keyword name.
z\:=helloNr&   r'   s   &r   test_colonInKeywordName,UnparseEndpointTests.test_colonInKeywordNameG   r:   r   r#   N)__name__
__module____qualname____firstlineno____doc__r   r(   r,   r0   r4   r8   r=   __static_attributes____classdictcell__r   s   @r   r   r      sR     

H 
H  ( (, ,      r   r   c                   l   a  ] tR t^Nt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltR
t	V t
R# )HAProxyServerParserTestsz8
Tests that the parser generates the correct endpoints.
c                v   < V ^8  d   QhRS[ RS[S[S[,          S[S[,          S[S[,          3,          RS[/# )r   descriptionexpectedClassr   )r   r   r   r   r   r   r   )r   r   s   "r   r   %HAProxyServerParserTests.__annotate__S   sN          #$#$#$&
  
  r   c                   \        4       p\        W14      pV P                  V\        4       \	        V\        4      '       g   Q hV P                  VP
                  V4       V P                  VP                  \        4       V# )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	   assertIsInstancer   
isinstance_wrappedEndpointassertIs_wrapperFactoryr   )r   rJ   rK   reactorendpoints   &&&  r   	onePrefix"HAProxyServerParserTests.onePrefixS   sj    4  /#G9h(>?($:;;;;h77Gh..0FGr   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   rL   u   s     ? ?4 ?r   c                2    V P                  R\        4       R# )z7
Test if the parser generates a wrapped TCP4 endpoint.
zhaproxy:tcp:8080N)rU   r   r'   s   &r   	test_tcp4"HAProxyServerParserTests.test_tcp4u   s     	)+=>r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   rL   {   s     @ @4 @r   c                2    V P                  R\        4       R# )z7
Test if the parser generates a wrapped TCP6 endpoint.
zhaproxy:tcp6:8080N)rU   r   r'   s   &r   	test_tcp6"HAProxyServerParserTests.test_tcp6{   s     	*,>?r   c                   < V ^8  d   QhRR/# r"   r#   )r   r   s   "r   r   rL      s     O O4 Or   c                2    V P                  R\        4       R# )z7
Test if the parser generates a wrapped UNIX endpoint.
z haproxy:unix:address=/tmp/socketN)rU   r   r'   s   &r   	test_unix"HAProxyServerParserTests.test_unix   s     	9;MNr   r#   N)r?   r@   rA   rB   rC   rU   rY   r]   ra   rD   rE   rF   s   @r   rH   rH   N   s7        D? ?@ @O Or   rH   N)rC   typingr   r   twisted.internet.endpointsr   r   r   r   r   r   r	   twisted.internet.testingr
   twisted.trial.unittestr   TestCase_parserr   _wrapperr   r   rH   r#   r   r   <module>rj      sB      3 B % -4 8 4 n7Ox 7Or   