HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/test_email/__pycache__/test_message.cpython-37.pyc
B

��g/��@s�ddlZddlZddlmZmZddlmZmZddlm	Z	m
Z
dd�ZGdd�de	�Ze
Gd	d
�d
��Z
Gdd�de
e	�ZGd
d�de
e	�Zedkr�e��dS)�N)�policy�message_from_string)�EmailMessage�MIMEPart)�
TestEmailBase�parameterizecCsttdd�|�d�S)NcSs|dk	S)N�)�xrr�8/usr/local/lib/python3.7/test/test_email/test_message.py�<lambda>
�zfirst.<locals>.<lambda>)�next�filter)�iterablerrr
�first	src@s"eZdZejZdd�Zdd�ZdS)�Testc	Cs4|�d�}d|d<|�t��d|d<WdQRXdS)N�zabc@xyz�Tozxyz@abc)�_str_msg�assertRaises�
ValueError)�self�mrrr
�+test_error_on_setitem_if_max_count_exceededs
z0Test.test_error_on_setitem_if_max_count_exceededcCsDtt�d�tjd�}|�|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
            )rZsubjectu Ayons asperges pour le déjeuner�fromuPepé Le Pew <pepe@example.com>)r�textwrap�dedentr�default�assertEqualZassertIsInstancer)rrrrr
�/test_rfc2043_auto_decoded_and_emailmessage_useds
z4Test.test_rfc2043_auto_decoded_and_emailmessage_usedN)�__name__�
__module__�__qualname__rrrrrrrr
r
src@s�eZdZejZdddde�d�fddde�d�fddde�d	�fddde�d
�fddde�d
�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fd �Zd!d"�Zd#d$�Z	d%d&�Z
Gd'd(�d(�Zd)d*�Zd+d,�Z
d-d.�Zd/d0�Zd1Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�ZGd>d?�d?�Zd@dA�ZGdBdC�dC�ZdDdE�ZdFdG�ZdHdI�ZdJdK�ZdLdM�ZdNS)O�TestEmailMessageBase))NNrrrr)NNrrzV                To: foo@example.com

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

                bogus body.
                )N��)r%r$a�                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>

                --===--
                )NNr%)r$a�                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>

                --===--
                )Nr$N)r%a�                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>

                --===--
                )rr%Na�                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

                --===--
                )rr$Na                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>"-->

                --===--
                )��r$)��)r%r(r)a�                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

                --===--
                )r%r'r&a�                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

                --===--
                )r%NNa�                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, ser.

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

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

                this is a message body.

                --===--
                )Z
empty_messageZnon_mime_plainZ
mime_non_textZplain_html_alternativeZplain_html_mixedZplain_html_attachment_mixedZhtml_text_attachment_mixedZ!html_text_attachment_inline_mixed�relatedZrelated_with_startZmixed_alternative_plain_relatedZ$mixed_related_alternative_plain_htmlZ0mixed_related_alternative_plain_html_wrong_orderZmessage_rfc822Zmixed_text_message_rfc822c
s�|�|�}t|�����fdd�|D�}d}d}d}	|�|��t|��|�|jdd�t|��|�|jdd�t|||d���|�|jd	d�t||||	g��|�|jd
d�t|||	d���|�|jdgd�||�|�|jdgd�||�|�|jd
gd�||	�|�|jdd�t||	|dd���|�|jdd�t||	||g��|�|jdd�t||dd���|�|jdd�t|ddd���|�|jdd�t||||	||g��dS)Ncs g|]}|dkrdn�|�qS)Nr)�.0�n)�allpartsrr
�
<listcomp>�sz<TestEmailMessageBase.message_as_get_body.<locals>.<listcomp>rr%r$)r*�html�plain)Zpreferencelist)r*r/)r*r0)r/r0r*r/r0)r0r/���)r0r*)r/r*)r0r/r*)r/r0r*)r�list�walkrZget_bodyr)
r�
body_parts�attachments�parts�msgrZexpectedr*r/r0r)r-r
�message_as_get_body�s@


