%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f���dZddlmZddlmZddlmZddlmZm	Z	m
Z
mZmZddl
mZddlmZee
�Gd�d	��ZGd
�de�ZGd�d
e�Zy)z+
Tests for L{twisted.application.service}.
�)�implementer)�BrokenImplementation)�verifyObject)�Application�IProcess�IService�IServiceCollection�Service)�IPersistable)�TestCasec��eZdZdZdedededdfd�Zdd�Zdd	�Z	dd
�Z
deddfd�Zdeddfd�Z
dd
�Zdd�Zdd�Zdd�Zy)�
AlmostServicea�
    Implement IService in a way that can fail.

    In general, classes should maintain invariants that adhere
    to the interfaces that they claim to implement --
    otherwise, it is a bug.

    This is a buggy class -- the IService implementation is fragile,
    and several methods will break it. These bugs are intentional,
    as the tests trigger them -- and then check that the class,
    indeed, no longer complies with the interface (IService)
    that it claims to comply with.

    Since the verification will, by definition, only fail on buggy classes --
    in other words, those which do not actually support the interface they
    claim to support, we have to write a buggy class to properly verify
    the interface.
    �name�parent�running�returnNc�.�||_||_||_y)N)rrr)�selfrrrs    �G/usr/lib/python3/dist-packages/twisted/application/test/test_service.py�__init__zAlmostService.__init__-s����	�������c��|`y)z�
        Probably not a wise method to call.

        This method removes the :code:`name` attribute,
        which has to exist in IService classes.
        N)r�rs r�makeInvalidByDeletingNamez'AlmostService.makeInvalidByDeletingName2s	��
�Irc��|`y)z�
        Probably not a wise method to call.

        This method removes the :code:`parent` attribute,
        which has to exist in IService classes.
        N)rrs r�makeInvalidByDeletingParentz)AlmostService.makeInvalidByDeletingParent;s	��
�Krc��|`y)z�
        Probably not a wise method to call.

        This method removes the :code:`running` attribute,
        which has to exist in IService classes.
        N)rrs r�makeInvalidByDeletingRunningz*AlmostService.makeInvalidByDeletingRunningDs	��
�Lrc��y)z\
        See L{twisted.application.service.IService}.

        @param name: ignored
        N�)rrs  r�setNamezAlmostService.setNameM��rc��y)z^
        See L{twisted.application.service.IService}.

        @param parent: ignored
        Nr )rrs  r�setServiceParentzAlmostService.setServiceParentTr"rc��y�z>
        See L{twisted.application.service.IService}.
        Nr rs r�disownServiceParentz!AlmostService.disownServiceParent[r"rc��yr&r rs r�privilegedStartServicez$AlmostService.privilegedStartService`r"rc��yr&r rs r�startServicezAlmostService.startServiceer"rc��yr&r rs r�stopServicezAlmostService.stopServicejr"r�rN)�__name__�
__module__�__qualname__�__doc__�strr	�boolrrrr�objectr!r$r'r)r+r-r rrrrss���&�S��*<��t��PT��
����F��t���v��$���
�
�
rrc�@�eZdZdZd	d�Zd	d�Zd	d�Zd	d�Zd	d�Zd	d�Z	y)
�ServiceInterfaceTestszK
    Tests for L{twisted.application.service.IService} implementation.
    Nc�*�tddd��|_y)z;
        Build something that implements IService.
        NF)rrr)r�
almostServicers r�setUpzServiceInterfaceTests.setUpus��+�$��D�Q��rc�8�t�}tt|�y)z.
        Service implements IService.
        N)r
rr)r�	myServices  r�test_realServicez&ServiceInterfaceTests.test_realService{s���I�	��X�y�)rc�8�tt|j�y)z4
        AlmostService implements IService.
        N)rrr9rs r�test_hasAllz!ServiceInterfaceTests.test_hasAll�s��	�X�t�1�1�2rc��|jj�|jt�5t	t
|j�ddd�y#1swYyxYw)zI
        AlmostService with no name does not implement IService.
        N)r9r�assertRaisesrrrrs r�test_noNamez!ServiceInterfaceTests.test_noName�sJ��	
���4�4�6�
�
�
�3�
4�	7���4�#5�#5�6�	7�	7�	7���A�Ac��|jj�|jt�5t	t
|j�ddd�y#1swYyxYw)zK
        AlmostService with no parent does not implement IService.
        N)r9rrArrrrs r�
test_noParentz#ServiceInterfaceTests.test_noParent�sJ��	
���6�6�8�
�
�
�3�
4�	7���4�#5�#5�6�	7�	7�	7�rCc��|jj�|jt�5t	t
|j�ddd�y#1swYyxYw)zL
        AlmostService with no running does not implement IService.
        N)r9rrArrrrs r�test_noRunningz$ServiceInterfaceTests.test_noRunning�sJ��	
���7�7�9�
�
�
�3�
4�	7���4�#5�#5�6�	7�	7�	7�rCr.)
r/r0r1r2r:r=r?rBrErGr rrr7r7ps&���R�*�3�7�7�7rr7c��eZdZdZdd�Zy)�ApplicationTestsz?
    Tests for L{twisted.application.service.Application}.
    Nc�Z�td�}|jttt|���|jttt	|���|jtt
t|���|jttt
|���y)zQ
        Check L{twisted.application.service.Application} instantiation.
        zapp-nameN)r�
assertTruerrr	rr)r�apps  r�test_applicationComponentsz+ApplicationTests.test_applicationComponents�sn���*�%������X�x��}�=�>�����%7�9K�C�9P�Q�R�����X�x��}�=�>�����\�<��3D�E�Frr.)r/r0r1r2rMr rrrIrI�s
���	GrrIN)r2�zope.interfacer�zope.interface.exceptionsr�zope.interface.verifyr�twisted.application.servicerrrr	r
�twisted.persisted.sobr�twisted.trial.unittestrrr7rIr rr�<module>rTsd���
'�:�.���/�+�
�X��T�T��T�n.7�H�.7�bG�x�Gr

Zerion Mini Shell 1.0