HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/test/test_email/__pycache__/test_message.cpython-311.opt-2.pyc
�

��Vc&����ddlZddlZddlmZmZddlmZmZddlm	Z	m
Z
d�ZGd�de	��Ze
Gd�d	����Z
Gd
�de
e	��ZGd�d
e
e	��Zedkrej��dSdS)�N)�policy�message_from_string)�EmailMessage�MIMEPart)�
TestEmailBase�parameterizec�@�ttd�|��d��S)Nc�
�|duS�N�)�xs �0D:\Python311\Lib\test\test_email\test_message.py�<lambda>zfirst.<locals>.<lambda>
s
���$���)�next�filter)�iterables r�firstr	s ����.�.��9�9�4�@�@�@rc�(�eZdZejZd�Zd�ZdS)�Testc��|�d��}d|d<|�t��5d|d<ddd��dS#1swxYwYdS)N�zabc@xyz�Tozxyz@abc)�_str_msg�assertRaises�
ValueError��self�ms  r�+test_error_on_setitem_if_max_count_exceededz0Test.test_error_on_setitem_if_max_count_exceededs����M�M�"������$��
�
�
�z�
*�
*�	 �	 ��A�d�G�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 s�A�A�Ac��ttjd��tj���}|�|dd��|�|dd��|�|t��dS)Na>            Subject: Ayons asperges pour le =?utf-8?q?d=C3=A9jeuner?=
            From: =?utf-8?q?Pep=C3=A9?= Le Pew <pepe@example.com>
            To: "Penelope Pussycat" <"penelope@example.com">
            MIME-Version: 1.0
            Content-Type: text/plain; charset="utf-8"

            sample text
            �r�subjectu Ayons asperges pour le déjeuner�fromuPepé Le Pew <pepe@example.com>)r�textwrap�dedentr�default�assertEqual�assertIsInstancerrs  r�/test_rfc2043_auto_decoded_and_emailmessage_usedz4Test.test_rfc2043_auto_decoded_and_emailmessage_useds������1�!�!� ��
)�
)�
)��	
����9��'I�J�J�J�����6��$E�F�F�F����a��.�.�.�.�.rN)�__name__�
__module__�__qualname__rr'r r*rrrrr
s9������
�^�F� � � �/�/�/�/�/rrc��eZdZejZddddejd��fdddejd��fdddejd	��fdddejd
��fdddejd
��fdddejd��fdddejd��fdddejd��fdddejd��fdddejd��fdddejd��fdddejd��fdddejd��fdddejd��fd �Zd!�Zd"�Z	d#�Z
Gd$�d%��Zd&�Zd'�Z
d(�Zd)�Zd*Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�ZGd1�d2��Zd3�ZGd4�d5��Zd6�Zd7�Zd8�Zd9�Zd:�Zd;S)<�TestEmailMessageBase)�NNrrrrr0rzV                To: foo@example.com

                simple text body
                )NNNz�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: image/jpg

                bogus body.
                )N��)r2r1a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/alternative; boundary="==="

                preamble

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>
                --===--
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                preamble

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===--
                )NNr2)r1a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html
                Content-Disposition: attachment

                <p>simple body</p>

                --===--
                )Nr1N)r2a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain
                Content-Disposition: AtTaChment

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===--
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain
                Content-Disposition: InLine

                simple body

                --===
                Content-Type: text/html
                Content-Disposition: inline

                <p>simple body</p>

                --===--
                )rr2Na�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/related; boundary="==="; type=text/html

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===
                Content-Type: image/jpg
                Content-ID: <image1>

                bogus data

                --===--
                )rr1Na                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/related; boundary="==="; type=text/html;
                 start="<body>"

                --===
                Content-Type: text/html
                Content-ID: <include>

                useless text

                --===
                Content-Type: text/html
                Content-ID: <body>

                <p>simple body</p>
                <!--#include file="<include>"-->

                --===--
                )��r1)��)r2r5r6a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/alternative; boundary="+++"

                --+++
                Content-Type: text/plain

                simple body

                --+++
                Content-Type: multipart/related; boundary="___"

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --___--

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: AttacHmenT

                another bogus jpg body

                --===--
                )r2r4r3a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/related; boundary="+++"

                --+++
                Content-Type: multipart/alternative; boundary="___"

                --___
                Content-Type: text/plain

                simple body

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___--

                --+++
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                another bogus jpg body

                --===--
                )r2NNa�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/related; boundary="+++"

                --+++
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --+++
                Content-Type: multipart/alternative; boundary="___"

                --___
                Content-Type: text/plain

                simple body

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___--

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                another bogus jpg body

                --===--
                z�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: message/rfc822

                To: bar@example.com
                From: robot@examp.com

                this is a message body.
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain

                Your message has bounced, sir.

                --===
                Content-Type: message/rfc822

                To: bar@example.com
                From: robot@examp.com

                this is a message body.

                --===--
                )�
