%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/test/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_factories.cpython-312.pyc |
� Ϫ�f� � �b � d Z ddlZddlmZmZ ddlmZ ddlmZ G d� d� Z G d� d e� Z y) z& Test code for basic Factory classes. � N)�Protocol�ReconnectingClientFactory)�Clock)�TestCasec � � e Zd ZdZd� Zd� Zy)� FakeConnectorzP A fake connector class, to be used to mock connections failed or lost. c � � y �N� ��selfs �=/usr/lib/python3/dist-packages/twisted/test/test_factories.py�stopConnectingzFakeConnector.stopConnecting � � �� c � � y r r r s r �connectzFakeConnector.connect r r N)�__name__� __module__�__qualname__�__doc__r r r r r r r s � �� � r r c �4 � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z y) �ReconnectingFactoryTestsz1 Tests for L{ReconnectingClientFactory}. c �� � G d� d� }t � }t |_ |j d� |j � |j |� d� | j |j � y)z� If a L{ReconnectingClientFactory} has C{stopTrying} called while it is connected, it does not subsequently attempt to reconnect if the connection is later lost. c � � e Zd Zd� Zd� Zy)�QReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnectorc � � t d� �)Nz%Shouldn't be called, we're connected.��RuntimeErrorr s r r z`ReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnector.stopConnecting) s � �"�#J�K�Kr c � � t d� �)NzShouldn't be reconnecting.r r s r r zYReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnector.connect, s � �"�#?�@�@r N)r r r r r r r r �NoConnectConnectorr ( s � � L� Ar r! N)r r �protocol� buildProtocol� stopTrying�clientConnectionLost�assertFalse�continueTrying)r r! �cs r �test_stopTryingWhenConnectedz5ReconnectingFactoryTests.test_stopTryingWhenConnected! s\ � � A� A� &�'���� � ����� ���� ���1�3�T�:�����)�)�*r c �. �� G �fd�dt � }t � �t � �_ |� �_ �j � | j �j j � | j �j j � � y)z Calling stopTrying on a L{ReconnectingClientFactory} doesn't attempt a retry on any active connector. c �"