o
    ¯b©  ã                   @   sL   d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 G dd„ de	ƒZ
dS )	z,
Tests for L{twisted.application.strports}.
é    )ÚinternetÚstrports)ÚTCP4ServerEndpoint)ÚFactory)ÚTestCasec                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚServiceTestsz(
    Tests for L{strports.service}.
    c                 C   s‚   t ƒ }tƒ }d}tjdt|ƒ ||d�}|  |tj¡ |  |j	¡ |  |j
t¡ |  |j
j|¡ |  |j|¡ |  |j
j|¡ dS )z¾
        L{strports.service} returns a L{StreamServerEndpointService}
        constructed with an endpoint produced from
        L{endpoint.serverFromString}, using the same syntax.
        i9  ztcp:©ÚreactorN)Úobjectr   r   ÚserviceÚstrÚassertIsInstancer   ÚStreamServerEndpointServiceÚ
assertTrueÚ_raiseSynchronouslyÚendpointr   ÚassertEqualÚ_portÚassertIsÚfactoryÚ_reactor)Úselfr	   ÚaFactoryÚ	aGoodPortÚsvc© r   ú</usr/lib/python3/dist-packages/twisted/test/test_strports.pyÚtest_service   s   zServiceTests.test_servicec                 C   s,   ddl m} t dd¡}|  |jj|¡ dS )zp
        L{strports.service} will use the default reactor when none is provided
        as an argument.
        r   r   ztcp:80N)Útwisted.internetr	   r   r   r   r   r   )r   ÚglobalReactorÚaServicer   r   r   Útest_serviceDefaultReactor)   s   z'ServiceTests.test_serviceDefaultReactorN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r!   r   r   r   r   r      s    r   N)r%   Útwisted.applicationr   r   Útwisted.internet.endpointsr   Útwisted.internet.protocolr   Útwisted.trial.unittestr   r   r   r   r   r   Ú<module>   s   