empty_message�non_mime_plain�
mime_non_text�plain_html_alternative�plain_html_mixed�plain_html_attachment_mixed�html_text_attachment_mixed�!html_text_attachment_inline_mixed�related�related_with_start�mixed_alternative_plain_related�$mixed_related_alternative_plain_html�0mixed_related_alternative_plain_html_wrong_order�message_rfc822�mixed_text_message_rfc822c	���
�|�|��}t|������
�
fd�|D��}d}d}d}	|�|���t|����|�|�d���t|����|�|�d���t|||dz�����|�|�d���t||||	g����|�|�d	���t|||	dz�����|�|�d
g���||��|�|�dg���||��|�|�dg���||	��|�|�d
���t||	|dz
d�����|�|�d���t||	||g����|�|�d���t||dd�����|�|�d���t|ddd�����|�|�d���t||||	||g����dS)Nc�(��g|]}|�dn�|��Srr��.0�n�allpartss  �r�
<listcomp>z<TestEmailMessageBase.message_as_get_body.<locals>.<listcomp>�s&���K�K�K�1�A�6�D�D�8�A�;�K�K�Krrr2r1)r?�html�plain)�preferencelist)r?rM)r?rN)rMrNr?rMrN)rNrM���)rNr?)rMr?)rNrMr?)rMrNr?)r�list�walkr(�get_bodyr)r�
body_parts�attachments�parts�msgr�expectedr?rMrNrKs          @r�message_as_get_bodyz(TestEmailMessageBase.message_as_get_body�sZ����M�M�#����������>�>��K�K�K�K�
�K�K�K����A�T�q�u���������u�X���7�7�7�������4D��E�E��x���	*�	*�	*�	
������3F��G�G��x���Q���7�8�8�	:�	:�	:�������3G��H�H���� 1�8�E�?�C�D�D�	F�	F�	F�������3D��E�E��x��U�1�W��5�6�6�	8�	8�	8�������I�;��?�?�!�'�*�	,�	,�	,�������F�8��<�<�h�t�n�M�M�M�������G�9��=�=�x���O�O�O�������3D��E�E��x��d�1�f�R��8�9�9�	;�	;�	;�������3G��H�H������'�1B�C�D�D�	F�	F�	F�������3F��G�G��x���b��1�2�2�	4�	4�	4�������3O��P�P��x���"��~�.�.�	0�	0�	0�������3O��P�P����� (��� (�� 1� 3�4�4�	5�	5�	5�	5�	5rc���|�|��}t|�������fd�|D��}|�t|�����|��dS)Nc� ��g|]
}�|��SrrrHs  �rrLzCTestEmailMessageBase.message_as_iter_attachment.<locals>.<listcomp>�s���8�8�8�q�x��{�8�8�8r)rrQrRr(�iter_attachments)rrTrUrVrWrrKs      @r�message_as_iter_attachmentz/TestEmailMessageBase.message_as_iter_attachment�sp����M�M�#����������>�>��8�8�8�8�K�8�8�8������a�0�0�2�2�3�3�[�A�A�A�A�Arc���d�}|�|��}t|�������fd�|D��}||��r!t|�����ng}|�||��dS)Nc�
�d|vS)NzContent-Type: multipartr)rWs r�_is_multipart_msgzETestEmailMessageBase.message_as_iter_parts.<locals>._is_multipart_msg�s
��,��3�3rc� ��g|]
}�|��SrrrHs  �rrLz>TestEmailMessageBase.message_as_iter_parts.<locals>.<listcomp>�s���,�,�,���!��,�,�,r)rrQrR�
iter_partsr()	rrTrUrVrWr`rrbrKs	        @r�message_as_iter_partsz*TestEmailMessageBase.message_as_iter_parts�s����	4�	4�	4�
�M�M�#����������>�>��,�,�,�,�e�,�,�,��->�->�s�-C�-C�K�T�!�,�,�.�.�)�)�)��
�����U�+�+�+�+�+rc��eZdZd�Zd�ZdS)�(TestEmailMessageBase._TestContentManagerc��|||fSrr�rrW�args�kws    r�get_contentz4TestEmailMessageBase._TestContentManager.get_content�s����b�=� rc�0�||_||_||_dSr)rWrhrirgs    r�set_contentz4TestEmailMessageBase._TestContentManager.set_content�s���D�H��D�I��D�G�G�GrN)r+r,r-rjrlrrr�_TestContentManagerre�s2������	!�	!�	!�	�	�	�	�	rrmc��|�d��}|���}|�|�|���|dif��|�d|dd���\}}}|�||��|�|d��|�|t	dd�	����dS�
Nr��content_managerr�foor2r1)rq�bar�k�rr�rsrt)rrmr(rj�dict)rr�cmrWrhris      r�test_get_content_with_cmz-TestEmailMessageBase.test_get_content_with_cm�s����M�M�"����
�
%�
%�
'�
'��������r��:�:�Q��B�K�H�H�H��
�
�e�R�Q�!�
�L�L�
��T�2�����a� � � �����x�(�(�(�����T�a�1�-�-�-�.�.�.�.�.rc���tj�|������}|�d|���}|�|���|dif��|�ddd���\}}}|�||��|�|d	��|�|tdd�����dS�
Nrprr"rrrr2r1rvru)rr'�clonermrr(rjrw)r�prrWrhris      r�-test_get_content_default_cm_comes_from_policyzBTestEmailMessageBase.test_get_content_default_cm_comes_from_policys����N� � ��1I�1I�1K�1K� �L�L���M�M�"�Q�M�'�'����������1�b�"�+�6�6�6��
�
�e��a�
�8�8�
��T�2�����a� � � �����x�(�(�(�����T�a�1�-�-�-�.�.�.�.�.rc��|�d��}|���}|�|���|�|j|��|�|jd��|�|ji��|�d|dd���|�|j|��|�|jd��|�|jtdd�	����dSro)rrmrlr(rWrhrirw�rrrxs   r�test_set_content_with_cmz-TestEmailMessageBase.test_set_content_with_cm
s����M�M�"����
�
%�
%�
'�
'��	�
�
�b�
�)�)�)�������#�#�#������"�%�%�%�������#�#�#�	�
�
�e�R�Q�!�
�<�<�<�������#�#�#������(�+�+�+��������a� 0� 0� 0�1�1�1�1�1rc�V�|���}tj�|���}|�d|���}|���|�|j|��|�|jd��|�|j	i��|�ddd���|�|j|��|�|jd	��|�|j	tdd�����dSr{)rmrr'r|rrlr(rWrhrirw)rrxr}rs    r�-test_set_content_default_cm_comes_from_policyzBTestEmailMessageBase.test_set_content_default_cm_comes_from_policys��
�
%�
%�
'�
'���N� � �� �4�4���M�M�"�Q�M�'�'��	�
�
����������#�#�#������"�%�%�%�������#�#�#�	�
�
�e��a�
�(�(�(�������#�#�#������(�+�+�+��������a� 0� 0� 0�1�1�1�1�1r))r?�
no_content�succeeds)r?�noner�)r?rNr�)r?r?r)r?�alternative�raises)r?�mixedr�)r�r�r�)r�r�r�)r�rNr�)r�r?r�)r�r�r)r�r�r�)r�r�r�)r�r�r�)r�rNr�)r�r?r�)r�r�r�)r�r�rc��|���}d}ddg}|dkr	|�d��|dkr-d}|�d��|�d��n"|dkrg}|�dd	|zf��|�d
��|�|��|D]
\}}|||<�|||fS)N)rzfoo@bar.com)�Fromzbar@foo.comr�)zX-Random-Header�Corwin�textr)�Content-Type�
text/plainr��
multipart/)zX-Trump�Random)�message�append�set_payload)r�subtyper�payload�msg_headers�name�values       r�_make_subtype_test_messagez/TestEmailMessageBase._make_subtype_test_messageAs���L�L�N�N����!�#����l�"�	*�)����8�9�9�9��f��	I��G����=�>�>�>�
�M�M�"�����
��
$�	I��G������w�0F�G�H�H�H����0�1�1�1�	�
�
�g����&�	�	�K�D�%��A�d�G�G��+�w�&�&rc��|�t��5}t||����ddd��n#1swxYwYt|j��}|�||��|�||��dSr)rr�getattr�str�	exception�assertIn)rr�method_namer��method�ar�exc_texts       r� _check_disallowed_subtype_raisesz5TestEmailMessageBase._check_disallowed_subtype_raisesXs���
�
�
�z�
*�
*�	!�b��G�A�v��� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!��r�|�$�$���
�
�g�x�(�(�(��
�
�k�8�,�,�,�,�,s�A�A�Ac�r�d}|D]M\}}|����d��s!|�|||��|dz
}�N|�t|��|dz��t	|�����}d}|D]M\}}|����d��r!|�|||��|dz
}�N|�t|��|��|�|���|��dS)Nr�content-r2)�lower�
startswithr(�lenrrb�get_payload)rrr�r��countr�r��parts        r�_check_make_multipartz*TestEmailMessageBase._check_make_multipart_s/����&�	�	�K�D�%��:�:�<�<�*�*�:�6�6�
�� � ��4��%�0�0�0���
�������Q����q��)�)�)��A�L�L�N�N�#�#����&�	�	�K�D�%��z�z�|�|�&�&�z�2�2�
�� � ��d��U�3�3�3���
�������T���E�*�*�*�����)�)�+�+�W�5�5�5�5�5rc���|�|��\}}}d|z}|dvr|�||||��dSt||����|�|���d��|�|���|��|dkrh|�t
|�����d��|�|���|dd|zfgz��dS|�t
|�����d��|�	|||��dS)	N�make_�rr��	multipartr�rr�r�r2)
r�r�r�r(�get_content_maintype�get_content_subtyper�r��itemsr�)rr�r��outcomerr�r��make_methods        r�subtype_as_makez$TestEmailMessageBase.subtype_as_makeosx��"&�"A�"A�'�"J�"J���;����&���n�$�	��1�1�!�V�W�k�R�R�R��F����;���!�!�!�����/�/�1�1�;�?�?�?�����.�.�0�0�&�9�9�9��l�"�	@����S������1�1�1�5�5�5����Q�W�W�Y�Y�(�^�-9�&�-@�-B�,C�C�
D�
D�
D�
D�
D�
���S������1�1�1�5�5�5��&�&�q�+�w�?�?�?�?�?rc���|���}|dvrWd|z|d<|�t��5}t|d|z����ddd��n#1swxYwYdS|dkrd|d<n|dkrd|z|d<t|d|z��d�	��|�|�����|�|���d��dS)
Nr�r�r�r�rNr�r��abc)�boundary)r�rrr��
assertTrue�is_multipartr(�get_boundary)rr�r�r�rrxs      r�subtype_as_make_with_boundaryz2TestEmailMessageBase.subtype_as_make_with_boundary�sM���L�L�N�N���n�$�	� ,�w� 6�A�n���"�"�:�.�.�
/�"�,���7�V�+�,�,�.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/��F��g��	7� ,�A�n���
��
$�	7� ,�w� 6�A�n��$���7�V�#�$�$�e�4�4�4�4�������(�(�)�)�)�������)�)�5�1�1�1�1�1s�A#�#A'�*A'c��dD]�}|�|j�d������}d|d<t||����|�|�d��jjd����dS)N)�make_related�make_alternative�
make_mixedrrrpr"r�r�r)r�rr|r�r(r�rq)rr�rs   r�3test_policy_on_part_made_by_make_comes_from_messagezHTestEmailMessageBase.test_policy_on_part_made_by_make_comes_from_message�s���H�	M�	M�F����D�K�$5�$5�e�$5�$L�$L��M�M�A� ,�A�n���G�A�v��� � � ����Q�]�]�1�-�-�4�D�e�L�L�L�L�		M�	Mrc��eZdZd�ZdS)�+TestEmailMessageBase._TestSetContentManagerc�:�d|d<|�|��dS)Nr�r�)r��rrW�contentrhris     rrlz7TestEmailMessageBase._TestSetContentManager.set_content�s$��".�C����O�O�G�$�$�$�$�$rN�r+r,r-rlrrr�_TestSetContentManagerr��s#������	%�	%�	%�	%�	%rr�c���|�|��\}}}|���}|dkrdnd|z}|dkr|�||||��dSt||��d|���|�|���d��|�|���|��||ks|dkrt|�t|�����d	��|D]!\}	}
|�||	|
���"|���d
}nf|�t|�����d��|�	|||��|���d	}|�|�
��d��|�|���d��|dkr|�|d
d��dS|dkr|�|d
d��dS|�|d
��dS)Nr��add_attachment�add_r��testrpr�r�r2rr1r��Content-Disposition�
attachmentr?�inline)r�r�r�r�r(r�r�r�r�r��get_content_type�assertIsNone)rr�r�r�rr�r�rx�
add_methodr�r�r�s            r�subtype_as_addz#TestEmailMessageBase.subtype_as_add�sj��"&�"A�"A�'�"J�"J���;��
�
(�
(�
*�
*��)/���M�%�%�f�v�o�
��h��	��1�1�!�V�W�j�Q�Q�Q��F����:���v�r�:�:�:�:�����/�/�1�1�;�?�?�?�����.�.�0�0�&�9�9�9��W��	&��<� 7�	&����S������1�1�1�5�5�5�*�
1�
1���e�� � ��4��%�0�0�0�0��=�=�?�?�1�%�D�D����S������1�1�1�5�5�5��&�&�q�+�w�?�?�?��=�=�?�?�1�%�D�����.�.�0�0�,�?�?�?�����)�)�+�+�V�4�4�4��7�?�	;����T�"7�8�,�G�G�G�G�G�
�Y�
�	;����T�"7�8�(�C�C�C�C�C�
���d�#8�9�:�:�:�:�:rc��eZdZd�ZdS)�2TestEmailMessageBase._TestSetRaisingContentManagerc� �td���)Nr�)�	Exceptionr�s     rrlz>TestEmailMessageBase._TestSetRaisingContentManager.set_content�s���F�#�#�#rNr�rrr�_TestSetRaisingContentManagerr��s#������	$�	$�	$�	$�	$rr�c�|�|���}|�|j�|������}dD]u}|�t
��5}t
||��d��ddd��n#1swxYwY|�t|j	��d���vdS)Nrpr")�add_related�add_alternativer�rr�)
r�r�rr|rr�r�r(r�r�)rrxrr�r�s     r�6test_default_content_manager_for_add_comes_from_policyzKTestEmailMessageBase.test_default_content_manager_for_add_comes_from_policy�s���
�
/�
/�
1�
1���L�L��� 1� 1�"� 1� E� E�L�F�F��J�	8�	8�F��"�"�9�-�-�
'��"���6�"�"�2�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'����S���.�.��7�7�7�7�	8�	8s�"B�B	�B	c��|�|��}|���|�t|��d��|�t	|�����g��|�|�����|�t	|�����g��dS)Nr)	r�clearr(r�rQr�r�r�rb)rrTrUrVrWrs      r�message_as_clearz%TestEmailMessageBase.message_as_clear�s����M�M�#����	���	�	�	�����Q����#�#�#�����a�g�g�i�i���"�-�-�-����!�-�-�/�/�*�*�*�����a�l�l�n�n�-�-�r�2�2�2�2�2rc��|�|��}d�|���D��}|���|�t	|�����|��|�|�����|�t	|�����g��dS)Nc�`�g|]+}|����d���)|��,S)r�)r�r�)rI�hs  rrLzATestEmailMessageBase.message_as_clear_content.<locals>.<listcomp>�sI��E�E�E�!�#$�7�7�9�9�#7�#7�
�#C�#C�E�A�E�E�Er)r�keys�
clear_contentr(rQr�r�rb)rrTrUrVrWr�expected_headerss       r�message_as_clear_contentz-TestEmailMessageBase.message_as_clear_content�s����M�M�#����E�E�q�v�v�x�x�E�E�E��	����������a�f�f�h�h���)9�:�:�:����!�-�-�/�/�*�*�*�����a�l�l�n�n�-�-�r�2�2�2�2�2rc�D�|���}|�|�����d|d<|�|�����|�dd��|�|�����|�dd��|�|�����|�ddd��|�|�����dS)Nr�r�r��
AtTachMent�filenamezabc.png)�
_make_message�assertFalse�
is_attachment�replace_headerr��	set_paramrs  r�test_is_attachmentz'TestEmailMessageBase.test_is_attachment�s������ � ��������*�*�+�+�+�#+��
� �������*�*�+�+�+�	���.��=�=�=�������)�)�*�*�*�	���.��=�=�=�������)�)�*�*�*�	���J�	�+@�A�A�A�������)�)�*�*�*�*�*rc���|���}|�d��|�d��|�d��|������}|�t
t|�������d��|�|���|��dS)Nzarbitrary text as main partzmore text as a related partz&yet more text as a second "attachment"r1)	r�rlr�r��copyr(r�rQr\)rr�origs   r�test_iter_attachments_mutationz3TestEmailMessageBase.test_iter_attachments_mutation�s������ � ��	�
�
�3�4�4�4�	�
�
�3�4�4�4�	�
�
�>�?�?�?��}�}���#�#�%�%������T�!�"4�"4�"6�"6�7�7�8�8�!�<�<�<���������$�/�/�/�/�/rN)r+r,r-rr'r%r&�message_paramsrYr]rcrmryr~r�r��subtype_paramsr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr/r/&s��������^�F��
����H�O��
�
�	�
����H�O��
�
�	
�
����H�O��
�
�	#�0
����H�O��
�
�	�2
����H�O��
�
�	(�0
����H�O��
�
�	'�0
����H�O��
�
�	.�4
����H�O��
�
�	�6
����H�O��
�
�	�8
����H�O�,�,
�,
�	0,�j
����H�O�,�,
�,
�	01�l
����H�O�,�,
�,
�	0=�f
����H�O�	�	
�	
�	
� 
����H�O��
�
�	&�gL�L�N�\5�5�5�@B�B�B�,�,�,���������/�/�/�/�/�/�
2�
2�
2�2�2�2�&
�N�*'�'�'�.-�-�-�6�6�6� @�@�@�$2�2�2� M�M�M�%�%�%�%�%�%�%�%�
;�;�;�:$�$�$�$�$�$�$�$�8�8�8�3�3�3�3�3�3�
+�
+�
+�0�0�0�0�0rr/c��eZdZeZd�ZGd�d��Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS)�TestEmailMessagec���|�d��}|���}|�d|��|�|���|�|dd��dS�Nr�MIME-Versionrp�1.0)rrm�assertNotInrlr(r�s   r�"test_set_content_adds_MIME_Versionz3TestEmailMessage.test_set_content_adds_MIME_Version�so���M�M�"����
�
%�
%�
'�
'�������+�+�+�	�
�
�b�
�)�)�)�����>�*�E�2�2�2�2�2rc��eZdZd�ZdS)�(TestEmailMessage._MIME_Version_adding_CMc��d|d<dS)Nr�r�rrgs    rrlz4TestEmailMessage._MIME_Version_adding_CM.set_content�s��"'�C����rNr�rrr�_MIME_Version_adding_CMr�s#������	(�	(�	(�	(�	(rrc���|�d��}|���}|�d|��|�|���|�|dd��dSr�)rrr�rlr(r�s   r�0test_set_content_does_not_duplicate_MIME_VersionzATestEmailMessage.test_set_content_does_not_duplicate_MIME_Version�so���M�M�"����
�
)�
)�
+�
+�������+�+�+�	�
�
�b�
�)�)�)�����>�*�E�2�2�2�2�2rc���|�d��}|�t|�����������d��dS�N��Subject: long line ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab

r3�rr(r��	as_string�strip�
splitlinesrs  r�0test_as_string_uses_max_header_length_by_defaultzATestEmailMessage.test_as_string_uses_max_header_length_by_defaultsX���M�M�B�C�C������Q�[�[�]�]�0�0�2�2�=�=�?�?�@�@�!�D�D�D�D�Drc��|�d��}|�t|�d�����������d��|�t|�d�����������d��dS)Nrr)�maxheaderlenr2�"r5r	rs  r�"test_as_string_allows_maxheaderlenz3TestEmailMessage.test_as_string_allows_maxheaderlens����M�M�B�C�C������Q�[�[�a�[�8�8�>�>�@�@�K�K�M�M�N�N��	�	�	�����Q�[�[�b�[�9�9�?�?�A�A�L�L�N�N�O�O��	�	�	�	�	rc��|�d��}|�d��|�|�d���d��|�|�d���d��dS)Nr�z%From foo@bar Thu Jan  1 00:00:00 1970T)�unixfromz+From foo@bar Thu Jan  1 00:00:00 1970

testFz
test)r�set_unixfromr(r
rs  r�test_as_string_unixformz(TestEmailMessage.test_as_string_unixforms~���M�M�&�!�!��	���>�?�?�?�������d��3�3�G�	I�	I�	I�������e��4�4�h�?�?�?�?�?rc���|�d��}|�tt|����������d��dSr)rr(r�r�rrrs  r�+test_str_defaults_to_policy_max_line_lengthz<TestEmailMessage.test_str_defaults_to_policy_max_line_lengthsR���M�M�B�C�C������S��V�V�\�\�^�^�6�6�8�8�9�9�1�=�=�=�=�=rc�r�t��}d|d<|�t|��d��dS)Nuunicöde�SubjectuSubject: unicöde

)rr(r�rs  r�test_str_defaults_to_utf8z*TestEmailMessage.test_str_defaults_to_utf8s7���N�N��!��)������Q���!8�9�9�9�9�9rc�r�t��}d|d<|�t|��d��dS)NuDHello Wörld! Hello Wörld! Hello Wörld! Hello Wörld!Hello Wörld!rs|Subject: Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rld!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