z(TestEmailMessageBase.message_as_get_bodycs@|�|�}t|�����fdd�|D�}|�t|���|�dS)Ncsg|]}�|�qSrr)r+r,)r-rr
r.�szCTestEmailMessageBase.message_as_iter_attachment.<locals>.<listcomp>)rr2r3r�iter_attachments)rr4r5r6r7rr)r-r
�message_as_iter_attachment�s
z/TestEmailMessageBase.message_as_iter_attachmentcs@|�|�}t|�����fdd�|D�}|�t|���|�dS)Ncsg|]}�|�qSrr)r+r,)r-rr
r.�sz>TestEmailMessageBase.message_as_iter_parts.<locals>.<listcomp>)rr2r3r�
iter_parts)rr4r5r6r7rr)r-r
�message_as_iter_parts�s
z*TestEmailMessageBase.message_as_iter_partsc@seZdZdd�Zdd�ZdS)z(TestEmailMessageBase._TestContentManagercOs
|||fS)Nr)rr7�args�kwrrr
�get_content�sz4TestEmailMessageBase._TestContentManager.get_contentcOs||_||_||_dS)N)r7r=r>)rr7r=r>rrr
�set_content�sz4TestEmailMessageBase._TestContentManager.set_contentN)r r!r"r?r@rrrr
�_TestContentManager�srAcCst|�d�}|��}|�|j|d�|dif�|jd|ddd�\}}}|�||�|�|d�|�|tddd	��dS)
Nr)�content_managerr�foor%r$)rB�bar�k)rC)rDrE)rrArr?�dict)rr�cmr7r=r>rrr
�test_get_content_with_cm�s
z-TestEmailMessageBase.test_get_content_with_cmcCs|tjj|��d�}|jd|d�}|�|��|dif�|jdddd�\}}}|�||�|�|d	�|�|tddd��dS)
N)rBr)rrrCr%r$)rDrE)rC)rr�clonerArrr?rF)r�prr7r=r>rrr
�-test_get_content_default_cm_comes_from_policyszBTestEmailMessageBase.test_get_content_default_cm_comes_from_policycCs�|�d�}|��}|j|d�|�|j|�|�|jd�|�|ji�|jd|ddd�|�|j|�|�|jd�|�|jtddd	��dS)
Nr)rBrrCr%r$)rBrDrE)rC)rDrE)rrAr@rr7r=r>rF)rrrGrrr
�test_set_content_with_cm	s
z-TestEmailMessageBase.test_set_content_with_cmcCs�|��}tjj|d�}|jd|d�}|��|�|j|�|�|jd�|�|j	i�|jdddd�|�|j|�|�|jd	�|�|j	t
ddd��dS)
N)rBr)rrrCr%r$)rDrE)rC)rArrrIrr@rr7r=r>rF)rrGrJrrrr
�-test_set_content_default_cm_comes_from_policyszBTestEmailMessageBase.test_set_content_default_cm_comes_from_policy))r*�
no_content�succeeds)r*�nonerO)r*r0rO)r*r*r)r*�alternative�raises)r*�mixedrR)rQrNrO)rQrPrO)rQr0rO)rQr*rO)rQrQr)rQrSrR)rSrNrO)rSrPrO)rSr0rO)rSr*rO)rSrQrO)rSrSrcCs�|��}d}ddg}|dkr|�d�|dkrHd}|�d�|�d�n|dkrfg}|�dd	|f�|�d
�|�|�x|D]\}}|||<q�W|||fS)N)rzfoo@bar.com)ZFromzbar@foo.comrN)zX-Random-HeaderZCorwin�textr)zContent-Typez
text/plainzContent-Typez
multipart/)zX-TrumpZRandom)�message�append�set_payload)r�subtyper�payload�msg_headers�name�valuerrr
�_make_subtype_test_message=s$



z/TestEmailMessageBase._make_subtype_test_messagec	CsH|�t��}t||��WdQRXt|j�}|�||�|�||�dS)N)rr�getattr�str�	exceptionZassertIn)rrZmethod_namerX�method�arZexc_textrrr
� _check_disallowed_subtype_raisesTs

z5TestEmailMessageBase._check_disallowed_subtype_raisescCs�d}x6|D].\}}|���d�s
|�|||�|d7}q
W|�t|�|d�t|���}d}x6|D].\}}|���d�rf|�|||�|d7}qfW|�t|�|�|�|��|�dS)Nrzcontent-r%)�lower�
startswithr�lenr
r;�get_payload)rrrZrY�countr[r\�partrrr
�_check_make_multipart[sz*TestEmailMessageBase._check_make_multipartcCs�|�|�\}}}d|}|dkr4|�||||�dSt||��|�|��d�|�|��|�|dkr�|�t|���d�|�|��|dd|fg�n"|�t|���d�|�	|||�dS)	N�make_)rrR�	multipartrNrzContent-Typez
multipart/r%)
r]rcr^r�get_content_maintype�get_content_subtyperfrg�itemsrj)rrarX�outcomerrZrYZmake_methodrrr
�subtype_as_makeks
z$TestEmailMessageBase.subtype_as_makec	Cs�|��}|dkrFd||d<|�t��}t|d|��WdQRXdS|dkrXd|d<n|dkrld||d<t|d|�dd	�|�|���|�|��d�dS)
N)rrRz
multipart/zContent-Typerkr0z
text/plainrN�abc)�boundary)rUrrr^�
assertTrueZis_multipartrZget_boundary)rrarXrprrGrrr
�subtype_as_make_with_boundary}s
z2TestEmailMessageBase.subtype_as_make_with_boundarycCsRxLdD]D}|j|jjdd�d�}d|d<t||��|�|�d�jjd�qWdS)N)Zmake_relatedZmake_alternativeZ
make_mixedrC)rB)rz
text/plainzContent-Typer)rUrrIr^rrgrB)rrarrrr
�3test_policy_on_part_made_by_make_comes_from_message�s

