%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f�0��z�dddZddlmZddlmZGd�d�ZGd�d	�ZGd
�de�ZGd�d
ej�Z	Gd�d�Z
Gd�d�ZGd�de
ej�ZGd�de
ej�Z
Gd�deej�ZGd�deej�ZGd�dej�ZGd�dej�ZGd�d�ZGd �d!eej�ZGd"�d#eej�ZGd$�d%ej�ZGd&�d'ej�Zy())z$Revision: 1.5 $�����)�pcp)�unittestc�"�eZdZdZd�Zd�Zd�Zy)�DummyTransportz A dumb transport to wrap around.c��g|_y�N)�_writes��selfs �7/usr/lib/python3/dist-packages/twisted/test/test_pcp.py�__init__zDummyTransport.__init__%s	�����c�:�|jj|�yr
)r�append�r
�datas  r�writezDummyTransport.write(s�������D�!rc�8�dj|j�S)N�)�joinrrs r�getvaluezDummyTransport.getvalue+s���w�w�t�|�|�$�$rN)�__name__�
__module__�__qualname__�__doc__rrr�rrrr"s��*��"�%rrc�0�eZdZdZdZdZd�Zd�Zd�Zd�Z	y)�
DummyProducerFc��||_yr
)�consumer)r
r"s  rrzDummyProducer.__init__4s	�� ��
rc� �d|_d|_y)NTF)�resumed�pausedrs r�resumeProducingzDummyProducer.resumeProducing7s�������rc��d|_y�NT)r%rs r�pauseProducingzDummyProducer.pauseProducing;s	����rc��d|_yr()�stoppedrs r�
stopProducingzDummyProducer.stopProducing>s	����rN)
rrrr$r+r%rr&r)r,rrrr r /s%���G��G�
�F�!���rr c�*�eZdZdZdZdZd�Zd�Zd�Zy)�
DummyConsumerNFTc��||f|_yr
)�producer)r
r0�	streamings   r�registerProducerzDummyConsumer.registerProducerGs��!�9�-��
rc��d|_yr()�unregisteredrs r�unregisterProducerz DummyConsumer.unregisterProducerJs
�� ��rc��d|_yr()�finishedrs r�finishzDummyConsumer.finishMs	����
r)	rrrr0r7r4r2r5r8rrrr.r.Bs ���H��H��L�.�!�rr.c�0�eZdZejZd�Zd�Zy)�TransportInterfaceTestsc�b�t�|_|j|j�|_yr
)r.�
underlying�
proxyClass�	transportrs r�setUpzTransportInterfaceTests.setUpTs��'�/���������9��rc�:�|jjd�y�Nz
some bytes)r>rrs r�	testWritez!TransportInterfaceTests.testWriteXs�������\�*rN)rrrr�BasicProducerConsumerProxyr=r?rBrrrr:r:Qs���/�/�J�:�+rr:c�(�eZdZdZd�Zd�Zd�Zd�Zy)�ConsumerInterfaceTestz�Test ProducerConsumerProxy as a Consumer.

    Normally we have ProducingServer -> ConsumingTransport.

    If I am to go between (Server -> Shaper -> Transport), I have to
    play the role of Consumer convincingly for the ProducingServer.
    c��t�|_|j|j�|_t	|j�|_yr
)r.r<r=r"r r0rs rr?zConsumerInterfaceTest.setUpes/��'�/���������8��
�%�d�m�m�4��
rc��|jj|jd�|j|jj�yr()r"r2r0�assertFalser$rs r�testRegisterPushz&ConsumerInterfaceTest.testRegisterPushjs2���
�
�&�&�t�}�}�d�;�������.�.�/rc�$�|jj|jd�|jj�d|j_|jj�|j
|jj�y�NF)r"r2r0r5r$r&rHrs r�testUnregisterz$ConsumerInterfaceTest.testUnregistervs`���
�
�&�&�t�}�}�e�<��
�
�(�(�*�
!&��
�
���
�
�%�%�'�������.�.�/rc�$�|jj|jd�|jj�d|j_|jj�|j
|jj�yrK)r"r2r0r8r$r&rHrs r�
testFinishz ConsumerInterfaceTest.testFinish�s^���
�
�&�&�t�}�}�e�<��
�
���� %��
�
���
�
�%�%�'�������.�.�/rN)rrrrr?rIrLrNrrrrErE\s���5�
0�	0�0rrEc�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�ProducerInterfaceTestz�Test ProducerConsumerProxy as a Producer.

    Normally we have ProducingServer -> ConsumingTransport.

    If I am to go between (Server -> Shaper -> Transport), I have to
    play the role of Producer convincingly for the ConsumingTransport.
    c�b�t�|_|j|j�|_yr
)r.r"r=r0rs rr?zProducerInterfaceTest.setUp�s��%���
�����
�
�6��
rc�j�|j|jjd|j�y)Nr)�assertEqualr"r0rs r�testRegistersProducerz+ProducerInterfaceTest.testRegistersProducer�s%��������/�/��2�D�M�M�Brc���|jj�|jjd�|j|jj�d�y)N�yakkity yakz*Paused producer should not have sent data.)r0r)rrHr"rrs r�	testPausezProducerInterfaceTest.testPause�sE���
�
�$�$�&��
�
���M�*�����M�M�"�"�$�&R�	
rc��|jj�|jj�|jjd�|j	|j
j
�d�y)NrV)r0r)r&rrSr"rrs r�
testResumez ProducerInterfaceTest.testResume�sQ���
�
�$�$�&��
�
�%�%�'��
�
���M�*�������/�/�1�=�Arc���|jj�|jj�|jt	|j
j�dd�y)Nrz Resume triggered an empty write.)r0r)r&rS�lenr"rrs r�testResumeNoEmptyWritez,ProducerInterfaceTest.testResumeNoEmptyWrite�sG���
�
�$�$�&��
�
�%�%�'������
�
�%�%�&��+M�	
rc��|jj�|jjd�|jj�|j	|j
j
�d�y)Nzbuffer this)r0r)rr&rSr"rrs r�testResumeBufferz&ProducerInterfaceTest.testResumeBuffer�sQ���
�
�$�$�&��
�
���M�*��
�
�%�%�'�������/�/�1�=�Arc���|jj�|jjd�|j|jj�d�y)NrVz+Stopped producer should not have sent data.)r0r,rrHr"rrs r�testStopzProducerInterfaceTest.testStop�sE���
�
�#�#�%��
�
���M�*�����M�M�"�"�$�&S�	
rN)rrrrr?rTrWrYr\r^r`rrrrPrP�s-���7�C�
�B�
�B�
rrPc�$�eZdZejZy)�PCP_ConsumerInterfaceTestsN�rrrrrCr=rrrrbrb��
���/�/�Jrrbc�$�eZdZejZy)�PCPII_ConsumerInterfaceTestsN�rrrr�ProducerConsumerProxyr=rrrrfrf��
���*�*�Jrrfc�$�eZdZejZy)�PCP_ProducerInterfaceTestsNrcrrrrkrk�rdrrkc�$�eZdZejZy)�PCPII_ProducerInterfaceTestsNrgrrrrmrm�rirrmc�4�eZdZdZej
Zd�Zd�Zy)�ProducerProxyTestszAProducer methods on me should be relayed to the Producer I proxy.c��|jd�|_t|j�|_|jj	|jd�yr()r=�proxyr �parentProducerr2rs rr?zProducerProxyTests.setUp�s=���_�_�T�*��
�+�D�J�J�7����
�
�#�#�D�$7�$7��>rc��|jj�|j|jj�yr
)rqr,�
assertTruerrr+rs rr`zProducerProxyTests.testStop�s*���
�
� � �"�����+�+�3�3�4rN)	rrrrrrCr=r?r`rrrroro�s��K��/�/�J�?�
5rroc�@�eZdZdZej
Zd�Zd�Zd�Z	d�Z
y)�ConsumerProxyTestszAConsumer methods on me should be relayed to the Consumer I proxy.c�b�t�|_|j|j�|_yr
)r.r<r=r"rs rr?zConsumerProxyTests.setUp�s��'�/���������8��
rc��|jjd�|j|jj	�d�yrA)r"rrSr<rrs rrBzConsumerProxyTests.testWrite�s1���
�
���L�)�������1�1�3�\�Brc��|jj�|j|jj�yr
)r"r8rtr<r7rs rrNzConsumerProxyTests.testFinish�s(���
�
����������0�0�1rc��|jj�|j|jj�yr
)r"r5rtr<r4rs rrLz!ConsumerProxyTests.testUnregister�s(���
�
�(�(�*�������4�4�5rN)rrrrrrCr=r?rBrNrLrrrrvrv�s%��K��/�/�J�9�C�
2�6rrvc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�PullProducerTestc���t�|_|j|j�|_t	|j�|_|jj
|j
d�yr()r.r<r=rqr rrr2rs rr?zPullProducerTest.setUp�sJ��'�/����_�_�T�_�_�5��
�+�D�J�J�7����
�
�#�#�D�$7�$7��>rc��|jjd�|j|jj	�d�y)N�helloz+Pulling Consumer got data before it pulled.)rqrrHr<rrs r�testHoldWriteszPullProducerTest.testHoldWrites�s5���
�
����!�����O�O�$�$�&�(U�	
rc���|jjd�|jj�|j|jj�d�y)Nr)rqrr&rSr<rrs r�testPullzPullProducerTest.testPullsA���
�
����!��
�
�"�"�$�������1�1�3�W�=rc�d�|jjd�|jjd�|jj�t|jj
�}|j
|dd|fz�|j
|jj�d�y)Nzhello �sunshine�z(Pull resulted in %d writes instead of 1.zhello sunshine)rqrr&r[r<rrSr)r
�nwritess  r�testMergeWritesz PullProducerTest.testMergeWritess����
�
����"��
�
����$��
�
�"�"�$��d�o�o�-�-�.������Q�E��
�R�	
�	
������1�1�3�5E�Frc���|jj�|jjd�|j|jj�d�y)Nr)rqr&rrSr<rrs r�
testLateWritezPullProducerTest.testLateWritesA���
�
�"�"�$��
�
���� �������1�1�3�V�<rN)rrrr?r�r�r�r�rrrr|r|�s��?�
�>�
G�=rr|c�6�eZdZGd�dej�Zy)�PCP_PullProducerTestsc��eZdZdZy)� PCP_PullProducerTests.proxyClassFN�rrr�iAmStreamingrrrr=r�����rr=Nrcrrrr�r�s���S�3�3�rr�c�6�eZdZGd�dej�Zy)�PCPII_PullProducerTestsc��eZdZdZy)�"PCPII_PullProducerTests.proxyClassFNr�rrrr=r�r�rr=Nrgrrrr�r�s���S�.�.�rr�c�L�eZdZdZej
Zd�Zd�Zd�Z	d�Z
d�Zd�Zy)	�BufferedConsumerTestsz=As a consumer, ask the producer to pause after too much data.c��t�|_|j|j�|_d|j_t|j�|_|jj|jd�y)N�dT�r.r<r=rq�
bufferSizer rrr2rs rr?zBufferedConsumerTests.setUp)sV��'�/����_�_�T�_�_�5��
� #��
�
��+�D�J�J�7����
�
�#�#�D�$7�$7��>rc��|jj|jd�|j|jj�yrK)rqr2rrrtr$rs r�testRegisterPullz&BufferedConsumerTests.testRegisterPull1s4���
�
�#�#�D�$7�$7��?�����+�+�3�3�4rc��|jj�|j|jj�yr
)rqr)rHrrr%rs r�testPauseInterceptz(BufferedConsumerTests.testPauseIntercept6s,���
�
�!�!�#�����,�,�3�3�4rc��|jj�|jj�|j|jj
�yr
)rqr)r&rHrrr$rs r�testResumeInterceptz)BufferedConsumerTests.testResumeIntercept:s>���
�
�!�!�#��
�
�"�"�$�	
����,�,�4�4�5rc��|jj�|j|jjd�|jjd�|j|jjd�|jjd�|j
|jj�y)zMake sure I say "when." zdon't pause yet�3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxN)rqr)rHrrr%rrtrs r�testTriggerPausez&BufferedConsumerTests.testTriggerPauseBs���	
�
�
�!�!�#�����,�,�3�3�5F�G��
�
����"�����,�,�3�3�5F�G��
�
����"�����+�+�2�2�3rc��|jj�|jjd�|j|jj
d�|jj
�|j|jj
d�|j|jj�y)z3Make sure I resumeProducing when my buffer empties.�fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzshould be pausedzProducer should have resumed.N)	rqr)rrtrrr%r&rH�producerPausedrs r�testTriggerResumez'BufferedConsumerTests.testTriggerResumeMs����
�
�!�!�#��
�
����#�����+�+�2�2�4F�G��
�
�"�"�$�	
����,�,�3�3�5T�U�������2�2�3rN)
rrrrrrhr=r?r�r�r�r�r�rrrr�r�$s.��G��*�*�J�?�5�
5�6�	4�	4rr�c�H�eZdZGd�dej�Zd�Zd�Zd�Zy)�BufferedPullTestsc��eZdZdZd�Zy)�BufferedPullTests.proxyClassFc�r�tjj||dd�tt	|�d�S)Nr�)rrh�_writeSomeData�minr[rs  rr�z+BufferedPullTests.proxyClass._writeSomeData]s/���%�%�4�4�T�4���:�F��s�4�y�#�&�&rN)rrrr�r�rrrr=r�Zs����	'rr=c��t�|_|j|j�|_d|j_t|j�|_|jj|jd�y)Nr�Fr�rs rr?zBufferedPullTests.setUpasV��'�/����_�_�T�_�_�5��
� #��
�
��+�D�J�J�7����
�
�#�#�D�$7�$7��?rc��d|j_|jj�|j	|jj�yrK)rrr$rqr&rtrs r�testResumePullz BufferedPullTests.testResumePullis:��',����#��
�
�"�"�$�����+�+�3�3�4rc��|jj�|jjd�|j|jj�d�|j|jjdg�y)N�idatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatum�ddatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatumdatum�datum)rqr&rrSr<r�_bufferrs r�testLateWriteBufferingz(BufferedPullTests.testLateWriteBufferingps]���
�
�"�"�$��
�
����&�������1�1�3�\�B�������+�+�g�Y�7rN)	rrrrrhr=r?r�r�rrrr�r�Ys$��'�S�.�.�'�@�5�8rr�N)�__version__�twisted.protocolsr�
twisted.trialrrr r.�TestCaser:rErPrbrfrkrmrorvr|r�r�r�r�rrr�<module>r�s3��!��B�'��!�"�2
%�
%���&�N��+�h�/�/�+�+0�+0�\/
�/
�d0�!6��8I�8I�0�+�#8�(�:K�:K�+�0�!6��8I�8I�0�+�#8�(�:K�:K�+�5��*�*�5�6��*�*�6�."=�"=�J�,�h�.?�.?��
�.��0A�0A��24�H�-�-�24�j8��)�)�8r

Zerion Mini Shell 1.0