�rr(�bytesrs  r�!test_folding_with_utf8_encoding_1z2TestEmailMessage.test_folding_with_utf8_encoding_1sN��
�N�N��B��)������q���P�	Q�	Q�	Q�	Q�	Qrc�r�t��}d|d<|�t|��d��dS)NuHHello Wörld! Hello Wörld! Hello Wörlds123! Hello Wörld!Hello Wörld!rs�Subject: Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rlds123!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

rrs  r�!test_folding_with_utf8_encoding_2z2TestEmailMessage.test_folding_with_utf8_encoding_2/sN��
�N�N��F��)������q���P�	Q�	Q�	Q�	Q�	Qrc�r�t��}d|d<|�t|��d��dS)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123! Hello Wörld!Hello Wörld!rs�Subject: =?utf-8?q?Hello-W=C3=B6rld!-Hello-W=C3=B6rld!-Hello-W=C3=B6rlds123!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

rrs  r�!test_folding_with_utf8_encoding_3z2TestEmailMessage.test_folding_with_utf8_encoding_3?sM��
�N�N��4��)������q���P�	Q�	Q�	Q�	Q�	Qrc�r�t��}d|d<|�t|��d��dS)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123!-Hello Wörld!Hello Wörld!rs�Subject: =?utf-8?q?Hello-W=C3=B6rld!-Hello-W=C3=B6rld!-Hello-W=C3=B6rlds123!?=
 =?utf-8?q?-Hello_W=C3=B6rld!Hello_W=C3=B6rld!?=

