%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_postfix.cpython-312.pyc

�

Ϫ�fI���dZddlmZmZmZddlmZddlmZddl	m
Z
Gd�de
j�ZGd�d	�Z
Gd
�de
e
j�Zy)
z2
Test cases for twisted.protocols.postfix module.
�)�Dict�List�Tuple)�StringTransport)�postfix)�unittestc��eZdZgd�Zd�Zy)�PostfixTCPMapQuoteTests))�foor)sfoo bars	foo%20bar)sfoo	bars	foo%09bar)sfoo
bars	foo%0Abars	foo%0abar)sfoo
barsfoo%0D%0Abarsfoo%0D%0abarsfoo%0d%0Abarsfoo%0d%0abar)sfoo sfoo%20)s foos%20fooc���|jD]`}|d}|dd}|jtj|�|d�|D]'}|jtj|�|��)�by)Nr�)�data�assertEqualr�quote�unquote)�self�entry�raw�quoted�qs     �;/usr/lib/python3/dist-packages/twisted/test/test_postfix.py�testDataz PostfixTCPMapQuoteTests.testData!sn���Y�Y�	:�E���(�C��1�2�Y�F����W�]�]�3�/����;��
:��� � �����!3�S�9�
:�	:�N)�__name__�
__module__�__qualname__rr�rrr
r
s���D�":rr
c�V�eZdZUiZeeefed<gZee	eefed<d�Z
d�Zd�Zy)�PostfixTCPMapServerTestCaser�chatc��tj|j�}t�}tj�}||_||_|j|�|jD]^\}}|j|�|j|j�|d|�d|�d|j����|j��`|jd�y)z�
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDictServerFactory}.
        zFor z, expected z	 but got N)r�PostfixTCPMapDictServerFactoryrr�PostfixTCPMapServer�service�factory�makeConnectionr �lineReceivedr�value�clear�
setTimeout�rr%�	transport�protocol�input�expected_outputs      r�	test_chatz%PostfixTCPMapServerTestCase.test_chat4s����8�8����C��#�%�	��.�.�0��"���"������	�*�&*�i�i�	�"�E�?��!�!�%�(�������!���/�9�?�?�+<�>�
�
�O�O��	�	���D�!rc���tj|j�}t�}tj�}||_||_|j|�|jD]f\}}|j|�|j|j�|dj|||j���|j��h|jd�y)z�
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDeferringDictServerFactory}.
        z$For {!r}, expected {!r} but got {!r}N)r�'PostfixTCPMapDeferringDictServerFactoryrrr#r$r%r&r r'rr(�formatr)r*r+s      r�test_deferredChatz-PostfixTCPMapServerTestCase.test_deferredChatMs����A�A�$�)�)�L��#�%�	��.�.�0��"���"������	�*�&*�i�i�		�"�E�?��!�!�%�(�������!��6�=�=��?�I�O�O�,=��
�
�O�O��		�	���D�!rc���Gd�d�}tj�}|�|_t�|_|jd�|j
|jj�d�y)z^
        If the factory throws an exception,
        error code 400 must be returned.
        c��eZdZdZd�Zy)�CPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactoryzE
            Factory that raises an error on key lookup.
            c��td��)NzThis is a test error)�	Exception)r�keys  r�getzGPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactory.getrs��� 6�7�7rN)rrr�__doc__r;rrr�ErrorFactoryr7ms��
�
8rr=sget examples400 This is a test error
N)rr#r%rr,r'rr()rr=�servers   r�test_getExceptionz-PostfixTCPMapServerTestCase.test_getExceptiongs^��	8�	8��,�,�.��%����*�,������N�+�����)�)�/�/�1�3P�QrN)
rrrrr�bytes�__annotations__r rrr0r4r?rrrrr+sE�� �D�$�u�e�|�
��'�D�$�u�U�E�\�"�
#��"�2"�4Rrrc��eZdZddd�Zgd�Zy)�
ValidTestss
ThisIs Foos bar really is found
)rsbar)
)sgets&400 Command 'get' takes 1 parameters.
)sget foo bar�500 
)sput�&400 Command 'put' takes 2 parameters.
)sput foorE)sput foo bar baz� 500 put is not implemented yet.
)sput foo barrF)sget foos200 ThisIs%20Foo
)sget bars'200 %20bar%20really%20is%20found%0D%0A
)sget bazrD)rs400 unknown command
N)rrrrr rrrrCrC|s���+��D��DrrCN)r<�typingrrr�twisted.internet.testingr�twisted.protocolsr�
twisted.trialr�TestCaser
rrCrrr�<module>rLsQ���%�$�4�%�"�:�h�/�/�:�8NR�NR�b�,�h�.?�.?�r

Zerion Mini Shell 1.0