Your IP : 216.73.216.196


Current Path : /opt/alt/python312/lib64/python3.12/test/test_email/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/test/test_email/__pycache__/test_inversion.cpython-312.pyc

�

�#�j����dZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZmZd�Z
eGd�d	e��Zed
k(rej �yy)z�Test the parser and generator are inverses.

Note that this is only strictly true if we are parsing RFC valid messages and
producing RFC valid messages.
�N)�policy�message_from_bytes)�EmailMessage)�BytesGenerator)�
TestEmailBase�parameterizec�"�|j�}|dj�std��t|d�t|dj	��z
}dj|D�cgc]}t|�|k\r||dnd��c}�Scc}w)NrzFirst line must contain texts
�)�
splitlines�strip�
ValueError�len�lstrip�join)�bstr�lines�stripamt�xs    �E/opt/alt/python312/lib64/python3.12/test/test_email/test_inversion.py�dedentrs����O�O��E���8�>�>���7�8�8��5��8�}�s�5��8�?�?�#4�5�5�H��<�<��	����Q���)��8�9��s�	2��	����	s�)Bc��eZdZejZeZd�Zed�fed�fd�Z	e
d��e
dd�	�e
dd
�	�d�Zd�Zy
)�
TestInversionc���t|tj��}tj�}t|�}|j
|�|j|j�|�y)N�r)	rr�SMTP�io�BytesIOr�flatten�assertEqual�getvalue)�self�msg�m�b�gs     r�msg_as_inputzTestInversion.msg_as_input sH���s�6�;�;�7���J�J�L���1���	�	�	�!���������s�+r
sl            From: abc@xyz.com
            X-Status: 
            Subject: test

            foo
            s�            Date: Tue, 06 Jun 2017 27:39:33 +0600
            From: abc@xyz.com
            Subject: timezones

            How do they work even?
            )�header_with_one_space_body�header_with_invalid_datea,This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
This is a test
)�payloada%xy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy a
xy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy a
xy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy a
xy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy a
xy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy axy a
�base64)r)�ctezquoted-printable)�
plain_text�base64_text�qp_textc�"�|j�}d|d<d|d<d|d<|j|fi|��t|�}t||j��}|jt|�|�|j|j
�|�y)N�foo�From�bar�Tozpayload round trip test�Subjectr)�
_make_message�set_content�bytesrrr�get_content)r!r)�kwr"r$�msg2s      r�payload_as_bodyzTestInversion.payload_as_bodyAs���� � �"����F����D�	�2��I�������&�2�&��#�J��!�!�D�K�K�8������t��a�(�����)�)�+�W�5r
N)
�__name__�
__module__�__qualname__r�defaultr�messager&r�
msg_params�dict�payload_paramsr;�r
rrrst���^�^�F��G�,�(.�/�(�'�&,�-�&�%��J�(�#8�9��%7�h�G��!3�:L�M�
�N�	6r
r�__main__)�__doc__r�unittest�emailrr�
email.messager�email.generatorr�test.test_emailrrrrr<�mainrDr
r�<module>rMsY���
��,�&�*�7���/6�M�/6��/6�d�z���H�M�M�O�r