rrs  r�!test_folding_with_utf8_encoding_4z2TestEmailMessage.test_folding_with_utf8_encoding_4OsM��
�N�N��/��)������q���Q�	R�	R�	R�	R�	Rrc�r�t��}d|d<|�t|��d��dS)NuS123456789 123456789 123456789 123456789 123456789 123456789 123456789 Hello Wörld!rsoSubject: 123456789 123456789 123456789 123456789 123456789 123456789 123456789
 Hello =?utf-8?q?W=C3=B6rld!?=

rrs  r�!test_folding_with_utf8_encoding_5z2TestEmailMessage.test_folding_with_utf8_encoding_5_sL��
�N�N��<��)������q���?�	@�	@�	@�	@�	@rc�r�t��}d|d<|�t|��d��dS)Nuq123456789 123456789 123456789 123456789 Hello Wörld! 123456789 123456789 123456789 123456789 123456789 123456789rs�Subject: 123456789 123456789 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!?=
 123456789 123456789 123456789 123456789 123456789 123456789

rrs  r�!test_folding_with_utf8_encoding_6z2TestEmailMessage.test_folding_with_utf8_encoding_6msI��
�N�N��$��)��	
����q���*�	+�	+�	+�	+�	+rc�r�t��}d|d<|�t|��d��dS)Nuo123456789 123456789 Hello Wörld! Hello Wörld! 123456789-123456789 123456789 Hello Wörld! 123456789 123456789rs�Subject: 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!?=
 123456789-123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!?= 123456789
 123456789