zHTestEmailMessageBase.test_policy_on_part_made_by_make_comes_from_messagec@seZdZdd�ZdS)z+TestEmailMessageBase._TestSetContentManagercOsd|d<|�|�dS)Nz
text/plainzContent-Type)rW)rr7�contentr=r>rrr
r@�sz7TestEmailMessageBase._TestSetContentManager.set_contentN)r r!r"r@rrrr
�_TestSetContentManager�srxcCsf|�|�\}}}|��}|dkr$dnd|}|dkrH|�||||�dSt||�d|d�|�|��d�|�|��|�||ks�|dkr�|�t|���d	�x |D]\}	}
|�||	|
�q�W|��d
}n.|�t|���d�|�	|||�|��d	}|�|�
�d�|�|��d�|dk�r8|�|d
d�n*|dk�rT|�|d
d�n|�|d
�dS)NrS�add_attachmentZadd_rR�test)rBrlrNr%rr$z
text/plainzContent-Disposition�
attachmentr*�inline)r]rxrcr^rrmrnrfrgrjZget_content_type�assertIsNone)rrarXrprrZrYrGZ
add_methodr[r\rirrr
�subtype_as_add�s0

z#TestEmailMessageBase.subtype_as_addc@seZdZdd�ZdS)z2TestEmailMessageBase._TestSetRaisingContentManagercOstd��dS)Nrz)�	Exception)rr7rwr=r>rrr
r@�sz>TestEmailMessageBase._TestSetRaisingContentManager.set_contentN)r r!r"r@rrrr
�_TestSetRaisingContentManager�sr�c
Csf|��}|j|jj|d�d�}xBdD]:}|�t��}t||�d�WdQRX|�t|j	�d�q$WdS)N)rB)r)�add_relatedZadd_alternativeryrrz)
r�rUrrIrrr^rr_r`)rrGrrarbrrr
�6test_default_content_manager_for_add_comes_from_policy�s
zKTestEmailMessageBase.test_default_content_manager_for_add_comes_from_policycCs\|�|�}|��|�t|�d�|�t|���g�|�|���|�t|���g�dS)Nr)	r�clearrrfr2ror}rgr;)rr4r5r6r7rrrr
�message_as_clear�s
z%TestEmailMessageBase.message_as_clearcCs^|�|�}dd�|��D�}|��|�t|���|�|�|���|�t|���g�dS)NcSsg|]}|���d�s|�qS)zcontent-)rdre)r+�hrrr
r.�szATestEmailMessageBase.message_as_clear_content.<locals>.<listcomp>)r�keysZ
clear_contentrr2r}rgr;)rr4r5r6r7rZexpected_headersrrr
�message_as_clear_content�s
z-TestEmailMessageBase.message_as_clear_contentcCs�|��}|�|���d|d<|�|���|�dd�|�|���|�dd�|�|���|�ddd�|�|���dS)Nr|zContent-Dispositionr{Z
AtTachMent�filenamezabc.png)�
_make_messageZassertFalseZ
is_attachmentZreplace_headerrtZ	set_param)rrrrr
�test_is_attachment�sz'TestEmailMessageBase.test_is_attachmentcCs^|��}|�d�|�d�|�d�|����}|�tt|����d�|�|��|�dS)Nzarbitrary text as main partzmore text as a related partz&yet more text as a second "attachment"r$)	r�r@r�rg�copyrrfr2r9)rrZorigrrr
�test_iter_attachments_mutation�s


z3TestEmailMessageBase.test_iter_attachments_mutationN)r r!r"rrrrZmessage_paramsr8r:r<rArHrKrLrMZsubtype_paramsr]rcrjrqrurvrxr~r�r�r�r�r�r�rrrr
r#&s�,,,	 			r#c@s�eZdZeZdd�ZGdd�d�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) �TestEmailMessagecCs>|�d�}|��}|�d|�|j|d�|�|dd�dS)NrzMIME-Version)rBz1.0)rrA�assertNotInr@r)rrrGrrr
�"test_set_content_adds_MIME_Version�s

z3TestEmailMessage.test_set_content_adds_MIME_Versionc@seZdZdd�ZdS)z(TestEmailMessage._MIME_Version_adding_CMcOsd|d<dS)Nz1.0zMIME-Versionr)rr7r=r>rrr
r@�sz4TestEmailMessage._MIME_Version_adding_CM.set_contentN)r r!r"r@rrrr
�_MIME_Version_adding_CM�sr�cCs>|�d�}|��}|�d|�|j|d�|�|dd�dS)NrzMIME-Version)rBz1.0)rr�r�r@r)rrrGrrr
�0test_set_content_does_not_duplicate_MIME_Version�s

zATestEmailMessage.test_set_content_does_not_duplicate_MIME_VersioncCs*|�d�}|�t|�������d�dS)Nz�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

r&)rrrf�	as_string�strip�
splitlines)rrrrr
�0test_as_string_uses_max_header_length_by_default�s
zATestEmailMessage.test_as_string_uses_max_header_length_by_defaultcCsN|�d�}|�t|jdd������d�|�t|jdd������d�dS)Nz�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

r)Zmaxheaderlenr%�"r()rrrfr�r�r�)rrrrr
�"test_as_string_allows_maxheaderlens

z3TestEmailMessage.test_as_string_allows_maxheaderlencCs*|�d�}|�tt|������d�dS)Nz�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

r&)rrrfr_r�r�)rrrrr
�+test_str_defaults_to_policy_max_line_length
s
z<TestEmailMessage.test_str_defaults_to_policy_max_line_lengthcCs"t�}d|d<|�t|�d�dS)Nuunicöde�SubjectuSubject: unicöde

)rrr_)rrrrr
�test_str_defaults_to_utf8sz*TestEmailMessage.test_str_defaults_to_utf8cCs"t�}d|d<|�t|�d�dS)NuDHello Wörld! Hello Wörld! Hello Wörld! Hello Wörld!Hello Wörld!r�s|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�bytes)rrrrr
�!test_folding_with_utf8_encoding_1s
z2TestEmailMessage.test_folding_with_utf8_encoding_1cCs"t�}d|d<|�t|�d�dS)NuHHello Wörld! Hello Wörld! Hello Wörlds123! Hello Wörld!Hello Wörld!r�s�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!?=

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_2$s
z2TestEmailMessage.test_folding_with_utf8_encoding_2cCs"t�}d|d<|�t|�d�dS)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123! Hello Wörld!Hello Wörld!r�s�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!?=

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_34s
z2TestEmailMessage.test_folding_with_utf8_encoding_3cCs"t�}d|d<|�t|�d�dS)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123!-Hello Wörld!Hello Wörld!r�s�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!?=

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_4Ds
z2TestEmailMessage.test_folding_with_utf8_encoding_4cCs"t�}d|d<|�t|�d�dS)NuS123456789 123456789 123456789 123456789 123456789 123456789 123456789 Hello Wörld!r�soSubject: 123456789 123456789 123456789 123456789 123456789 123456789 123456789
 Hello =?utf-8?q?W=C3=B6rld!?=

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_5Ts
z2TestEmailMessage.test_folding_with_utf8_encoding_5cCs"t�}d|d<|�t|�d�dS)Nuq123456789 123456789 123456789 123456789 Hello Wörld! 123456789 123456789 123456789 123456789 123456789 123456789r�s�Subject: 123456789 123456789 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!?=
 123456789 123456789 123456789 123456789 123456789 123456789

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_6bs
z2TestEmailMessage.test_folding_with_utf8_encoding_6cCs"t�}d|d<|�t|�d�dS)Nuo123456789 123456789 Hello Wörld! Hello Wörld! 123456789-123456789 123456789 Hello Wörld! 123456789 123456789r�s�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

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_7rs
z2TestEmailMessage.test_folding_with_utf8_encoding_7cCs"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 123456789r�s�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

)rrr�)rrrrr
�!test_folding_with_utf8_encoding_8�s
z2TestEmailMessage.test_folding_with_utf8_encoding_8N)r r!r"rrUr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r��s r�c@s eZdZeZdd�Zdd�ZdS)�TestMIMEPartcCs:|�d�}|��}|�d|�|j|d�|�d|�dS)NrzMIME-Version)rB)rrAr�r@)rrrGrrr
�*test_set_content_does_not_add_MIME_Version�s

z7TestMIMEPart.test_set_content_does_not_add_MIME_VersioncCs0tt�d�tjd�}|��}|�t|�g�dS)NzT        Content-Type: multipart/mixed; charset="utf-8"

        sample text
        )r)rrrrrr9rr2)rr7r5rrr
�/test_string_payload_with_multipart_content_type�sz<TestMIMEPart.test_string_payload_with_multipart_content_typeN)r r!r"rrUr�r�rrrr
r��sr��__main__)ZunittestrZemailrrZ
email.messagerrZtest.test_emailrrrrr#r�r�r �mainrrrr
�<module>s"I.