rrs  r�!test_folding_with_utf8_encoding_7z2TestEmailMessage.test_folding_with_utf8_encoding_7}sO��
�N�N��$��)��	
����q���N�	O�	O�	O�	O�	Orc�r�t��}d|d<|�t|��d��dS)Nu�123456789 123456789 Hello Wörld! Hello Wörld! 123456789 123456789 123456789 123456789 123456789 123456789-123456789 123456789 Hello Wörld! 123456789 123456789rs�Subject: 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!?=
 123456789 123456789 123456789 123456789 123456789 123456789-123456789
 123456789 Hello =?utf-8?q?W=C3=B6rld!?= 123456789 123456789

rrs  r�!test_folding_with_utf8_encoding_8z2TestEmailMessage.test_folding_with_utf8_encoding_8�sO��
�N�N��$��)��	
����q���L�	M�	M�	M�	M�	Mrc��	tjd��}|�|��}|���dS)Na'            Message-ID: <674392CA.4347091@email.au>
            Date: Wed, 08 Nov 2017 08:50:22 +0700
            From: Foo Bar <email@email.au>
            MIME-Version: 1.0
            To: email@email.com <email@email.com>
            Subject: Python Email
            Content-Type: multipart/mixed;
            boundary="------------879045806563892972123996"
            X-Global-filter:Messagescannedforspamandviruses:passedalltests

            This is a multi-part message in MIME format.
            --------------879045806563892972123996
            Content-Type: text/plain; charset=ISO-8859-1; format=flowed
            Content-Transfer-Encoding: 7bit

            Your message is ready to be sent with the following file or link
            attachments:
            XU89 - 08.11.2017
            )r%r&rrS)rrWrs   r�test_get_body_malformedz(TestEmailMessage.test_get_body_malformed�sA�� ��o�����(
�M�M�#����	
�
�
�����rN)r+r,r-rr�r�rrr
rrrrrr r"r$r&r(r*r,r.rrrr�r��sL�������G�3�3�3�(�(�(�(�(�(�(�(�3�3�3�E�E�E����@�@�@�>�>�>�:�:�:�
Q�Q�Q�"Q�Q�Q� Q�Q�Q� R�R�R� @�@�@�+�+�+� O�O�O�"M�M�M�(����rr�c��eZdZeZd�Zd�ZdS)�TestMIMEPartc���|�d��}|���}|�d|��|�|���|�d|��dS)Nrr�rp)rrmr�rlr�s   r�*test_set_content_does_not_add_MIME_Versionz7TestMIMEPart.test_set_content_does_not_add_MIME_Version�sj���M�M�"����
�
%�
%�
'�
'�������+�+�+�	�
�
�b�
�)�)�)������+�+�+�+�+rc���ttjd��tj���}|���}|�t|��g��dS)NzT        Content-Type: multipart/mixed; charset="utf-8"

        sample text
        r")rr%r&rr'r\r(rQ)rrWrUs   r�/test_string_payload_with_multipart_content_typez<TestMIMEPart.test_string_payload_with_multipart_content_type�sg��!�(�/�3�#
�#
��^�	%�%�%��
�*�*�,�,������k�*�*�B�/�/�/�/�/rN)r+r,r-rr�r2r4rrrr0r0�s9�������G�,�,�,�0�0�0�0�0rr0�__main__)�unittestr%�emailrr�
email.messagerr�test.test_emailrrrrr/r�r0r+�mainrrr�<module>r;se����������-�-�-�-�-�-�-�-�0�0�0�0�0�0�0�0�7�7�7�7�7�7�7�7�A�A�A�/�/�/�/�/�=�/�/�/�2�D0�D0�D0�D0�D0�D0�D0���D0�NM�M�M�M�M�+�]�M�M�M�`0�0�0�0�0�'��0�0�0�.�z����H�M�O�O�O�O�O��r