Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/test_email/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/test_email/__pycache__/test_email.cpython-312.pyc

�

(Μg�p��6�ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlZddlZddlZddlmZddlmZmZmZdd	lmZmZmZdd
lmZddlm Z ddl!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2m3Z3ddlm4Z4ddlm5Z5ddlm6Z6ddlm7Z7ddlm8Z8ddlm9Z9ddl:m;Z;ddl<m=Z=ddl>m?Z?ddl@mAZAmBZBddl1mCZCd ZDd!ZEd"ZFGd#�d$eB�ZGGd%�d&ej��ZIGd'�d(eB�ZJGd)�d*ej��ZKGd+�d,ej��ZLGd-�d.ej��ZMGd/�d0ej��ZNGd1�d2ej��ZOGd3�d4eB�ZPGd5�d6eB�ZQGd7�d8eB�ZRGd9�d:eB�ZSGd;�d<eB�ZTGd=�d>eB�ZUGd?�d@eB�ZVGdA�dBeB�ZWGdC�dDeB�ZXGdE�dFeB�ZYGdG�dHeB�ZZGdI�dJ�Z[GdK�dLe[eU�Z\GdM�dNe[eU�Z]GdO�dPej��Z^GdQ�dRej��Z_GdS�dTej��Z`GdU�dVeB�ZaGdW�dXeB�ZbGdY�dZeB�ZcGd[�d\eB�Zdeed]k(rej��yy)^�N)�StringIO�BytesIO)�chain��choice)�Thread)�patch)�Charset)�	Generator�DecodedGenerator�BytesGenerator)�Header�
decode_header�make_header)�HeaderRegistry)�Message)�MIMEApplication)�	MIMEAudio)�MIMEBase)�	MIMEImage)�MIMEMessage)�
MIMEMultipart)�MIMENonMultipart)�MIMEText)�Parser�HeaderParser)�
base64mime)�encoders��errors)�	iterators)�
quoprimime)�utils)�support)�threading_helper)�unlink)�openfile�
TestEmailBase)�
FeedParser�
�� c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUdT�ZVdU�ZWdV�ZXyW)X�TestMessageAPIc��|j}|jd�}||jd�gd��||jdd�d�y)Nz
msg_20.txt�cc)zccc@zzz.orgzddd@zzz.orgzeee@zzz.org�xxzn/a)�assertEqual�_msgobj�get_all��self�eq�msgs   �7/usr/local/lib/python3.12/test/test_email/test_email.py�test_get_allzTestMessageAPI.test_get_all:sD��
�
�
���l�l�<�(��
�3�;�;�t��K�L�
�3�;�;�t�U�#�U�+�c��|j}t�}||j�d�td�}|j	|�||dd�||j�d�||dd�||j
d�d�||dd	�||j�jd�|j	d�||j�d�||dd�t�}d
|d<d|d
<d|d<|j	|�||dd
�||dd�||dd�y)N�
iso-8859-1�mime-versionz1.0�
text/plain�content-typez text/plain; charset="iso-8859-1"�charset�content-transfer-encoding�quoted-printablez2.0zMIME-Versionztext/x-weird�Content-Typezquinted-puntable�Content-Transfer-Encodingz"text/x-weird; charset="iso-8859-1")r2r�get_charsetr
�set_charset�get_content_type�	get_param�
input_charset�r6r7r8rAs    r9�test_getset_charsetz"TestMessageAPI.test_getset_charset@s6��
�
�
���i��
�3�?�?��d�#��,�'������ �
�3�~���&�
�3���!�<�0�
�3�~�� B�C�
�3�=�=��#�\�2�
�3�*�+�-?�@�
�3�?�?��*�*�L�9������
�3�?�?��d�#�
�3�~���-��i��#��N��,��N��+=��'�(����� �
�3�~���&�
�3�~�� D�E�
�3�*�+�-?�@r;c��|j}t�}|jd�||j�jd�||dd�y)N�us-asciir@�text/plain; charset="us-ascii")r2rrGrFrJr5s   r9�test_set_charset_from_stringz+TestMessageAPI.test_set_charset_from_stringZsG��
�
�
���i�����
�#�
�3�?�?��*�*�J�7�
�3�~�� @�Ar;c��t�}td�}|jd|�|j|j	�j
d�y)Nr=zThis is a string payload)rr
�set_payloadr2rFrJ)r6r8rAs   r9�test_set_payload_with_charsetz,TestMessageAPI.test_set_payload_with_charsetas?���i���,�'�����2�G�<�������*�8�8�,�Gr;c��d}td�}t�}|j||�|j|dd�|j|j	d��|�|j|j	�d�y)N�АБВ�utf-8rB�base64T��decodez	0JDQkdCS
)r
rrRr2�get_payload�r6�datarAr8s    r9�+test_set_payload_with_8bit_data_and_charsetz:TestMessageAPI.test_set_payload_with_8bit_data_and_charsetgsn��*���'�"���i������g�&�����8�9�8�D���������5�t�<�������*�L�9r;c���d}td�}d|_t�}|j|j	d�|�|j|dd�|j|j
d��|�y�NrUrVrB�8bitTrX)r
�
body_encodingrrRrYr2rZr[s    r9�>test_set_payload_with_non_ascii_and_charset_body_encoding_nonezMTestMessageAPI.test_set_payload_with_non_ascii_and_charset_body_encoding_nonepsh��*���'�"�� $����i��������G�,�g�6�����8�9�6�B���������5�t�<r;c���d}td�}d|_t�}|j||�|j	|dd�|j	|jd��|�yr_)r
rarrRr2rZr[s    r9�>test_set_payload_with_8bit_data_and_charset_body_encoding_nonezMTestMessageAPI.test_set_payload_with_8bit_data_and_charset_body_encoding_noneys_��*���'�"�� $����i������g�&�����8�9�6�B���������5�t�<r;c�z�t�}|jg�|j|j�g�y�N�rrRr2rZ�r6r8s  r9�test_set_payload_to_listz'TestMessageAPI.test_set_payload_to_list�s,���i�������������*�B�/r;c��t�}d|d<|jd�tt��}|jtd|j
|�y)N�multipart/mixedrDzstring payloadz[Aa]ttach.*non-multipart)rrRr�assertRaisesRegex�	TypeError�attach)r6r8�sub_msgs   r9�"test_attach_when_payload_is_stringz1TestMessageAPI.test_attach_when_payload_is_string�sH���i��/��N�����(�)��g�i�(�����y�*D�"�z�z�7�	4r;c�&�|j}|jd�}|j�}||gd��|jd�}|jd�}||gd��|jd�}|j�}||gd��y)Nz
msg_08.txt)NrNr=�
iso-8859-2�koi8-rz
msg_09.txt�dingbat)rtrNr=rtrsz
msg_12.txt)NrNr=Nrrz
iso-8859-3rNrs)r2r3�get_charsets)r6r7r8�charsetss    r9�test_get_charsetsz TestMessageAPI.test_get_charsets�s���
�
�
���l�l�<�(���#�#�%��
�8�M�N��l�l�<�(���#�#�I�.��
�8� �	!��l�l�<�(���#�#�%��
�8�:�	;r;c�&�|j}|jd�}|j�D�cgc]}|j���}}||ddg�|jd�}|jd�}||j�d�ycc}w)N�
msg_04.txt�msg.txt�
msg_07.txt��dingusfish.gif�r2r3rZ�get_filename)r6r7r8�p�	filenames�subparts      r9�test_get_filenamez TestMessageAPI.test_get_filename�s���
�
�
���l�l�<�(��/2���/@�A�/@�!�Q�^�^�%�/@�	�A�
�9�y�)�,�-��l�l�<�(���/�/�!�$��
�7���!�#3�4��Bs�Bc��|j}|jd�}|j�D�cgc]}|j���}}||ddg�ycc}w)Nz
msg_44.txtrzr~)r6r7r8r�r�s     r9�%test_get_filename_with_name_parameterz4TestMessageAPI.test_get_filename_with_name_parameter�sT��
�
�
���l�l�<�(��/2���/@�A�/@�!�Q�^�^�%�/@�	�A�
�9�y�)�,�-��Bs�Ac�l�|j}|jd�}||j�d�y)Nr{�BOUNDARY)r2r3�get_boundaryr5s   r9�test_get_boundaryz TestMessageAPI.test_get_boundary�s.��
�
�
���l�l�<�(��
�3����z�*r;c���|j}|jd�}|jd�|j�d\}}||j	�d�||d�|jd�}|jd�|j�d\}}||j	�d�||d�|jd�}|jtj|jd�y)	N�
msg_01.txtr��r@z3text/plain; charset="us-ascii"; boundary="BOUNDARY"ryz$multipart/mixed; boundary="BOUNDARY"�
msg_03.txt)r2r3�set_boundary�items�lower�assertRaisesr �HeaderParseError)r6r7r8�header�values     r9�test_set_boundaryz TestMessageAPI.test_set_boundary�s���
�
�
���l�l�<�(������$��	�	��A��
���
�6�<�<�>�>�*�
�5�G�H��l�l�<�(������$��	�	��A��
���
�6�<�<�>�>�*�
�5�8�9��l�l�<�(�����&�1�1��*�*�J�	8r;c���td�}|j|j�ddd�|j�|j|j�ddddd�y)Nz	form-datarr|zmultipart/form-data�!z!multipart/form-data; boundary="==)rr2r��	as_stringrhs  r9�test_make_boundaryz!TestMessageAPI.test_make_boundary�s`���K�(��	
�������Q���*�,A�B��
�
���������Q���*�3�B�/�;�	=r;c�0�tdd��5}|j�}ddd�t�}|j�}t	�}t|dd�}|j
|d�|j|j�|�y#1swY�nxYw)N�
msg_46.txtrV��encodingTrF)	r'�readr�parsestrrr�flattenr2�getvalue�r6�fp�msgdata�parserr8�out�gens       r9�test_message_rfc822_onlyz'TestMessageAPI.test_message_rfc822_only�sw���l�W�
5���g�g�i�G�6�����o�o�g�&���j����T�1�%�����C�����������1�6�
5�s�B�Bc��tdd��5}|j�jd�}ddd�tjj�}|j
�}t�}tjj|�}|j|�|j|j�|�y#1swY��xYw)Nr�rVr��ascii)
r'r��encode�emailr��BytesHeaderParser�
parsebytesr�	generatorr
r�r2r�r�s       r9�test_byte_message_rfc822_onlyz,TestMessageAPI.test_byte_message_rfc822_only�s���
�l�W�
5���g�g�i�&�&�w�/�G�6����/�/�1������(���i���o�o�,�,�S�1�����C����������1�6�
5�s� C�C	c��|j}|jd�}||jd��d�||jd�jd��d�||jd�jd��d�||jd�jd��d	�||jd
�jd��d�||jd�jd��d
�y)Nz
msg_10.txtTrXrs This is a 7bit encoded message.
r|s-�This is a Quoted Printable encoded message!
�s!This is a Base64 encoded message.�s"This is a Base64 encoded message.
r�s/This has no Content-Transfer-Encoding: header.
)r2r3rZr5s   r9�test_get_decoded_payloadz'TestMessageAPI.test_get_decoded_payload�s���
�
�
���l�l�<�(��
�3�?�?�$�?�'��.�
�3�?�?�1��)�)��)�6�/�	1�	�3�?�?�1��)�)��)�6�?�	A�	�3�?�?�1��)�)��)�6�/�	1�	�3�?�?�1��)�)��)�6�1�	3�	�3�?�?�1��)�)��)�6�>�	@r;c���|j}t�}|jd�dD] }||d<||jd��d��"|jd�||jd��d�y)	Nz$begin 666 -
+:&5L;&\@=V]R;&0 
 
end
�z
x-uuencode�uuencode�uuezx-uuerBTrX�hello world�foosfoo)r2rrRrZ)r6r7r8�ctes    r9�test_get_decoded_uu_payloadz*TestMessageAPI.test_get_decoded_uu_payloadsn��
�
�
���i�����C�D�=�C�/2�C�+�,��s���d��+�^�<�>�	�����
�3�?�?�$�?�'��0r;c�Z�t�}|jt|jd�y)Nr|)rr�rmrZrhs  r9�*test_get_payload_n_raises_on_non_multipartz9TestMessageAPI.test_get_payload_n_raises_on_non_multiparts���i�����)�S�_�_�a�8r;c��|j}|jd�}tdd��5}|j�}ddd�t	�}t|�}|j
|�||j��y#1swY�GxYw)Nr{z
msg_17.txtrVr�)r2r3r'r�rrr�r�)r6r7r8r��text�s�gs       r9�test_decoded_generatorz%TestMessageAPI.test_decoded_generatorsl��
�
�
���l�l�<�(��
�l�W�
5���7�7�9�D�6��J���Q���	�	�	�#��
�1�:�:�<���6�
5�s�B�Bc��t�}d|d<d|d<|jd|�|jd|�|jd|�|jd|�|jd|�|jd|�y)	N�Me�From�You�to�from�FROM�To�TO)r�assertInrhs  r9�test__contains__zTestMessageAPI.test__contains__so���i����F����D�	��
�
�f�c�"��
�
�f�c�"��
�
�f�c�"��
�
�d�C� ��
�
�d�C� ��
�
�d�C� r;c��|jd�}tdd��5}|j�}ddd�|jt	|��|jd��}|j
d�}|j|djd��|j|tj|d	d��y#1swY��xYw)
Nr�rVr�T��unixfromr*rzFrom r|)r3r'r�r2�strr��split�
assertTrue�
startswith�NL�join)r6r8r�r��fullrepr�liness      r9�test_as_stringzTestMessageAPI.test_as_string+s����l�l�<�(��
�l�W�
5���7�7�9�D�6�����s�3�x�(��=�=�$�=�/�����t�$������a��+�+�G�4�5�����r�w�w�u�Q�R�y�1�2�
6�
5�s�C�Cc��|jd�}|jjd��}|j|��}t	�}t||��}|j
|�|j||j��y�Nr��
��linesep��policy)	r3r��cloner�rrr�r2r��r6r8�	newpolicyr�r�r�s      r9�test_as_string_policyz$TestMessageAPI.test_as_string_policy5sk���l�l�<�(���J�J�$�$�V�$�4�	��=�=�	�=�2���J���a�	�*��	�	�	�#������1�:�:�<�0r;c���tjd�}|jd�}tjd�}tj|�}|j|j
�|�y)Nu�            MIME-Version: 1.0
            Content-type: text/plain; charset="iso-8859-1"

            Test if non-ascii messages with no Content-Transfer-Encoding set
            can be as_string'd:
            Föö bär
            r=a%            MIME-Version: 1.0
            Content-type: text/plain; charset="iso-8859-1"
            Content-Transfer-Encoding: quoted-printable

            Test if non-ascii messages with no Content-Transfer-Encoding set
            can be as_string'd:
            F=F6=F6 b=E4r
            )�textwrap�dedentr�r��message_from_bytesr2r��r6�m�source�expectedr8s     r9�#test_nonascii_as_string_without_ctez2TestMessageAPI.test_nonascii_as_string_without_cte>s`���O�O��
�����,�'���?�?�$����&�&�v�.���������(�3r;c���tjd�}|jd�}|jdd�}t	j
|�}|j
|j�|�y)Nu            MIME-Version: 1.0
            Content-type: text/plain; charset="us-ascii"
            Content-Transfer-Encoding: 8bit

            Test if non-ascii messages with no Content-Transfer-Encoding set
            can be as_string'd:
            Föö bär
            r=r��replace�r�r�r�rYr�r�r2r�r�s     r9�*test_nonascii_as_string_with_ascii_charsetz9TestMessageAPI.test_nonascii_as_string_with_ascii_charsetTs[���O�O��
�����,�'���=�=��)�4���&�&�v�.���������(�3r;c���tjd�}|jd�}|jdd�}t	j
|�}|j
|j�|�y)Nu�            MIME-Version: 1.0

            Test if non-ascii messages with no Content-Type nor
            Content-Transfer-Encoding set can be as_string'd:
            Föö bär
            r=r�r�r�r�s     r9�4test_nonascii_as_string_without_content_type_and_ctezCTestMessageAPI.test_nonascii_as_string_without_content_type_and_ctecs[���O�O��
�����,�'���=�=��)�4���&�&�v�.���������(�3r;c��|jd�}tdd��5}|j�jd�}ddd�|j	t|��|j
d��}|jd�}|j|djd	��|j	|dj|d
d��y#1swY��xYw)Nr�rVr�r�Tr��
rsFrom r|)r3r'r�r�r2�bytes�as_bytesr�r�r�r�)r6r8r�r\r�r�s      r9�
test_as_byteszTestMessageAPI.test_as_bytesps����l�l�<�(��
�l�W�
5���7�7�9�#�#�G�,�D�6�����u�S�z�*��<�<��<�.�����u�%������a��+�+�H�5�6�����u�z�z�%���)�4�5�
6�
5�s� C
�
Cc��|jd�}|jjd��}|j|��}t	�}t||��}|j
|�|j||j��yr�)	r3r�r�r�rr
r�r2r�r�s      r9�test_as_bytes_policyz#TestMessageAPI.test_as_bytes_policyzsk���l�l�<�(���J�J�$�$�V�$�4�	��<�<�y�<�1���I���1�I�.��	�	�	�#������1�:�:�<�0r;c�p�tjd�}|j|jd�d�y)NzContent-Type: blarg; baz; boo
�bazr+�r��message_from_stringr2rIrhs  r9�test_bad_paramzTestMessageAPI.test_bad_param�s,���'�'�(I�J��������u�-�r�2r;c�n�tjd�}|j|j�d�y�Nz
From: foo
�r�r�r2rrhs  r9�test_missing_filenamez$TestMessageAPI.test_missing_filename��+���'�'�
�6������)�)�+�T�2r;c�n�tjd�}|j|j�d�y)Nz%Content-Disposition: blarg; filename
r+rrhs  r9�test_bogus_filenamez"TestMessageAPI.test_bogus_filename�s.���'�'�0�2������)�)�+�R�0r;c�n�tjd�}|j|j�d�yr�r�r�r2r�rhs  r9�test_missing_boundaryz$TestMessageAPI.test_missing_boundary�rr;c�j�|j}tjd�}||jd��gd��tjd�}||jd��gd��||j�d�tjd�}||jd��gd��y)N�&X-Header: foo=one; bar=two; baz=three
�x-header�r�))r��one)�bar�two�r��threez X-Header: foo; bar=one; baz=two
))r�r+)rr)r�r�"X-Header: foo; bar="one"; baz=two
)r2r�r��
get_paramsr5s   r9�test_get_paramszTestMessageAPI.test_get_params�s���
�
�
���'�'�5�7��
�3�>�>��>�,�=�	?��'�'�/�1��
�3�>�>��>�,�8�	:�
�3�>�>��T�"��'�'�1�3��
�3�>�>��>�,�8�	:r;c�d�t�}d|d<|j|jd�d�y)Nz>Content-Type: Multipart/mixed; boundary = "CPIMSSMTPC06p5f3tG"rD�boundary�CPIMSSMTPC06p5f3tG)rr2rIrhs  r9�test_get_param_liberalz%TestMessageAPI.test_get_param_liberal�s-���i��^��N��������z�2�4H�Ir;c��|j}tjd�}||jdd��d�||jdd��d�||jd�d�tjd�}||jdd��d	�||jdd��d
�||jdd��d�y)Nrrr
rr�quuzrr�r+rr��r2r�r�rIr5s   r9�test_get_paramzTestMessageAPI.test_get_param�s���
�
�
���'�'�5�7��
�3�=�=��z�=�2�E�:�
�3�=�=��
�=�3�T�:�
�3�=�=�� �$�'��'�'�1�3��
�3�=�=��z�=�2�B�7�
�3�=�=��z�=�2�E�:�
�3�=�=��z�=�2�E�:r;c��|jd�}|j|jd�jd�d�y)Nz
msg_22.txtr|�namez
wibble.JPG)r3r2rZrIrhs  r9�'test_get_param_funky_continuation_linesz6TestMessageAPI.test_get_param_funky_continuation_lines�s4���l�l�<�(���������+�5�5�f�=�|�Lr;c��tjd�}|j|jd�d�|j|jdd��d�y)Nz4Content-Type: image/pjpeg; name="Jim&amp;&amp;Jill"
r zJim&amp;&amp;JillF��unquotez"Jim&amp;&amp;Jill"r�rhs  r9�#test_get_param_with_semis_in_quotesz2TestMessageAPI.test_get_param_with_semis_in_quotes�sP���'�'�C�E��������v�.�0C�D�������v�u��=�.�	0r;c���tjd�}|j|jd�d�tjd�}|j|jd�d�y)Nz5Content-Type: foo; bar*0="baz\"foobar"; bar*1="\"baz"rzbaz"foobar"bazr�rhs  r9�test_get_param_with_quotesz)TestMessageAPI.test_get_param_with_quotes�s^���'�'�E�G��������u�-�/?�@��'�'�K�M��������u�-�/?�@r;c��tjd�}|jd|�|jd|�|jd|�|jd|�y)NzHeader: existsr�r�HEADER�headerx)r�r�r��assertNotInrhs  r9�test_field_containmentz%TestMessageAPI.test_field_containment�sM���'�'�(8�9���
�
�h��$��
�
�h��$��
�
�h��$�����C�(r;c���|j}t�}|jdd�||jd�d�|jdd�||jd�d�||jdd��d�||j	�gd��||j	d��gd	��|jdd
d��||jdd��d
�y)
NrA�iso-2022-jp�
importance�
high valueFr#�"high value")�r?r+)rAr.)r/r0)r2)rAz
"iso-2022-jp")r/r1ziso-9999-xxzX-Jimmyr)r2r�	set_paramrIrr5s   r9�test_set_paramzTestMessageAPI.test_set_param�s���
�
�
���i���
�
�i��/�
�3�=�=��#�]�3��
�
�l�L�1�
�3�=�=��&��5�
�3�=�=��u�=�5�~�F�
�3�>�>��<�	=�	�3�>�>�%�>�(�+G�	H�	�
�
�i��y�
�A�
�3�=�=��9�=�5�}�Er;c�B�|j}|jd�}||j�gd��|jd�}|j	d�||j�ddg�|jd|�||j�ddd|fg�y)N�
msg_05.txt)��multipart/reportr+)�report-type�delivery-status�r�%D1690A7AC1.996856090/mail.example.comr9r7r;)r2r3rrI�	del_paramr3)r6r7r8�old_vals    r9�test_del_paramzTestMessageAPI.test_del_param�s���
�
�
���l�l�<�(��
�3�>�>��C�	D��-�-�
�.���
�
�m�$�
�3�>�>��$�A�C�	D�	�
�
�m�W�-�
�3�>�>��$�A�
�G�$�&�	'r;c��t�}|jddd��|jdd�|j|dd�y)N�Content-Disposition�
attachment�bud.gif��filenamerE�content-disposition�r�
add_headerr=r2rhs  r9�test_del_param_on_other_headerz-TestMessageAPI.test_del_param_on_other_header�sA���i�����,�l�Y��O��
�
�j�"7�8�����2�3�\�Br;c�<�t�}|jdd�y)NrErF)rr=rhs  r9�$test_del_param_on_nonexistent_headerz3TestMessageAPI.test_del_param_on_nonexistent_headers���i���
�
�j�"7�8r;c��t�}|jddd��|d}|jdd��|j|d|�y)NrDr?rV�rA�foobarrrG)r6r8�existing_headers   r9�test_del_nonexistent_paramz)TestMessageAPI.test_del_nonexistent_paramsJ���i�����~�|�W��E��n�-���
�
�h�~�
�6�����^�,�o�>r;c�"�|j}t�}|jt|jd�|j	d�||dd�|jdd�||dd�|j	d�||dd�y)	Nr�r?r@rArNrOz	text/htmlztext/html; charset="us-ascii")r2rr��
ValueError�set_typer3r5s   r9�
test_set_typezTestMessageAPI.test_set_type
s��
�
�
���i�����*�c�l�l�F�;����\�"�
�3�~���-��
�
�i��,�
�3�~�� @�A����[�!�
�3�~�� ?�@r;c�p�t�}d|d<|jdd�|j|dd�y)Nr?zX-Content-Type�application/octet-streamzx-content-type)rrSr2rhs  r9�test_set_type_on_other_headerz,TestMessageAPI.test_set_type_on_other_headers;���i�� ,�������/�1A�B�����-�.�0J�Kr;c�X�t�}|j|j�d�y)Nr?)rr2rHrhs  r9�test_get_content_type_missingz,TestMessageAPI.test_get_content_type_missings"���i������-�-�/��>r;c�z�t�}|jd�|j|j�d�y)N�message/rfc822)r�set_default_typer2rHrhs  r9�/test_get_content_type_missing_with_default_typez>TestMessageAPI.test_get_content_type_missing_with_default_type"s2���i�����-�.�����-�-�/�1A�Br;c��|jd�}|j|jd�j�d�y)N�
msg_30.txtrr[�r3r2rZrHrhs  r9�+test_get_content_type_from_message_implicitz:TestMessageAPI.test_get_content_type_from_message_implicit'�5���l�l�<�(���������+�<�<�>�)�	+r;c��|jd�}|j|jd�j�d�y)N�
msg_28.txtrr[r`rhs  r9�+test_get_content_type_from_message_explicitz:TestMessageAPI.test_get_content_type_from_message_explicit,rbr;c�f�|jd�}|j|j�d�y)Nr�r?�r3r2rHrhs  r9�6test_get_content_type_from_message_text_plain_implicitzETestMessageAPI.test_get_content_type_from_message_text_plain_implicit1�)���l�l�<�(������-�-�/��>r;c�f�|jd�}|j|j�d�y)Nr�r?rgrhs  r9�6test_get_content_type_from_message_text_plain_explicitzETestMessageAPI.test_get_content_type_from_message_text_plain_explicit5rir;c�X�t�}|j|j�d�y)Nr��rr2�get_content_maintyperhs  r9�!test_get_content_maintype_missingz0TestMessageAPI.test_get_content_maintype_missing9s"���i������1�1�3�V�<r;c�z�t�}|jd�|j|j�d�y)Nr[�message)rr\r2rnrhs  r9�3test_get_content_maintype_missing_with_default_typezBTestMessageAPI.test_get_content_maintype_missing_with_default_type=s1���i�����-�.�����1�1�3�Y�?r;c��|jd�}|j|jd�j�d�y)Nr_rrq�r3r2rZrnrhs  r9�/test_get_content_maintype_from_message_implicitz>TestMessageAPI.test_get_content_maintype_from_message_implicitB�2���l�l�<�(���������+�@�@�B�I�Nr;c��|jd�}|j|jd�j�d�y)Nrdrrqrtrhs  r9�/test_get_content_maintype_from_message_explicitz>TestMessageAPI.test_get_content_maintype_from_message_explicitFrvr;c�f�|jd�}|j|j�d�y)Nr�r��r3r2rnrhs  r9�:test_get_content_maintype_from_message_text_plain_implicitzITestMessageAPI.test_get_content_maintype_from_message_text_plain_implicitJ�)���l�l�<�(������1�1�3�V�<r;c�f�|jd�}|j|j�d�y)Nr�r�rzrhs  r9�:test_get_content_maintype_from_message_text_plain_explicitzITestMessageAPI.test_get_content_maintype_from_message_text_plain_explicitNr|r;c�X�t�}|j|j�d�y)N�plain�rr2�get_content_subtyperhs  r9� test_get_content_subtype_missingz/TestMessageAPI.test_get_content_subtype_missingRs"���i������0�0�2�G�<r;c�z�t�}|jd�|j|j�d�y)Nr[�rfc822)rr\r2r�rhs  r9�2test_get_content_subtype_missing_with_default_typezATestMessageAPI.test_get_content_subtype_missing_with_default_typeVs1���i�����-�.�����0�0�2�H�=r;c��|jd�}|j|jd�j�d�y)Nr_rr��r3r2rZr�rhs  r9�.test_get_content_subtype_from_message_implicitz=TestMessageAPI.test_get_content_subtype_from_message_implicit[�2���l�l�<�(���������+�?�?�A�8�Lr;c��|jd�}|j|jd�j�d�y)Nrdrr�r�rhs  r9�.test_get_content_subtype_from_message_explicitz=TestMessageAPI.test_get_content_subtype_from_message_explicit_r�r;c�f�|jd�}|j|j�d�y)Nr�r��r3r2r�rhs  r9�9test_get_content_subtype_from_message_text_plain_implicitzHTestMessageAPI.test_get_content_subtype_from_message_text_plain_implicitc�)���l�l�<�(������0�0�2�G�<r;c�f�|jd�}|j|j�d�y)Nr�r�r�rhs  r9�9test_get_content_subtype_from_message_text_plain_explicitzHTestMessageAPI.test_get_content_subtype_from_message_text_plain_explicitgr�r;c�b�t�}d|d<|j|j�d�y)N�no-slash-in-this-stringrDr�rmrhs  r9�test_get_content_maintype_errorz.TestMessageAPI.test_get_content_maintype_errorks,���i��7��N������1�1�3�V�<r;c�b�t�}d|d<|j|j�d�y)Nr�rDr�r�rhs  r9�test_get_content_subtype_errorz-TestMessageAPI.test_get_content_subtype_errorps,���i��7��N������0�0�2�G�<r;c�x�|j}t�}|jdd�|jdd�|jdd�||j�gd��||j	�gd��|jdd	�||j�gd��||j	�gd
��|jdd�|jdd�||j�gd
��||j	�gd��|j
t|j
dd�y)N�First�One�Second�Two�Third�Three)r�r�r�)r�r�r��Twenty)r�r�r��Eleven�One Hundred)r�r�r�r�)r�r�r�r��Fourth�Missing)r2rrH�keys�values�replace_headerr��KeyErrorr5s   r9�test_replace_headerz"TestMessageAPI.test_replace_headerus���
�
�
���i�����w��&����x��'����w��(�
�3�8�8�:�3�4�
�3�:�:�<�0�1����8�X�.�
�3�8�8�:�3�4�
�3�:�:�<�3�4����w��)����7�M�2�
�3�8�8�:�<�=�
�3�:�:�<�E�F����(�C�$6�$6��)�Lr;c��t�}|j|j��|jddd��|j	|j�d�|jdd�|j	|j�d�|jdd�|j	|j�d�y)NrArBz
random.avirD�inline�InlinE)r�assertIsNone�get_content_dispositionrHr2r�rhs  r9�test_get_content_dispositionz+TestMessageAPI.test_get_content_disposition�s����i�����#�5�5�7�8����,�l� ,�	�	.�����4�4�6��E����0�(�;�����4�4�6��A����0�(�;�����4�4�6��Ar;c���d}t�}d|d<d|d<|j|�|j|jd��d�|j	|j
d	tj�y)
NzAwDp0P7//y6LwKEAcPa/6Q=9zaudio/x-midir@rWrBTrXs����.���p���r)rrRr2rZ�assertIsInstance�defectsr �InvalidBase64CharactersDefect�r6�xr8s   r9�test_broken_base64_payloadz)TestMessageAPI.test_broken_base64_payload�ss��&���i��,��N��+3��'�(��������������5�7�	9�	
���c�k�k�!�n�$�B�B�	Dr;c��d}t�}d|d<d|d<|j|�|j|jd��t	|d��y)	Nuthis is a bröken thing to dor?r@r`rBTrXzraw-unicode-escape)rrRr2rZr�r�s   r9�test_broken_unicode_payloadz*TestMessageAPI.test_broken_unicode_payload�sW��
.���i��*��N��+1��'�(��������������5��q�"6�7�	9r;c��djd�}t�}d|d<d|d<||_|j|j	d��|�y)	Nu#this is a quéstionable thing to dorV�text/plain; charset="utf-8"r@r`rBTrX)r�r�_payloadr2rZr�s   r9�test_questionable_bytes_payloadz.TestMessageAPI.test_questionable_bytes_payload�sR��
2�8�8��A���i��;��N��+1��'�(������������5�q�9r;c�j�t�}|jddd��|jd|d�y)NrArBrCrDzattachment; filename="bud.gif"�rrHr2rhs  r9�test_ascii_add_headerz$TestMessageAPI.test_ascii_add_header�s<���i�����,�l� )�	�	+����9��%�&�	(r;c�j�t�}|jddd��|jd|d�y)NrArB�Fußballer.pptrDz/attachment; filename*=utf-8''Fu%C3%9Fballer.pptr�rhs  r9�test_noascii_add_headerz&TestMessageAPI.test_noascii_add_header�s<���i�����,�l�%�	�	'����?��%�&�	(r;c�j�t�}|jddd��|jd|d�y)NrArB)r=r+r�rDz1attachment; filename*=iso-8859-1''Fu%DFballer.pptr�rhs  r9�#test_nonascii_add_header_via_triplez2TestMessageAPI.test_nonascii_add_header_via_triple�s<���i�����,�l�9�	�	;����A��%�&�	(r;c�j�t�}|jddd��|jd|d�y)NrArBzwindows [filename].pptrDz-attachment; filename="windows [filename].ppt"r�rhs  r9�#test_ascii_add_header_with_tspecialz2TestMessageAPI.test_ascii_add_header_with_tspecial�s<���i�����,�l�-�	�	/����;��%�&�	(r;c�j�t�}|jddd��|jd|d�y)NrArBuFußballer [filename].pptrDz@attachment; filename*=utf-8''Fu%C3%9Fballer%20%5Bfilename%5D.pptr�rhs  r9�&test_nonascii_add_header_with_tspecialz5TestMessageAPI.test_nonascii_add_header_with_tspecial�s<���i�����,�l�0�	�	2����N��%�&�	(r;c��dD]P}t�}d|z|d<d|d<|jd�|j|jd��d	d
|z��Ry)N��latin-1r��text/plain; charset=%sr@rCrBsfoo=e6=96=87barTrX�	foo文bar�1get_payload returns wrong result with charset %s.rg�r6rAr8s   r9�test_binary_quopri_payloadz)TestMessageAPI.test_binary_quopri_payload�sb��+�G��)�C�":�W�"D�C���/A�C�+�,��O�O�.�/�������t��,�%�C�g�M�
O�,r;c��dD]P}t�}d|z|d<d|d<|jd�|j|jd��d	d
|z��Ry)Nr�r�r@rWrBsZm9v5paHYmFyTrXr�r�rgr�s   r9�test_binary_base64_payloadz)TestMessageAPI.test_binary_base64_payload�sa��+�G��)�C�":�W�"D�C���/7�C�+�,��O�O�O�,�������t��,�%�C�g�M�
O�,r;c
���dD]m}dD]f}t�}d|z|d<||d<|jd�|j|jd��d	t	d
�j||���h�oy)Nr�r�r�r@rBs begin 666 -
)9F]OYI:'8F%R
 
end
TrXr�)z!get_payload returns wrong result z"with charset {0} and encoding {1}.)rrRr2rZr��format)r6rAr�r8s    r9�test_binary_uuencode_payloadz+TestMessageAPI.test_binary_uuencode_payload�s~��+�G�F���i��&>��&H��N�#�3;��/�0���� G�H�� � ��O�O�4�O�0�)��?�@���w��1�3�G�,r;c�j�t�}|jddd��|jd|d�y)NrAr�)�foo_barzinline; foo-barr�rhs  r9�$test_add_header_with_name_only_paramz3TestMessageAPI.test_add_header_with_name_only_param�s3���i�����,�h���E����*�C�0E�,F�Gr;c�f�t�}|jdd�|jd|d�y)NzX-Statusr+r�rhs  r9�test_add_header_with_no_valuez,TestMessageAPI.test_add_header_with_no_values+���i�����z�4�(�����S��_�-r;c��t�}td�|d<|jtj|j
�y�Nzdummy
X-Injected-Header: test�Dummy)rrr�r r�r�rhs  r9�(test_embedded_header_via_Header_rejectedz7TestMessageAPI.test_embedded_header_via_Header_rejecteds2���i���>�?��G�����&�1�1�3�=�=�Ar;c�v�t�}d|d<|jtj|j�yr�)rr�r r�r�rhs  r9�(test_embedded_header_via_string_rejectedz7TestMessageAPI.test_embedded_header_via_string_rejecteds,���i��7��G�����&�1�1�3�=�=�Ar;c��td�}d|d<|jt|�tjd��y)Nzabc
uÉ test�Subjectz�            Content-Type: text/plain; charset="us-ascii"
            MIME-Version: 1.0
            Content-Transfer-Encoding: 7bit
            Subject: =?utf-8?q?=C3=89_test?=

            abc
            �rr2r�r�r��r6r�s  r9�-test_unicode_header_defaults_to_utf8_encodingz<TestMessageAPI.test_unicode_header_defaults_to_utf8_encodings9���W��� ��)������Q�����1�!�	r;c�v�td�}|jt|�tjd��y)NuÉ testabc
z�            Content-Type: text/plain; charset="utf-8"
            MIME-Version: 1.0
            Content-Transfer-Encoding: base64

            w4kgdGVzdGFiYwo=
            r�r�s  r9�+test_unicode_body_defaults_to_utf8_encodingz:TestMessageAPI.test_unicode_body_defaults_to_utf8_encoding"s0���^�$������Q�����1�!�	r;N)Y�__name__�
__module__�__qualname__r:rLrPrSr]rbrdrirprwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrr!r%r'r,r4r?rIrKrPrTrWrYr]rarerhrkrorrrurxr{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��r;r9r.r.9s���,�A�4B�H�:�=�=�0�
4�;�"	5�.�+�8�,=�
2�	2�@�,	1�9��
!�3�1�4�,
4�4�6�1�3�3�1�
3�:�"J�
;�$M�
0�A�)�F�"'�"C�9�
?�	A�L�?�C�
+�
+�
?�?�=�@�
O�O�=�=�=�>�
M�M�=�=�=�
=�
M�"	B�
D�	9�:�(�(�(�(�(�	O�	O�3�H�
.�B�
B�
�	r;r.c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�TestEncodersc
�h�tdd�5}|j�}ddd�tjjj�}|j
�}|jd�}|jt|D�cgc]
}t|���c}�d�y#1swY��xYwcc}w)N�
python.gif�rbr*�L)r'r�r��mime�imagerrZr��assertLessEqual�max�len)r6r��bindata�mimed�base64edr�r�s       r9�test_EncodersEncode_base64z'TestEncoders.test_EncodersEncode_base641s���
�l�D�
)�R��g�g�i�G�*��
�
� � �*�*�7�3���$�$�&�����t�$�����S�5�!:�5�a�3�q�6�5�!:�;�R�@�
*�
)��";s�B#�B/�#B,c�j�|j}t�}|jd�||dd�y)NrNrB�7bit)r2rrGr5s   r9�test_encode_empty_payloadz&TestEncoders.test_encode_empty_payload:s0��
�
�
���i�����
�#�
�3�*�+�V�4r;c��|j}td�}||dd�td�}||dd�tdd��}||dd�y)	N�hello worldrBr�uhello ø worldrWr=��_charsetrC)r2rr5s   r9�test_default_ctezTestEncoders.test_default_cte@s`��
�
�
���}�%��
�3�*�+�V�4��)�*��
�3�*�+�X�6��)�L�A��
�3�*�+�-?�@r;c��|j}tdd��}||dd�||j�tjd��y)Nu文
�euc-jpr�rBr�z�            MIME-Version: 1.0
            Content-Type: text/plain; charset="iso-2022-jp"
            Content-Transfer-Encoding: 7bit

            $BJ8(B
            )r2rr�r�r�r5s   r9�test_encode7or8bitzTestEncoders.test_encode7or8bitLsK���
�
���w��2��
�3�*�+�V�4�
�3�=�=�?�H�O�O�-��	r;c�z�tddd�}|jt|�tjd��y)Nuáö
r�z
ISO-8859-1z�            MIME-Version: 1.0
            Content-Type: text/text; charset="iso-8859-1"
            Content-Transfer-Encoding: quoted-printable

            =E1=F6
            r�rhs  r9�test_qp_encode_latin1z"TestEncoders.test_qp_encode_latin1[s4���|�V�\�:������S��8�?�?�4�$�	r;c�z�tddd�}|jt|�tjd��y)Nuż
r�z
ISO-8859-2z�            MIME-Version: 1.0
            Content-Type: text/text; charset="iso-8859-2"
            Content-Transfer-Encoding: quoted-printable

            =BF
            r�rhs  r9�test_qp_encode_non_latin1z&TestEncoders.test_qp_encode_non_latin1es4���z�6�<�8������S��8�?�?�4�$�	r;N)	r�r�r�r�r�rrrrr�r;r9r�r�/s"��A�5�
A�
��	r;r�c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*y))�TestLongHeadersNc��|j}tjd�}t�}t	|�}|j|�||j
�d�y)Nz�Subject: bug demonstration
	12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
	more text

test
)�ndiffAssertEqualr�r�rrr�r��r6r7r8�sfpr�s     r9�test_split_long_continuationz,TestLongHeaders.test_split_long_continuationvsT��
�
"�
"���'�'�)����j���c�N��	�	�	�#��
�3�<�<�>��	r;c���|j}d}t|d��}||j�d�t|jdd��}||j�d�y)Nz�bug demonstration
	12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
	more text�	��continuation_wsr,z�bug demonstration
 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
 more text)rrr�r��r6r7�hstr�hs    r9�,test_another_long_almost_unsplittable_headerz<TestLongHeaders.test_another_long_almost_unsplittable_header�sc��
�
"�
"����
�4��.��
�1�8�8�:��	�
�4�<�<��c�*�+��
�1�8�8�:��	r;c��|j}td�}td�}td�}d}d}d}t||d��}|j||�|j||�t	�}	||	d<t�}
t
|
�}|j|	�||
j�d	�||jd
��d�y)
Nr=rrrV�Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s�dl�ndischen Wandgem�lden vorbei, gegen die rotierenden Klingen bef�rdert. �;Finan�ni metropole se hroutily pod tlakem jejich d�vtipu.. ��正確に言うと翻訳はされていません。一部はドイツ語ですが、あとはでたらめです。実際には「Wenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.」と言っています。r���header_namea!Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderb?=
 =?iso-8859-1?q?and_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen?=
 =?iso-8859-1?q?_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef?=
 =?iso-8859-1?q?=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hrouti?=
 =?iso-8859-2?q?ly_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?=
 =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?=
 =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn44Gf44KJ?=
 =?utf-8?b?44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFzIE51bnN0dWNr?=
 =?utf-8?b?IGdpdCB1bmQgU2xvdGVybWV5ZXI/IEphISBCZWloZXJodW5kIGRhcyBPZGVyIGRp?=
 =?utf-8?b?ZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYTjgb7jgZk=?=
 =?utf-8?b?44CC?=

r���
maxlinelena	=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerde?=
 =?iso-8859-1?q?rband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndis?=
 =?iso-8859-1?q?chen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klinge?=
 =?iso-8859-1?q?n_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se?=
 =?iso-8859-2?q?_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?=
 =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb?=
 =?utf-8?b?44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go?=
 =?utf-8?b?44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBp?=
 =?utf-8?b?c3QgZGFzIE51bnN0dWNrIGdpdCB1bmQgU2xvdGVybWV5ZXI/IEphISBCZWlo?=
 =?utf-8?b?ZXJodW5kIGRhcyBPZGVyIGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI0=?=
 =?utf-8?b?44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=)
rr
r�appendrrrr�r�r�)r6r7r��cz�utf8�g_head�cz_head�	utf8_headrr8rs           r9�test_long_nonstringz#TestLongHeaders.test_long_nonstring�s���
�
"�
"���L�!��
�\�
"���w���$��$��0�	�
�6�1�)�4��	����"��	����D�!��i����I���j���c�N��	�	�	�#��
�3�<�<�>�
�
	�	�1�8�8�r�8�"�%1�	2r;c�d�|j}tdd��}||j�d�y)N�iwasnipoop; giraffes="very-long-necked-animals"; spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"�X-Foobar-Spoink-Defrobnitr�jwasnipoop; giraffes="very-long-necked-animals";
 spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"�rrr��r6r7rs   r9�test_long_header_encodez'TestLongHeaders.test_long_header_encode�s7��
�
"�
"���O�:�
<��	�1�8�8�:�>�	?r;c�f�|j}tddd��}||j�d�y)Nr(r)r�rrr*r+r,s   r9�<test_long_header_encode_with_tab_continuation_is_just_a_hintzLTestLongHeaders.test_long_header_encode_with_tab_continuation_is_just_a_hint�s:��
�
"�
"���O�:�#'�
)��	�1�8�8�:�>�	?r;c�f�|j}tddd��}||j�d�y)Nziwasnipoop; giraffes="very-long-necked-animals";	spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"r)rr/zjwasnipoop; giraffes="very-long-necked-animals";
	spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"r+r,s   r9�-test_long_header_encode_with_tab_continuationz=TestLongHeaders.test_long_header_encode_with_tab_continuation�s;��
�
"�
"���O�:�#'�
)��	�1�8�8�:�?�	@r;c�\�tdd�}|j|j�d�y)N�文r�=?iso-2022-jp?b?GyRCSjgbKEI=?=�rr2r��r6rs  r9�0test_header_encode_with_different_output_charsetz@TestLongHeaders.test_header_encode_with_different_output_charset�s%���5�(�#���������%E�Fr;c�~�tdjd�d�}d}|j|j�|�y)Ns6test-ja ����Ƥ��줿�᡼��ϻʲ�Ԥξ�ǧ���ԤäƤ��ޤ�rz�=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKMnE8VCROPjUbKEI=?=
 =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=)rrYr2r�)r6r�ress   r9�5test_long_header_encode_with_different_output_charsetzETestLongHeaders.test_long_header_encode_with_different_output_charset�s?���$�%+�F�8�$4�h�
@��7��	
�������S�)r;c��|j}td�}d|d<t�}t|�}|j	|�||j�d�y)Nr+r(r)z�Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
 spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"

)rrrrr�r�r
s     r9�test_header_splitterz$TestLongHeaders.test_header_splitter�sY��
�
"�
"���r�l��
H�	�'�(��j���c�N��	�	�	�#��
�3�<�<�>��	r;c�&�|j}t�}d|d<tjd�t	d�D��|d<|jd�t
�}t|�}|j|�||j�d�y)N�test@dom.ainr�c3�&K�|]	}d|z���y�w)z<%d@dom.ain>Nr�)�.0�is  r9�	<genexpr>z@TestLongHeaders.test_no_semis_header_splitter.<locals>.<genexpr>s����&M�9�a�~��'9�9�s��
�
References�Testz�From: test@dom.ain
References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain>
 <5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain>

Test)
rr�SPACEr��rangerRrrr�r�r
s     r9�test_no_semis_header_splitterz-TestLongHeaders.test_no_semis_header_splittersv��
�
"�
"���i��$��F��!�J�J�&M�5��9�&M�M��L��������j���c�N��	�	�	�#��
�3�<�<�>��		r;c�`�|j}td�}||j�d�y)Nz�Subject: the first part of this is short, but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfz�Subject: the first part of this is short,
 but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfr+r,s   r9�"test_last_split_chunk_does_not_fitz2TestLongHeaders.test_last_split_chunk_does_not_fit �5��
�
"�
"����
��	�1�8�8�:�b�	cr;c�`�|j}td�}||j�d�y)Nz_, but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfz`,
 but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfr+r,s   r9�>test_splittable_leading_char_followed_by_overlong_unsplittablezNTestLongHeaders.test_splittable_leading_char_followed_by_overlong_unsplittable)rLr;c�`�|j}td�}||j�d�y)Nza, , but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfzb, ,
 but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itselfr+r,s   r9�Gtest_multiple_splittable_leading_char_followed_by_overlong_unsplittablezWTestLongHeaders.test_multiple_splittable_leading_char_followed_by_overlong_unsplittable2rLr;c�`�|j}td�}||j�d�y)NzTthis_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;r+r,s   r9�1test_trailing_splittable_on_overlong_unsplittablezATestLongHeaders.test_trailing_splittable_on_overlong_unsplittable;s1��
�
"�
"���*�
+��
�1�8�8�:�*�	+r;c�`�|j}td�}||j�d�y)NzW; this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; zX;
 this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; r+r,s   r9�Itest_trailing_splittable_on_overlong_unsplittable_with_leading_splittablezYTestLongHeaders.test_trailing_splittable_on_overlong_unsplittable_with_leading_splittableBs5��
�
"�
"���+�
,��	�1�8�8�:�Z�	[r;c�`�|j}td�}||j�d�y)NzpThis is a long line that has two whitespaces  in a row.  This used to cause truncation of the header when foldedzqThis is a long line that has two whitespaces  in a row.  This used to cause
 truncation of the header when foldedr+r,s   r9�5test_long_header_with_multiple_sequential_split_charszETestLongHeaders.test_long_header_with_multiple_sequential_split_charsKs3��
�
"�
"���F�
G��
�1�8�8�:�)�	*r;c�`�|j}td�}||j�d�y)N�Kthisverylongheaderhas;semicolons;and,commas,butthey;arenotlegal;fold,pointsr+r,s   r9�:test_splitter_split_on_punctuation_only_if_fws_with_headerzJTestLongHeaders.test_splitter_split_on_punctuation_only_if_fws_with_headerSs1��
�
"�
"���+�
,��
�1�8�8�:�2�	3r;c�`�|j}td�}||j�d�y)Nz�this is a  test where we need to have more than one line before; our final line that is just too big to fit;; this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;z�this is a  test where we need to have more than one line before;
 our final line that is just too big to fit;;
 this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;r+r,s   r9�Dtest_leading_splittable_in_the_middle_just_before_overlong_last_partzTTestLongHeaders.test_leading_splittable_in_the_middle_just_before_overlong_last_partZs5��
�
"�
"���*�
+��	�1�8�8�:�Y�	Zr;c�`�|j}td�}||j�d�y)NzTthis_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself r+r,s   r9�/test_overlong_last_part_followed_by_split_pointz?TestLongHeaders.test_overlong_last_part_followed_by_split_pointes1��
�
"�
"���*�
+��
�1�8�8�:�=�	>r;c�`�|j}td�}||j�d�y)Nz�this_is_a__test_where_we_need_to_have_more_than_one_line_before_our_final_line_; ; this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; z�this_is_a__test_where_we_need_to_have_more_than_one_line_before_our_final_line_;
 ;
 this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; r+r,s   r9�@test_multiline_with_overlong_parts_separated_by_two_split_pointszPTestLongHeaders.test_multiline_with_overlong_parts_separated_by_two_split_pointsl�5��
�
"�
"���+�
,��	�1�8�8�:�Z�	[r;c�`�|j}td�}||j�d�y)Nz�this is a test where we need to have more than one line before our final line; ; this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; z�this is a test where we need to have more than one line before our final line;
 ;
 this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself; r+r,s   r9�>test_multiline_with_overlong_last_part_followed_by_split_pointzNTestLongHeaders.test_multiline_with_overlong_last_part_followed_by_split_pointwr`r;c��|j}t�}d|d<tjdgdz�|d<|j	d�t�}t
|�}|j|�||j�d�y)Nr?r�z<foo@dom.ain>  rDrErFz�From: test@dom.ain
References: <foo@dom.ain>   <foo@dom.ain>   <foo@dom.ain>   <foo@dom.ain>
   <foo@dom.ain>   <foo@dom.ain>   <foo@dom.ain>   <foo@dom.ain>
   <foo@dom.ain>   <foo@dom.ain>  

Test�	rrrGr�rRrrr�r�r
s     r9�%test_long_header_with_whitespace_runsz5TestLongHeaders.test_long_header_with_whitespace_runs�su��
�
"�
"���i��$��F��!�J�J�(9�':�R�'?�@��L��������j���c�N��	�	�	�#��
�3�<�<�>��		r;c��|j}t�}d|d<tjdgdz�dz|d<|j	d�t�}t
|�}|j|�||j�d�y)	Nr?r�z
<foo@dom.ain>rDz; abcrErFz�From: test@dom.ain
References: <foo@dom.ain> <foo@dom.ain> <foo@dom.ain> <foo@dom.ain>
 <foo@dom.ain> <foo@dom.ain> <foo@dom.ain> <foo@dom.ain> <foo@dom.ain>
 <foo@dom.ain>; abc

Testrdr
s     r9�'test_long_run_with_semi_header_splitterz7TestLongHeaders.test_long_run_with_semi_header_splitter�sy��
�
"�
"���i��$��F��!�J�J��'8�2�'=�>��H��L��������j���c�N��	�	�	�#��
�3�<�<�>��		r;c���|j}t�}d|d<d|d<|jd�t�}t	|�}|j|�||j
�d�y)Nr?r�rXrErFzrFrom: test@dom.ain
References: 
 thisverylongheaderhas;semicolons;and,commas,butthey;arenotlegal;fold,points

Test)rrrRrrr�r�r
s     r9�.test_splitter_split_on_punctuation_only_if_fwsz>TestLongHeaders.test_splitter_split_on_punctuation_only_if_fws�se��
�
"�
"���i��$��F��+��L��������j���c�N��	�	�	�#��
�3�<�<�>��		r;c��|j}d}t|�}||j�d�td�}||j�d�y)Nz\References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz]References:
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx�Pxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr+rs    r9�test_no_split_long_headerz)TestLongHeaders.test_no_split_long_header�sQ��
�
"�
"��(���4�L��	�1�8�8�:�U�	V�
�8���
�1�8�8�:�i�jr;c�h�|j}d}t|d��}||j�d�y)NaWfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
	from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
	from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
rra_from babylon.socal-raves.org (localhost [127.0.0.1]);
 by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
 for <mailman-admin@babylon.socal-raves.org>;
 Sat, 2 Feb 2002 17:00:06 -0800 (PST)
	from babylon.socal-raves.org (localhost [127.0.0.1]);
 by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
 for <mailman-admin@babylon.socal-raves.org>;
 Sat, 2 Feb 2002 17:00:06 -0800 (PST)
	from babylon.socal-raves.org (localhost [127.0.0.1]);
 by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
 for <mailman-admin@babylon.socal-raves.org>;
 Sat, 2 Feb 2002 17:00:06 -0800 (PST)r+rs    r9�"test_splitting_multiple_long_linesz2TestLongHeaders.test_splitting_multiple_long_lines�s7��
�
"�
"����

�4��.��
�1�8�8�:�)�	*r;c�l�|j}d}t|ddd��}||j�d�y)Nz�from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca)
	by kronos.mems-exchange.org with esmtp (Exim 4.05)
	id 17k4h5-00034i-00
	for test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400�N�Receivedr)rrrz�from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93]
 helo=cthulhu.gerg.ca)
	by kronos.mems-exchange.org with esmtp (Exim 4.05)
	id 17k4h5-00034i-00
	for test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400r+rs    r9�&test_splitting_first_line_only_is_longz6TestLongHeaders.test_splitting_first_line_only_is_long�sA��
�
"�
"��A��

�4�B�J�#'�
)��
�1�8�8�:�A�	Br;c��|j}t�}tddd��}|jd�||j	d��d�||d<||jd�	�d
�||jd�	�d�y)
NzBritische Regierung gibtr=r�ru-grünes Licht für Offshore-Windkraftprojekter�rzl=?iso-8859-1?q?Britische_Regierung_gibt_gr=FCnes_Licht_f=FCr_Offs?=
 =?iso-8859-1?q?hore-Windkraftprojekte?=��maxheaderlenzwSubject: =?iso-8859-1?q?Britische_Regierung_gibt_gr=FCnes_Licht_f=FCr_Offs?=
 =?iso-8859-1?q?hore-Windkraftprojekte?=

rzdSubject: =?iso-8859-1?q?Britische_Regierung_gibt_gr=FCnes_Licht_f=FCr_Offshore-Windkraftprojekte?=

)rrrr r�r�)r6r7r8rs    r9�test_long_8bit_headerz%TestLongHeaders.test_long_8bit_header�s���
�
"�
"���i���-�|� )�
+��	���D�E�
�1�8�8�r�8�"�%,�	-���I��
�3�=�=�b�=�)�,�	�
	�3�=�=�a�=�(�+�	r;c���|j}t�}d}||d<||jd��d�t�}t|d��|d<||jd��d�y)NuhBritische Regierung gibt grünes Licht für Offshore-Windkraftprojekte <a-very-long-address@example.com>zReply-Torprtz�Reply-To: =?utf-8?q?Britische_Regierung_gibt_gr=C3=BCnes_Licht_f=C3=BCr_Offs?=
 =?utf-8?q?hore-Windkraftprojekte_=3Ca-very-long-address=40example=2Ecom=3E?=

r)rrr�r)r6r7r8�
header_strings    r9� test_long_8bit_header_no_charsetz0TestLongHeaders.test_long_8bit_header_no_charset�sv��
�
"�
"���i��=�
�(��J��
�3�=�=�b�=�)�,�	�
�i�� ��-7�9��J��
�3�=�=�b�=�)�,�	r;c�p�|j}d}t�}||d<||jd��d�y)Nz�"Someone Test #A" <someone@eecs.umich.edu>,<someone@eecs.umich.edu>, "Someone Test #B" <someone@umich.edu>, "Someone Test #C" <someone@eecs.umich.edu>, "Someone Test #D" <someone@eecs.umich.edu>r�rprtz�To: "Someone Test #A" <someone@eecs.umich.edu>,<someone@eecs.umich.edu>,
 "Someone Test #B" <someone@umich.edu>,
 "Someone Test #C" <someone@eecs.umich.edu>,
 "Someone Test #D" <someone@eecs.umich.edu>

)rrr�)r6r7r�r8s    r9�test_long_to_headerz#TestLongHeaders.test_long_to_headers@��
�
"�
"��;��
�i����D�	�
�3�=�=�b�=�)�,�	r;c��|j}d}t|�}|jd�||jd��d�y)NzIThis is an example of string which has almost the limit of header length.zAdd another line.r�rz\This is an example of string which has almost the limit of header length.
 Add another line.�rrr r��r6r7r�rs    r9�test_long_line_after_appendz+TestLongHeaders.test_long_line_after_append"sB��
�
"�
"��W���1�I��	���$�%�
�1�8�8�r�8�"�%�	r;c��|j}d}t|�}|jd�||j�d�y)NzThis is a shorter line.z!Add another sentence. (Surprise?)z9This is a shorter line. Add another sentence. (Surprise?)r}r~s    r9�test_shorter_line_with_appendz-TestLongHeaders.test_shorter_line_with_append+s<��
�
"�
"��%���1�I��	���4�5�
�1�8�8�:�F�	Hr;c�r�|j}d}d}t|d|��}||jd��d�y)Nz!X-Very-Very-Very-Long-Header-Nameu�Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an südlündischen Wandgemälden vorbei, gegen die rotierenden Klingen befördert. r=rr�ra=?iso-8859-1?q?Die_Mieter_treten_hier_e?=
 =?iso-8859-1?q?in_werden_mit_einem_Foerderband_komfortabel_den_Korridor_e?=
 =?iso-8859-1?q?ntlang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei=2C_ge?=
 =?iso-8859-1?q?gen_die_rotierenden_Klingen_bef=F6rdert=2E_?=r+)r6r7�fn�gsrs     r9�test_long_field_namez$TestLongHeaders.test_long_field_name3sE��
�
"�
"��
0����
�2�|��4��
�1�8�8�r�8�"�%A�	Br;c��d}t�}t|d��|d<||d<|j|jd��d�y)	Nz�from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; Wed, 05 Mar 2003 18:10:18 -0700rr�
Received-1�
Received-2rprta1Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by
 hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP;
 Wed, 05 Mar 2003 18:10:18 -0700
Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by
 hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP;
 Wed, 05 Mar 2003 18:10:18 -0700

�rrrr��r6rr8s   r9�test_long_received_headerz)TestLongHeaders.test_long_received_headerBsM��/���i��"�1�d�;��L����L�����c�m�m��m�<�?�	r;c��d}t�}t|dd��|d<||d<|j|jd��d�y)	Nz�<15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100")r�rr/r�rprta#Received-1: 
 <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David
 Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100")
Received-2: 
 <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David
 Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100")

r�r�s   r9�test_string_headerinst_eqz)TestLongHeaders.test_string_headerinst_eqTsR��1���i��"�1�,�37�9��L����L�����c�m�m��m�<�?�	r;c��|j}t�}d}||d<t|d��|d<d|z|d<||jd��d	�y)
Nz�iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzpzFace-1zFace-2rr,zFace-3rprta�Face-1: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp
Face-2: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp
Face-3: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp

�rrrr�)r6r7r8�ts    r9�-test_long_unbreakable_lines_with_continuationz=TestLongHeaders.test_long_unbreakable_lines_with_continuationgs`��
�
"�
"���i��
M����H�
��q�h�7��H�
��a���H�
�	�3�=�=�b�=�)�,�	r;c�|�|j}d}tj|�}||jd��d�y)Nz�Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700rprtz�Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with
 Microsoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700

)rr�r�r��r6r7r�r8s    r9�"test_another_long_multiline_headerz2TestLongHeaders.test_another_long_multiline_headers@��
�
"�
"��/���'�'��*��
�3�=�=�b�=�)�,�	r;c��|j}d}t�}||d<t|d��|d<||jd��d�y)Nz�List-Unsubscribe: <http://lists.sourceforge.net/lists/listinfo/spamassassin-talk>,        <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>�Listrrprta_List: List-Unsubscribe:
 <http://lists.sourceforge.net/lists/listinfo/spamassassin-talk>,
        <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>
List: List-Unsubscribe:
 <http://lists.sourceforge.net/lists/listinfo/spamassassin-talk>,
        <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>

r�)r6r7rr8s    r9�%test_long_lines_with_different_headerz5TestLongHeaders.test_long_lines_with_different_header�sP��
�
"�
"��%���i����F���Q�F�3��F��
�3�=�=�b�=�)�,�	r;c��ttjd�dd��}|j|j	�dztjd�dz�y)Nz�            We're going to pretend this header is in a non-ascii character set
            	to see if line wrapping with encoded words and embedded
               folding white space worksrVrF)rArr*z�            =?utf-8?q?We=27re_going_to_pretend_this_header_is_in_a_non-ascii_chara?=
             =?utf-8?q?cter_set?=
             =?utf-8?q?_to_see_if_line_wrapping_with_encoded_words_and_embedded?=
             =?utf-8?q?_folding_white_space_works?=)rr�r�r2r�r7s  r9�*test_long_rfc2047_header_with_embedded_fwsz:TestLongHeaders.test_long_rfc2047_header_with_embedded_fws�sZ���8�?�?�$,�-�#�%�
'��	
�������D��(�/�/�;7�+8�9=�	+=�	>r;)+r�r�r��maxDiffrrr&r-r0r2r8r;r=rIrKrNrPrRrTrVrYr[r]r_rbrergrirlrnrrrvryr{rr�r�r�r�r�r�r�r�r�r;r9r
r
rs����G��(�"42�l?�?�@�G�*��(	� c�c�c�+�[�*�3�	Z�>�	[�	[�	�"	�"	�$
k�*�,B� �(�*�"�H�
B��$�&�0��&>r;r
c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�TestFromManglingc�v�t�|_d|jd<|jjd�y)Nzaaa@bbb.orgr�z(From the desk of A.A.A.:
Blah blah blah
)rr8rR�r6s r9�setUpzTestFromMangling.setUp�s0���9���(������������	r;c��t�}t|d��}|j|j�|j	|j�d�y)NT��mangle_from_z<From: aaa@bbb.org

>From the desk of A.A.A.:
Blah blah blah
�rrr�r8r2r��r6r�r�s   r9�test_mangled_fromz"TestFromMangling.test_mangled_from�s@���J���a�d�+��	�	�	�$�(�(���������(�	r;c��t�}t|d��}|j|j�|j	|j�d�y)NFr�z;From: aaa@bbb.org

From the desk of A.A.A.:
Blah blah blah
r�r�s   r9�test_dont_mangle_fromz&TestFromMangling.test_dont_mangle_from�s@���J���a�e�,��	�	�	�$�(�(���������(�	r;c
�\�t�}t|d��}tjt	j
d��}|j
|�|jt|j�jd�D�cgc]}|jd�rd��c}�d�ycc}w)NTr�a)            From: foo@bar.com
            Mime-Version: 1.0
            Content-Type: multipart/mixed; boundary=XXX

            From somewhere unknown

            --XXX
            Content-Type: text/plain

            foo

            --XXX--

            From somewhere unknowable
            r*z>From r|r�)rrr�r�r�r�r�r2r�r�r�r�)r6r�r�r8r�s     r9�'test_mangle_from_in_preamble_and_epilogz8TestFromMangling.test_mangle_from_in_preamble_and_epilog�s����J���a�d�+���'�'����9�)��� 	
�	�	�#����������);�);�D�)A�=�)A�A�%&�\�\�(�%;� �)A�=�>�?@�	B��=s�B)c��tjd�jd�}tj|dz�}t�}t
|d��}|j|�|j|j�|dz�y)Nz�            Content-Type: text/plain; charset="utf-8"
            MIME-Version: 1.0
            Content-Transfer-Encoding: 8bit
            From: aaa@bbb.org

        rVsFrom Rölli
Tr�s
>From Rölli
)
r�r�r�r�r�rr
r�r2r�)r6r�r8�br�s     r9� test_mangled_from_with_bad_bytesz1TestFromMangling.test_mangled_from_with_bad_bytes�su�����"�
��V�G�_�
	��&�&�v�0F�'F�G���I���1�4�0��	�	�	�#���������v�0G�'G�Hr;c�v�tjd�jd�}tj|�}y)Nu�            From: aperson@example.com
            Content-Type: multipart/mixed; boundary="1"
            Content-Transfer-Encoding: È
        rV)r�r�r�r�r�)r6r�r8s   r9�$test_multipart_with_bad_bytes_in_ctez5TestFromMangling.test_multipart_with_bad_bytes_in_cte�s5�����"�
��V�G�_�		�
�&�&�v�.�r;N)	r�r�r�r�r�r�r�r�r�r�r;r9r�r��s"���	�	�B�.I�/r;r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestMIMEAudioc��td|��d�5}|j�|_ddd�t|j�|_y#1swY�$xYw)Nzsndhdr.r�)r'r��
_audiodatar�_au�r6�extr�s   r9�_make_audiozTestMIMEAudio._make_audio�s?��
���u�o�t�
,�� �g�g�i�D�O�-��T�_�_�-���-�
,���A	�	Ac���ddddd�j�D]I\}}|j|�|�|n|}|j|jj	�d|����Ky)Nzx-aiffzx-wav�basic)�aifc�aiff�wav�auzaudio/)r�r�r2r�rH�r6r��subtypes   r9�test_guess_minor_typez#TestMIMEAudio.test_guess_minor_typesk������	
�
�%�'��L�C��
���S�!�$�_�c�'�G����T�X�X�6�6�8�F�7�)�:L�M�r;c���|jd�|jj�}|jt	j
t
|d��|j�y)Nr�r�)r�r�rZr2rW�decodebytesr�r��r6�payloads  r9�
test_encodingzTestMIMEAudio.test_encodingsK��������(�(�&�&�(������+�+�E�'�7�,C�D����	*r;c��|jd�t|jd�}|j|j	�d�y)Nr��fishz
audio/fish)r�rr�r2rH)r6r�s  r9�test_checkSetMinorz TestMIMEAudio.test_checkSetMinors9�������
�t����
/������,�,�.��=r;c��|jd�|j}|jjddd��||jdd�||jj	d��d	d
g�||jjdd��d�g}||jjdd��d�|j
|jjd
|d��|�|j
|jjd|�|�|j
|jjd|d��|�y)Nr�rArB�	sndhdr.aurDrFz attachment; filename="sndhdr.au"r�rBr+)rEr�rEr+r���failobjr�rN)r�r2r�rHrrI�assertIs�r6r7�missings   r9�test_add_headerzTestMIMEAudio.test_add_headers8�������
�
�
�������1�<�%0�	�	2�
�4�8�8�)�*�-�	/�
�4�8�8���&;��<�� 9�:�	<�
�4�8�8���j�1F��G��	���
�4�8�8���l�3H��I�2�N��
�
�d�h�h�(�(��7�(�)�*�+2�	4�	
�
�
�d�h�h�(�(��7�;�W�E��
�
�d�h�h�(�(��w�08�)�:�;B�	Dr;N)r�r�r�r�r�r�r�r�r�r;r9r�r��s��.�
	N�*�>�
Dr;r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestMIMEImagec��td|��d�5}|j�|_ddd�t|j�|_y#1swY�$xYw)Nzpython.r�)r'r��_imgdatar�_imr�s   r9�_make_imagezTestMIMEImage._make_image3s?��
���u�o�t�
,���G�G�I�D�M�-��T�]�]�+���-�
,�r�c���dddddddddddddd�
j�D]I\}}|j|�|�|n|}|j|jj	�d|����Ky)N�jpeg�rast�rgb)
�bmp�exr�gif�jpg�pbm�pgm�png�ppm�ras�sgi�tiff�webp�xbmzimage/)r�r�r2r�rHr�s   r9r�z#TestMIMEImage.test_guess_minor_type8s����������������
��%�'��L�C��
���S�!�$�_�c�'�G����T�X�X�6�6�8�F�7�)�:L�M�#r;c���|jd�|jj�}|jt	j
t
|d��|j�y)Nr�r�)r�r�rZr2rWr�r�r�r�s  r9r�zTestMIMEImage.test_encodingLsK��������(�(�&�&�(������+�+�E�'�7�,C�D����	(r;c��|jd�t|jd�}|j|j	�d�y)Nr�r�z
image/fish)r�rr�r2rH)r6�ims  r9r�z TestMIMEImage.test_checkSetMinorRs9�������
�t�}�}�f�
-������,�,�.��=r;c��|jd�|j}|jjddd��||jdd�||jj	d��d	d
g�||jjdd��d�g}||jjdd��d�|j
|jjd
|d��|�|j
|jjd|�|�|j
|jjd|d��|�y)Nr�rArBr}rDrFz%attachment; filename="dingusfish.gif"rr�)rEr}rEr+r�r�rN)r�r2r�rHrrIr�r�s   r9r�zTestMIMEImage.test_add_headerWs:�������
�
�
�������1�<�%5�	�	7�
�4�8�8�)�*�2�	4�
�4�8�8���&;��<�� >�?�	A�
�4�8�8���j�1F��G��	���
�4�8�8���l�3H��I�2�N��
�
�d�h�h�(�(���0E�)�G�HO�	Q�	
�
�
�d�h�h�(�(��7�;�W�E��
�
�d�h�h�(�(��w�08�)�:�;B�	Dr;N)r�r�r�r�r�r�r�r�r�r;r9r�r�2s��,�
N�((�>�
Dr;r�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�TestMIMEApplicationc�x�|j}td�}||j�d�||dd�y)N�������rVrBrW)r2rrHr5s   r9�test_headersz TestMIMEApplication.test_headersns<��
�
�
���9�:��
�3���!�#=�>�
�3�*�+�X�6r;c��|j}d}t|�}||j�j�d�||jd��|�y)Nr�z+vv8/f7/TrX)r2rrZ�strip)r6r7�	bytesdatar8s    r9�	test_bodyzTestMIMEApplication.test_bodytsK��
�
�
��/�	��i�(��
�3�?�?��"�"�$�j�1�
�3�?�?�$�?�'��3r;c�`�d}t|tj��}|j|j	�dt|�z�|j|j	d��|�|j|dd�t
�}t|�}|j|�|j�}tj|�}|j|j	�dt|�z�|j|j	d��|�|j|dd�y)Nr���_encoder��TrXrEr`)rr�encode_7or8bitr2rZr�rr
r�r�r�r��r6r�r8r�r��wireform�msg2s       r9�$test_binary_body_with_encode_7or8bitz8TestMIMEApplication.test_binary_body_with_encode_7or8bit|s���/�	��i�(�2I�2I�J��������*�H�s�9�~�,E�F���������5�y�A�����8�9�6�B��I���1���	�	�	�#���:�:�<���'�'��1��������*�H�s�9�~�,E�F�����)�)��)�6�	�B�����9�:�F�Cr;c��d}t|tj��}|j|j	�dt|�z�|j|j	d��|�t
�}t|�}|j|�|j�}tj|�}|j|j	�dt|�z�|j|j	d��|�y)Nr�r�r�TrX)rr�encode_noopr2rZr�rr
r�r�r�r�r�s       r9�!test_binary_body_with_encode_noopz5TestMIMEApplication.test_binary_body_with_encode_noop�s���0�	��i�(�2F�2F�G��������*�H�s�9�~�,E�F���������5�y�A��I���1���	�	�	�#���:�:�<���'�'��1��������*�H�s�9�~�,E�F�����)�)��)�6�	�Br;c�\�d}t|tj��}|j|j	d��|�t�}t
|�}|j|�|j�}tj|�}|j|j	d��|�y)Ns������r�TrX)rrrr2rZrr
r�r�r�r�r�s       r9�0test_binary_body_with_unicode_linend_encode_noopzDTestMIMEApplication.test_binary_body_with_unicode_linend_encode_noop�s���3�	��i�(�2F�2F�G����������5�y�A��I���1���	�	�	�#���:�:�<���'�'��1������)�)��)�6�	�Br;c�0�d}t|tj��}|j|j	�d�|j|j	d��|�|j|dd�t�}t
|�}|j|�|j�}tj|�}|j|j	�d�|j|j	d��|�|j|dd�y)Ns������ r�z=FA=FB=FC=FD=FE=FF=20TrXrErC)rr�
encode_quoprir2rZrr
r�r�r�r�r�s       r9�#test_binary_body_with_encode_quopriz7TestMIMEApplication.test_binary_body_with_encode_quopri�s���0�	��i�(�2H�2H�I��������*�,C�D���������5�y�A�����8�9�;M�N��I���1���	�	�	�#���:�:�<���'�'��1��������*�,C�D�����)�)��)�6�	�B�����9�:�<N�Or;c���d}t|tj��}|j|j	�d�|j|j	d��|�t�}t
|�}|j|�|j�}tj|�}|j|j	�d�|j|j	d��|�y)Nr�r�z	+vv8/f7/
TrX)rr�
encode_base64r2rZrr
r�r�r�r�r�s       r9�#test_binary_body_with_encode_base64z7TestMIMEApplication.test_binary_body_with_encode_base64�s���/�	��i�(�2H�2H�I��������*�L�9���������5�y�A��I���1���	�	�	�#���:�:�<���'�'��1��������*�L�9�����)�)��)�6�	�Br;N)
r�r�r�r�r�r�rrrr	r�r;r9r�r�ms*��7�4�D�"C�"
C�P� Cr;r�c�f�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
jd�d	��Zy
)�TestMIMETextc�$�td�|_y�N�hello there)r�_msgr�s r9r�zTestMIMEText.setUp�s���]�+��	r;c�Z�|j}||jj�d�||jjd�d�g}|j	|jjd|�|�|j	|jjd|d��|�y)Nr?rArNrNr)r2rrHrIr�r�s   r9�
test_typeszTestMIMEText.test_types�s���
�
�
��
�4�9�9�%�%�'��6�
�4�9�9���y�)�:�6����
�
�d�i�i�)�)�(�G�<�g�F��
�
�d�i�i�)�)�)�W�X�)�N��	r;c��|j|jj�d�|j|jj	��yr
)r2rrZ�assertFalse�is_multipartr�s r9�test_payloadzTestMIMEText.test_payload�s:��������.�.�0�-�@�������/�/�1�2r;c�V�|j}tdd��}||j�jd�||dd�t	d�}d|_td|��}||j�jd�||dd�||j
�d�y)NrrNr�r@rOrVr�)r2rrFrJr
rarZrKs    r9�test_charsetzTestMIMEText.test_charset�s���
�
�
���}�z�:��
�3�?�?��*�*�J�7�
�3�~�� @�A��'�"�� $����}�w�7��
�3�?�?��*�*�G�4�
�3�~�� =�>�
�3�?�?��m�,r;c��|j}tdd��}||j�jd�||dd�y)NrrNr�r@rO)r2rrFrJr5s   r9�test_7bit_inputzTestMIMEText.test_7bit_input�s@��
�
�
���}�z�:��
�3�?�?��*�*�J�7�
�3�~�� @�Ar;c��|j}td�}||j�d�||dd�|jd|j	��y)NrrNr@rO)r2rrFr�r�r5s   r9�test_7bit_input_no_charsetz'TestMIMEText.test_7bit_input_no_charset�sL��
�
�
���}�%��
�3�?�?��j�)�
�3�~�� @�A��
�
�m�S�]�]�_�5r;c���d}|j}t|d��}||j�jd�||dd�||j	d��|jd��y)N�кирилицаrVr�r@r�TrX)r2rrF�output_charsetrZr�)r6�teststrr7r8s    r9�test_utf8_inputzTestMIMEText.test_utf8_input�sc��D��
�
�
���w��1��
�3�?�?��+�+�W�5�
�3�~�� =�>�
�3�?�?�$�?�'�����)@�Ar;zBcan't fix because of backward compat in email5, will fix in email6c�>�d}|jtt|�y)Nr)r��UnicodeEncodeErrorr)r6rs  r9�test_utf8_input_no_charsetz'TestMIMEText.test_utf8_input_no_charset�s��E�����,�h��@r;N)
r�r�r�r�rrrrrr �unittest�skipr#r�r;r9rr�sM��,��3�-�B�6�B��X�]�]���A��Ar;rc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
TestMultipartc�n�tdd�5}|j�}ddd�tddd��}td��}|j	d	d
d��td�}|j
|�|j
|�d
|d<d|d<d|d<d}tj|�}|ddk(rtj}ntj}|dkDrd}	nd}	d|	|dzfz}
tjdtj|��|
z|d<||_||_
||_y#1swY��xYw)Nr�r��	multipart�mixedr��rr})r rFrBrDz$Hi there,

This is the dingus fish.
zBarry <barry@digicool.com>r�z)Dingus Lovers <cravindogs@cravindogs.com>r�zHere is your dingus fishr�g�4F�cp�A���r�-�+z %s%04d�$z%a, %d %b %Y %H:%M:%S�Date)r'r�rrrHrrn�time�	localtime�timezone�altzone�strftimerr��_txt)r6r�r\�	containerr��intro�now�	timetuple�tzsecs�sign�tzoffsets           r9r�zTestMultipart.setUps>��
�l�D�
)�R��7�7�9�D�*��[�'�J�G�	��$�%5�6��
���.��"2�	�	4�����
	����������8�	�&��E�	�$��9�	�)�� ���N�N�3�'�	��R�=�A���]�]�F��\�\�F��A�:��D��D���f�r�k�2�2�� �M�M�#��N�N�3��!�#+�,�	�&����	������	�C*�
)�s�D*�*D4c��|j}|j}|j}|j|j	��||j�d�|t
|j��d�|t|jd�|jd�}|jd�}|j||j�|j||j�||j�||g�|j|j	��|j|j	��y)Nrkr�rr|)
r2r�rr�rrHr�rZ�
IndexErrorr�r6r�r)r6r7�raisesr��m0�m1s      r9�test_hierarchyzTestMultipart.test_hierarchy*s���
�
�
���"�"���I�I��������(�)�
�1����!2�3�
�3�q�}�}����#��z�1�=�=�!�,�
�]�]�1�
��
�]�]�1�
���
�
�b�$�)�)�$��
�
�b�$�(�(�#�
�1�=�=�?�R��H�%�������*�+�������*�+r;c�z�d}t�j|�}|j||j��y)Nz�Content-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain


--BOUNDARY


--BOUNDARY--
)rr�rr�)r6r�r8s   r9�test_empty_multipart_idempotentz-TestMultipart.test_empty_multipart_idempotent<s3�����h����%�����d�C�M�M�O�4r;c��tdd�}d|d<d|d<d|d<|jd	�|j|j�d
�y)Nr)r*�	A subjectr��aperson@dom.ainr��bperson@dom.ainr�r�z�Content-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain

--BOUNDARY

--BOUNDARY--
)rr�rr��r6�outers  r9�/test_no_parts_in_a_multipart_with_none_epiloguez=TestMultipart.test_no_parts_in_a_multipart_with_none_epilogueMsT����g�.��&��i��'��d��)��f�
�
���:�&����e�o�o�/�
2�
	r;c��tdd�}d|d<d|d<d|d<d	|_d	|_|jd
�|j	|j�d�y)Nr)r*rGr�rHr�rIr�r+r�z�Content-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain


--BOUNDARY

--BOUNDARY--
)r�preamble�epiloguer�rr�rJs  r9�0test_no_parts_in_a_multipart_with_empty_epiloguez>TestMultipart.test_no_parts_in_a_multipart_with_empty_epilogue_sb����g�.��&��i��'��d��)��f�
�������
���:�&����e�o�o�/�2�	r;c���|j}tdd�}d|d<d|d<d|d<|jd	�td
�}|j	|�||j�d�y)Nr)r*rGr�rHr�rIr�r�r��Content-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain

--BOUNDARY
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

hello world
--BOUNDARY--
)rrr�rrnr��r6r7rKr8s    r9�test_one_part_in_a_multipartz*TestMultipart.test_one_part_in_a_multiparttso��
�
"�
"����g�.��&��i��'��d��)��f�
�
���:�&��}�%��
���S��
�5�?�?���	r;c���|j}tdd�}d|d<d|d<d|d<d	|_td
�}|j	|�|jd�||j
�d�y)
Nr)r*rGr�rHr�rIr�r+r�r�aContent-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain


--BOUNDARY
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

hello world
--BOUNDARY--
�rrrNrrnr�r�rSs    r9�1test_seq_parts_in_a_multipart_with_empty_preamblez?TestMultipart.test_seq_parts_in_a_multipart_with_empty_preamble�sv��
�
"�
"����g�.��&��i��'��d��)��f�
�����}�%��
���S��
���:�&�
�5�?�?���	r;c���|j}tdd�}d|d<d|d<d|d<d|_td	�}|j	|�|jd
�||j
�d�y�Nr)r*rGr�rHr�rIr�r�r�rRrVrSs    r9�0test_seq_parts_in_a_multipart_with_none_preamblez>TestMultipart.test_seq_parts_in_a_multipart_with_none_preamble��v��
�
"�
"����g�.��&��i��'��d��)��f�
�����}�%��
���S��
���:�&�
�5�?�?���	r;c���|j}tdd�}d|d<d|d<d|d<d|_td	�}|j	|�|jd
�||j
�d�yrY�rrrOrrnr�r�rSs    r9�0test_seq_parts_in_a_multipart_with_none_epiloguez>TestMultipart.test_seq_parts_in_a_multipart_with_none_epilogue�r[r;c���|j}tdd�}d|d<d|d<d|d<d	|_td
�}|j	|�|jd�||j
�d�y)
Nr)r*rGr�rHr�rIr�r+r�r�rRr]rSs    r9�1test_seq_parts_in_a_multipart_with_empty_epiloguez?TestMultipart.test_seq_parts_in_a_multipart_with_empty_epilogue�sv��
�
"�
"����g�.��&��i��'��d��)��f�
�����}�%��
���S��
���:�&�
�5�?�?���	r;c���|j}tdd�}d|d<d|d<d|d<d	|_td
�}|j	|�|jd�||j
�d�y)
Nr)r*rGr�rHr�rIr�r*r�r�aContent-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain

--BOUNDARY
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

hello world
--BOUNDARY--

r]rSs    r9�.test_seq_parts_in_a_multipart_with_nl_epiloguez<TestMultipart.test_seq_parts_in_a_multipart_with_nl_epilogue�sv��
�
"�
"����g�.��&��i��'��d��)��f�
�����}�%��
���S��
���:�&�
�5�?�?���	r;c��|j}|jd�}|t|j��d�|jd�}||j	�d�|t|j��d�|j�D]a}||j	�d�|t|j��d�|jd�}||j	�d��cy)N�
msg_36.txtr�r|zmultipart/alternativezmessage/external-bodyrr?)r2r3r�rZrH)r6r7r8�msg1r��
subsubparts      r9�test_message_external_bodyz(TestMultipart.test_message_external_bodys���
�
�
���l�l�<�(��
�3�s��� �!�1�%����q�!��
�4� � �"�$;�<�
�3�t���!�"�A�&��'�'�)�G��w�'�'�)�+B�C��s�7�&�&�(�)�1�-� �,�,�Q�/�J��z�*�*�,�l�;�	*r;c�x�|jd�}|jt|j��d�y)Nz
msg_37.txtr�)r3r2r�rZrhs  r9�test_double_boundaryz"TestMultipart.test_double_boundary"s.���l�l�<�(������S�_�_�.�/��3r;c��|j}|jd�}t�}tj||�||j�d�y)Nz
msg_38.txtz�multipart/mixed
    multipart/mixed
        multipart/alternative
            text/plain
        text/plain
    text/plain
    text/plain
�rr3rr!�
_structurer��r6r7r8rs    r9�)test_nested_inner_contains_outer_boundaryz7TestMultipart.test_nested_inner_contains_outer_boundary)sI��
�
"�
"��
�l�l�<�(���j�����S�#�&�
�3�<�<�>��	r;c��|j}|jd�}t�}tj||�||j�d�y)Nz
msg_39.txtz�multipart/mixed
    multipart/mixed
        multipart/alternative
        application/octet-stream
        application/octet-stream
    text/plain
rkrms    r9�test_nested_with_same_boundaryz,TestMultipart.test_nested_with_same_boundary<sI��
�
"�
"���l�l�<�(���j�����S�#�&�
�3�<�<�>��	r;c�f�|jd�}|j|j�d�y)Nz
msg_40.txtz�MIME-Version: 1.0
Content-Type: text/html; boundary="--961284236552522269"

----961284236552522269
Content-Type: text/html;
Content-Transfer-Encoding: 7Bit

<html></html>

----961284236552522269--
)r3r2r�rhs  r9�test_boundary_in_non_multipartz,TestMultipart.test_boundary_in_non_multipartMs+���l�l�<�(���������+�	r;c���|j}tjd�}|j|j	��||j�d�|t
|j��d�y)Nz�MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="    XXXX"

--    XXXX
Content-Type: text/plain


--    XXXX
Content-Type: text/plain

--    XXXX--
z    XXXXr�)r2r�r�r�rr�r�rZr5s   r9� test_boundary_with_leading_spacez.TestMultipart.test_boundary_with_leading_space\sb��
�
�
���'�'�)���	
����(�(�*�+�
�3����z�*�
�3�s��� �!�1�%r;c��t�jd�}|j|jd�j�d�y)Nz�Content-Type: multipart/mixed; boundary="===============0012394164=="
MIME-Version: 1.0

--===============0012394164==
Content-Type: image/file1.jpg
MIME-Version: 1.0
Content-Transfer-Encoding: base64

YXNkZg==
--===============0012394164==--rzYXNkZg==)rr�r2rZr�s  r9�&test_boundary_without_trailing_newlinez4TestMultipart.test_boundary_without_trailing_newlineos=���H���
#�

$��	
������q�)�5�5�7��Dr;c��tdd�}|j|jtjj�y)Nr)r*)rr�r�r��compat32r�s  r9�test_mimebase_default_policyz*TestMultipart.test_mimebase_default_policy}s*���[�'�*���
�
�a�h�h���� 5� 5�6r;c��tddtjj��}|j	|jtjj�y)Nr)r*r�)rr�r��defaultr�r�s  r9�test_mimebase_custom_policyz)TestMultipart.test_mimebase_custom_policy�s6���[�'�%�,�,�2F�2F�G���
�
�a�h�h���� 4� 4�5r;N)r�r�r�r�rCrErLrPrTrWrZr^r`rbrgrirnrprrrtrvryr|r�r;r9r'r'sh��"�H,�$5�"�$�*�2�8�6�6�6�6<�4��&�"
�&�&E�7�6r;r'c�~�eZdZd�Zd�Zd�Zejd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zy)�TestNonConformantc���|j}|jd�}||j�d�||j�d�||j	�d�y)Nz
msg_14.txtr?r�r�)r2r3rHrnr�r5s   r9�test_parse_missing_minor_typez/TestNonConformant.test_parse_missing_minor_type�sT��
�
�
���l�l�<�(��
�3���!�<�0�
�3�#�#�%�v�.�
�3�"�"�$�g�.r;c�"�|jd�}|jd�}|jt|d��|j	t|j�d�|j|jdtj�y)N�
msg_15.txtrr�r|)
r3rZr��hasattrr2r�r�r�r �StartBoundaryNotFoundDefect)r6r8�inners   r9�test_same_boundary_inner_outerz0TestNonConformant.test_same_boundary_inner_outer�sm���l�l�<�(������"�������y�1�2�����U�]�]�+�Q�/����e�m�m�A�.�$�@�@�	Br;c�l�|jd�}|j|j�t�|j	t|j�d�|j|jdtj�|j|jdtj�y)Nz
msg_25.txtr�rr|)
r3r�rZr�r2r�r�r �NoBoundaryInMultipartDefect�!MultipartInvariantViolationDefectrhs  r9�test_multipart_no_boundaryz,TestNonConformant.test_multipart_no_boundary�s����l�l�<�(�����c�o�o�/��5�����S�[�[�)�1�-����c�k�k�!�n�$�@�@�	B����c�k�k�!�n�$�F�F�	Hr;a^        Date: Wed, 14 Nov 2007 12:56:23 GMT
        From: foo@bar.invalid
        To: foo@bar.invalid
        Subject: Content-Transfer-Encoding: base64 and multipart
        MIME-Version: 1.0
        Content-Type: multipart/mixed;
            boundary="===============3344438784458119861=="{}

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

        Test message

        --===============3344438784458119861==
        Content-Type: application/octet-stream
        Content-Transfer-Encoding: base64

        YWJj

        --===============3344438784458119861==--
        c��|j|jjd��}|jt	|j
�d�|j
|j
dtj�y)Nz"
Content-Transfer-Encoding: base64r|r)	�_str_msg�
multipart_msgr�r2r�r�r�r �-InvalidMultipartContentTransferEncodingDefectrhs  r9�test_multipart_invalid_ctez,TestNonConformant.test_multipart_invalid_cte�sa���m�m����%�%�&K�L�N������S�[�[�)�1�-����c�k�k�!�n��@�@�	Br;c��|j|jjd��}|jt	|j
�d�y)Nr+r�r�r�r�r2r�r�rhs  r9�test_multipart_no_cte_no_defectz1TestNonConformant.test_multipart_no_cte_no_defect�s:���m�m�D�.�.�5�5�b�9�:������S�[�[�)�1�-r;c���dD]`}|j|jjdj|���}|jt	|j
�d��by)N)r�r`�BINaryz
Content-Transfer-Encoding: {}rr�)r6r�r8s   r9�"test_multipart_valid_cte_no_defectz4TestNonConformant.test_multipart_valid_cte_no_defect�sY��-�C��-�-��"�"�)�)�5�<�<�S�A�C�D�C�
���S����-�q�1�	.r;c���|j}|j}t�}d|d<||j�d�||j	�d�||j�d�|d=d|d<||j�d�||j	�d�||j�d�t
�}t|�}|j|�||j�d�y)Nr�rDr�r?r@r�zContent-Type: foo

)
r2rrrnr�rHrrr�r�)r6r7�neqr8r�r�s      r9�test_invalid_content_typez+TestNonConformant.test_invalid_content_type�s���
�
�
���#�#���i��$��N��
�3�#�#�%�v�.�
�3�"�"�$�g�.�
�3���!�<�0����#��N��
�3�#�#�%�v�.�
�3�"�"�$�g�.�
�3���!�<�0��J���a�L��	�	�	�#���A�J�J�L�1�2r;c�l�|j}|jd�}||j�d�y)N�
msg_31.txtzm--BOUNDARY
Content-Type: text/plain

message 1

--BOUNDARY
Content-Type: text/plain

message 2

--BOUNDARY--
)rr3rZr5s   r9�test_no_start_boundaryz(TestNonConformant.test_no_start_boundary�s1��
�
"�
"���l�l�<�(��
�3�?�?���	r;c�l�|j}|jd�}||j�d�y)Nz
msg_35.txtz�From: aperson@dom.ain
To: bperson@dom.ain
Subject: here's something interesting

counter to RFC 2822, there's no separating newline here
)rr3r�r5s   r9�test_no_separating_blank_linez/TestNonConformant.test_no_separating_blank_line�s0��
�
"�
"���l�l�<�(��
�3�=�=�?��	r;c�Z�|jd�}|jt|d��|jt	|j
�d�|j
|j
dtj�|j
|j
dtj�y)Nz
msg_41.txtr�r�rr|)
r3r�r�r2r�r�r�r r�r�rhs  r9�test_lying_multipartz&TestNonConformant.test_lying_multipart	s����l�l�<�(�������Y�/�0�����S�[�[�)�1�-����c�k�k�!�n�$�@�@�	B����c�k�k�!�n�$�F�F�	Hr;c�
�|jd�}|jd�jd�}|jt|j�d�|j|jdtj�y)Nz
msg_42.txtr|r)r3rZr2r�r�r�r r�)r6rK�bads   r9�test_missing_start_boundaryz-TestNonConformant.test_missing_start_boundary	sh�����\�*������"�.�.�q�1������S�[�[�)�1�-����c�k�k�!�n�$�@�@�	Br;c�v�|j}d}tj|�}||j�dg�||j	�d�|t|j�d�|j|jtjg�||jdjd�y)Nz Line 1
Subject: test

bodyr��bodyr|rz Line 1
)r2r�r�r�rZr�r��assertDefectsEqualr �#FirstHeaderLineIsContinuationDefect�liner�s    r9�&test_first_line_is_continuation_headerz8TestNonConformant.test_first_line_is_continuation_header	s���
�
�
��,���'�'��*��
�3�8�8�:�	�{�#�
�3�?�?��f�%�
�3�s�{�{��Q��������"(�"L�"L�!M�	O�
�3�;�;�q�>����,r;c��|jd�}|j|j�dg�|j|j�d�|j	|j
tjg�y)Nz&Subject: test
not a header
To: abc

b
r�znot a header
To: abc

b
)r�r2r�rZr�r�r � MissingHeaderBodySeparatorDefectrhs  r9�"test_missing_header_body_separatorz4TestNonConformant.test_missing_header_body_separator(	sd��
�m�m�I�J���������i�[�1�������*�,J�K�������!'�!H�!H� I�	Kr;N)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;r9r~r~�s`��/�B�H�$�H�O�O�%�
�M�0B�.�
2�3�*�"	�H�
B� 	-�	Kr;r~c�l�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�TestRFC2047c���|j}d}t|�}||gd��t|�}|t|�d�|j	|jd��d�y)NzVRe: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz
 foo bar =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=))sRe: N�s
r�ksm�rg�szmac-iceland)s
 baz foo bar Nr�u+Re: räksmörgås baz foo bar räksmörgåsr�rziRe: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar =?mac-iceland?q?r=8Aksm?=
 =?mac-iceland?q?=9Arg=8Cs?=)r2rrr�rr��r6r7r��dhr�s     r9�test_rfc2047_multilinez"TestRFC2047.test_rfc2047_multiline6	sj��
�
�
��
/��
�1�
��
�2�5�	6�
�R���
�3�v�;�D�	F����f�m�m�r�m�:�= �	!r;c��|j}d}t|�}||ddg�tt|��}||d�y)Nz0=?ISO-8859-1?Q?Andr=E9?= Pirard <pirard@dom.ain>)sAndr�r=)s Pirard <pirard@dom.ain>NuAndré Pirard <pirard@dom.ain>�r2rr�rr�s     r9�test_whitespace_keeper_unicodez*TestRFC2047.test_whitespace_keeper_unicodeG	sJ��
�
�
��>��
�1�
��
�2�+�3�5�	6��[��_�%��
�6�5�6r;c��|j}d}t|�}||gd��tt|��}||d�y)NzWThe =?iso-8859-1?b?cXVpY2sgYnJvd24gZm94?= jumped over the =?iso-8859-1?b?bGF6eSBkb2c=?=))sThe N)squick brown foxr=)s jumped over the N)slazy dogr=z,The quick brown fox jumped over the lazy dogr�)r6r7r�r��hus     r9� test_whitespace_keeper_unicode_2z,TestRFC2047.test_whitespace_keeper_unicode_2P	sF��
�
�
��e��
�1�
��
�2�K�	L�
��R��
!��
�2�=�>r;c�F�d}t|�}|j|gd��y)Nz3Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord))sSmN���r=)srgN���r=)ssbordN�rr2�r6r�r�s   r9�test_rfc2047_missing_whitespacez+TestRFC2047.test_rfc2047_missing_whitespaceY	s&��A��
�1�
������0�	1r;c�F�d}t|�}|j|gd��y)Nz7Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord))sSm Nr�)s rg Nr�)s sbordNr�r�s   r9�test_rfc2047_with_whitespacez(TestRFC2047.test_rfc2047_with_whitespace`	s&��E��
�1�
������1�	2r;c�j�d}gd�}|D](\}}t||z�}|j||dfg��*y)Nz=?iso-8859-1?B?%s?=))zdm==�v)zdm=r�)�dmr�)zdmk=�vi)�dmkr�r=r�)r6r�r\�q�ar�s      r9�test_rfc2047_B_bad_paddingz&TestRFC2047.test_rfc2047_B_bad_paddingg	sD��!�����D�A�q��q�1�u�%�B����R�1�l�"3�!4�5�r;c�@�d}|jt|�dg�y)Nz=?iso-8859-1?Q?andr=e9=zz?=)sandr�=zzr=�r2r�r6r�s  r9�test_rfc2047_Q_invalid_digitsz)TestRFC2047.test_rfc2047_Q_invalid_digitsq	s"��)������q�)�7�8�	:r;c�B�d}|jt|�gd��y)Nz(=?ISO-8859-1?Q?a?=))��(N��ar=��)Nr�r�s  r9�test_rfc2047_rfc2047_1z"TestRFC2047.test_rfc2047_rfc2047_1w	s ��"������q�)�>�	@r;c�B�d}|jt|�gd��y)Nz(=?ISO-8859-1?Q?a?= b))r�r�)s b)Nr�r�s  r9�test_rfc2047_rfc2047_2z"TestRFC2047.test_rfc2047_rfc2047_2}	� ��$������q�)�@�	Br;c�B�d}|jt|�gd��y)Nz'(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)�r�)sabr=r�r�r�s  r9�test_rfc2047_rfc2047_3z"TestRFC2047.test_rfc2047_rfc2047_3�	s ��5������q�)�?�	Ar;c�B�d}|jt|�gd��y)Nz((=?ISO-8859-1?Q?a?=  =?ISO-8859-1?Q?b?=)r�r�r�s  r9�test_rfc2047_rfc2047_4z"TestRFC2047.test_rfc2047_rfc2047_4�	s ��6������q�)�?�	Ar;c�B�d}|jt|�gd��y)Nz,(=?ISO-8859-1?Q?a?=
    =?ISO-8859-1?Q?b?=)r�r�r�s  r9�test_rfc2047_rfc2047_5az#TestRFC2047.test_rfc2047_rfc2047_5a�	s ��<������q�)�?�	Ar;c�B�d}|jt|�gd��y)Nz+(=?ISO-8859-1?Q?a?=
    =?ISO-8859-1?Q?b?=)r�r�r�s  r9�test_rfc2047_rfc2047_5bz#TestRFC2047.test_rfc2047_rfc2047_5b�	s ��:������q�)�?�	Ar;c�B�d}|jt|�gd��y)Nz(=?ISO-8859-1?Q?a_b?=))r�)sa br=r�r�r�s  r9�test_rfc2047_rfc2047_6z"TestRFC2047.test_rfc2047_rfc2047_6�	r�r;c	��d}|jt|�gd��|jtt|��j�|j	��|jttt|���d�y)Nz((=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=))r�r�)s brrr�z(a b))r2rrr�r�r�r�s  r9�test_rfc2047_rfc2047_7z"TestRFC2047.test_rfc2047_rfc2047_7�	sk��6������q�)�
�	�	
����]�1�%5�6�=�=�?�����K�����[��q�)9�:�;�W�Er;c	�:�d}|jt|�ddg�|jtt|��j�dj	|j���|jt
tt|���d�y)Nz9=?windows-1252?q?=22M=FCller_T=22?=
 <T.Mueller@xxx.com>)s
"M�ller T"zwindows-1252)s<T.Mueller@xxx.com>Nr+u"Müller T" <T.Mueller@xxx.com>)r2rrr�r��
splitlinesr�r�s  r9�test_multiline_headerz!TestRFC2047.test_multiline_header�	s���I������q�)�
/�
+�
-�	.�	
����]�1�%5�6�=�=�?��������0�	2�����[��q�)9�:�;�:�	<r;N)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;r9r�r�5	sZ��!�"7�?�1�2�6�:�@�B�A�A�A�A�B�F�<r;r�c�l�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�TestMIMEMessagec�r�tdd��5}|j�|_ddd�y#1swYyxYw)N�
msg_11.txtrVr�)r'r��_text�r6r�s  r9r�zTestMIMEMessage.setUp�	s'��
�l�W�
5������D�J�6�
5�
5�s�-�6c�:�|jttd�y)Nza plain string)r�rmrr�s r9�test_type_errorzTestMIMEMessage.test_type_error�	s�����)�[�2B�Cr;c�8�|j}d}t�}||d<t|�}||j�d�|j	�}|j|t�|t|�d�|d}|j||�||d|�y)Nz
A sub-messager�r[r|r�subject)	r2rrrHrZr��listr�r�)r6r7r�r��rr�r�s       r9�test_valid_argumentz#TestMIMEMessage.test_valid_argument�	s���
�
�
��!���I����)����N��
�1����!1�2��-�-�/�����g�t�,�
�3�w�<����!�*���
�
�g�q�!�
�7�9��w�'r;c��t�}d|d<t�}d|d<t|�}|jtj|j
|�y)N�	subpart 1r�z	subpart 2)rrr�r �MultipartConversionErrorrn)r6rer�r�s    r9�test_bad_multipartz"TestMIMEMessage.test_bad_multipart�	sH���y��%��Y���y��%��Y���������&�9�9�1�8�8�T�Jr;c���t�}d|d<|jd�t|�}d|d<t�}t	|�}|j|�|j
|j�d�y)N�An enclosed messager��!Here is the body of the message.
zThe enclosing messagez�Content-Type: message/rfc822
MIME-Version: 1.0
Subject: The enclosing message

Subject: An enclosed message

Here is the body of the message.
)rrRrrrr�r2r�)r6r�r�r�r�s     r9�
test_generatezTestMIMEMessage.test_generate�	sg���I��,��)��	�
�
�:�;���N��.��)���J���a�L��	�	�	�!���������(�	r;c�X�|j}|jd�}||j�d�|j�}|j	|t
�|t
|�d�|d}|j	|t�||dd�||j�d�y)Nr�r[r|rr�r�r�)r2r3rHrZr�r�r�r)r6r7r8r��submsgs     r9�test_parse_message_rfc822z)TestMIMEMessage.test_parse_message_rfc822�	s���
�
�
���l�l�<�(��
�3���!�#3�4��/�/�#�����g�t�,�
�3�w�<����������f�g�.�
�6�)��3�4�
�6����!E�Fr;c���|j}|jd�}||j�d�|j|j	��|t|j
��d�|j
d�}||j�d�||j
�d�|j
d�}||j�d�|t|j
��d	�|j
d�}|j|t�||d
d�||jdd
��d�||jdd
��d�|j
d�}|j|t�||dd�||jd��ddg�||jdd��d�|j
d	�}||j�d�|j
�}|j|t�|t|�d�|d}|j|t�||j�d�||dd�y)N�
msg_16.txtr8r�rr?a�This report relates to a message you sent with the following header fields:

  Message-id: <002001c144a6$8752e060$56104586@oxy.edu>
  Date: Sun, 23 Sep 2001 20:10:55 -0700
  From: "Ian T. Henry" <henryi@oxy.edu>
  To: SoCal Raves <scr@socal-raves.org>
  Subject: [scr] yeah for Ians!!

Your message cannot be delivered to the following recipients:

  Recipient address: jangel1@cougar.noc.ucla.edu
  Reason: recipient reached disk quota

r|zmessage/delivery-statusr�zoriginal-envelope-idz"0GK500B4HD0888@cougar.noc.ucla.edu�dnsz
reporting-mtarr+�nsd�action�failedzoriginal-recipient)r�r+)zjangel1@cougar.noc.ucla.edur+r�zfinal-recipientr[�
message-idz(<002001c144a6$8752e060$56104586@oxy.edu>)r2r3rHr�rr�rZr�rrIrr�)r6r7r8r��dsn1�dsn2r�rfs        r9�test_dsnzTestMIMEMessage.test_dsn�	s"��
�
�
���l�l�<�(��
�3���!�#5�6�����(�(�*�+�
�3�s��� �!�1�%��/�/�!�$��
�7�#�#�%�|�4�
�7��� �#�	�$�/�/�!�$��
�7�#�#�%�'@�A�
�3�w�"�"�$�%�q�)��"�"�1�%�����d�G�,�
�4�&�'�)M�N�
�4�>�>�%��>�8�"�=�
�4�>�>�%��>�8�$�?��"�"�1�%�����d�G�,�
�4��>�8�$�
�4�?�?�"6�?�7��?�@�	B�
�4�>�>�(�+<�>�=�r�B��/�/�!�$��
�7�#�#�%�'7�8��%�%�'�����g�t�,�
�3�w�<����Q�Z�
����j�'�2�
�:�&�&�(�,�7�
�:�l�#�5�	7r;c���|j}tdd��5}|j�}ddd�t�}d|d<d|d<d|d	<d
|_d|_t
d�}t
d
�}|jddd��|j|�|j|�t�}t|�}|j|�||j��y#1swY��xYw)N�
msg_21.txtrVr�rHr�rIr�rFr��MIME messagezEnd of MIME message
r�r�rDrkr�r+)
rr'r�rrNrOrrHrnrrr�r�)	r6r7r�r�r8rer�rr�s	         r9�
test_epiloguezTestMIMEMessage.test_epilogue-
s���
�
"�
"��
�l�W�
5���7�7�9�D�6��i��'��F��%��D�	���I��%���.��������������~�'8�:��N��
�
�4���
�
�4���j���c�N��	�	�	�#��
�3�<�<�>�4� �!6�
5�s�C$�$C-c�0�|j}t�}d|d<d|d<d|d<d|_d|_t	d	�}t	d
�}|jddd
��|j
|�|j
|�||j�d�y)NrHr�rIr�rFr�rr+r�r�rDrkr�r+adFrom: aperson@dom.ain
To: bperson@dom.ain
Subject: Test
Content-Type: multipart/mixed; boundary="BOUNDARY"

MIME message
--BOUNDARY
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

One
--BOUNDARY
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

Two
--BOUNDARY--
)rrrNrOrrHrnr�)r6r7r8rer�s     r9�test_no_nl_preamblez#TestMIMEMessage.test_no_nl_preambleA
s���
�
"�
"���i��'��F��%��D�	���I��%�����������������~�'8�:��N��
�
�4���
�
�4��
�3�=�=�?��	r;c��|j}tdd��5}tj|�}ddd�j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�y#1swY��xYw)Nr_rVr�rr[r|r?�r2r'r��message_from_filerZ�get_default_typerH�r6r7r�r8�
container1�
container2�container1a�container2as        r9�test_default_typez!TestMIMEMessage.test_default_typed
���
�
�
��
�l�W�
5���)�)�"�-�C�6��_�_�Q�'�
�
�:�&�&�(�*:�;�
�:�&�&�(�*:�;��_�_�Q�'�
�
�:�&�&�(�*:�;�
�:�&�&�(�*:�;� �,�,�Q�/��
�;�'�'�)�<�8�
�;�'�'�)�<�8� �,�,�Q�/��
�;�'�'�)�<�8�
�;�'�'�)�<�8�6�
5���D5�5D?c��|j}tdd��5}tj|�}ddd�j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�|j	d�}||j�d�||j
�d�y#1swY��xYw)NrdrVr�rr[r|r?rrs        r9�.test_default_type_with_explicit_container_typez>TestMIMEMessage.test_default_type_with_explicit_container_typeu
rrc���|j}|j}tdd�}d|_t	d�}t	d�}t|�}t|�}|j
|�|j
|�||j�d�||j�d�||j�d�||j�d�||jd�d�|d	=|d
=|d	=|d
=||j�d�||j�d�||j�d�||j�d�||jd�d�y)N�digestr�r+�
message 1
�
message 2
r[ra�Content-Type: multipart/digest; boundary="BOUNDARY"
MIME-Version: 1.0

--BOUNDARY
Content-Type: message/rfc822
MIME-Version: 1.0

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

message 1

--BOUNDARY
Content-Type: message/rfc822
MIME-Version: 1.0

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

message 2

--BOUNDARY--
r@r>aBContent-Type: multipart/digest; boundary="BOUNDARY"
MIME-Version: 1.0

--BOUNDARY

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

message 1

--BOUNDARY

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

message 2

--BOUNDARY--
)
r2rrrOrrrnrHrr�)r6r7r�r7�	subpart1a�	subpart2a�subpart1�subpart2s        r9�test_default_type_non_parsedz,TestMIMEMessage.test_default_type_non_parsed�
sf��
�
�
���#�#��!�(�J�7�	��	���]�+�	��]�+�	��y�)���y�)������"�����"�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9��I����"�%�	�4
�^�$��^�$��^�$��^�$�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9�
�8�$�$�&�(8�9��I����"�%�	r;c��|j}td�}td�}t||f��}|t|j	��d�||j	d�|�||j	d�|�y)Nr+)�	_subpartsr�rr|)r2rrr�rZ)r6r7�text1�text2r8s     r9�$test_mime_attachments_in_constructorz4TestMIMEMessage.test_mime_attachments_in_constructor�
si��
�
�
�����������u�e�n�5��
�3�s��� �!�1�%�
�3�?�?�1��u�%�
�3�?�?�1��u�%r;c�V�t�}|j|j��yrf)rr�rrhs  r9�"test_default_multipart_constructorz2TestMIMEMessage.test_default_multipart_constructor�
s���o������(�(�*�+r;c�r�t�}d|d<d|d<|j|jd�ddg�y)N�a@b.comr��c@d.comr�)rr2r4rhs  r9�test_multipart_default_policyz-TestMIMEMessage.test_multipart_default_policy�
s9���o����D�	���D�	�������T�*�Y�	�,B�Cr;c��ttjj��}d|d<|j	t
�5}d|d<ddd�|j
tj�d�y#1swY�/xYw)Nr�r1r�r2z.There may be at most 1 To headers in a message)	rr�r�r{r�rRr2r��	exception)r6r8�cms   r9�test_multipart_custom_policyz,TestMIMEMessage.test_multipart_custom_policy�
sc���5�<�<�#7�#7�8����D�	�
�
�
�z�
*�b�!�C��I�+�����R�\�\�*�I�	K�+�
*�s�A3�3A<N)r�r�r�r�r�r�r�r�rrrrrrr(r-r/r3r7r�r;r9r�r��	s[��#�D�(�K��(
G�77�r!�(!�F9�"9�"H�T&�,�D�Kr;r�c��eZdZd�Zd�Zy)�TestNonMultipartc�Z�tdd�}|j|j��y)Nr�r�)rrrrhs  r9�"test_nonmultipart_is_not_multipartz3TestNonMultipart.test_nonmultipart_is_not_multipart�
s%���v�w�/������)�)�+�,r;c��t�}d|d<tdd�}|jtj|j
|�y)Nr�r�r�r�)rrr�r r�rn)r6r8r�s   r9�test_attach_raises_exceptionz-TestNonMultipart.test_attach_raises_exception�
s:���i��$��I���V�W�-�����&�9�9�1�8�8�S�Ir;N)r�r�r�r;r=r�r;r9r9r9�
s
��-�Jr;r9c��eZdZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TestIdempotentr*c��t|d��5}|j�}ddd�tj�}||fS#1swY�"xYw�NrVr��r'r�r�r��r6rEr�r\r8s     r9r3zTestIdempotent._msgobjsA��
�h��
1�R��7�7�9�D�2��'�'��-���D�y��2�
1�s�A�A	c��|j}t�}t|d��}|j||��|||j	��y)Nrrtr�)rrrr�r�)r6r8r�r�r7r�r�s       r9�_idempotentzTestIdempotent._idempotents@��
�
"�
"���J���a�a�(��	�	�	�#��	�)�
�4�����r;c��|j}|jd�\}}||j�d�||j�d�||j	�d�||j�dd�||j
d�d�||jd�||jd�|j||�y)	Nr�r?r�r�r|)rArNrArN)
r2r3rHrnr�rrIrNrOrE�r6r7r8r�s    r9�test_parse_text_messagez&TestIdempotent.test_parse_text_messages���
�
�
���L�L��.�	��T�
�3���!�<�0�
�3�#�#�%�v�.�
�3�"�"�$�g�.�
�3�>�>��A�� 7�8�
�3�=�=��#�Z�0�
�3�<�<���
�3�<�<�������d�#r;c���|j}|jd�\}}||j�d�||j�d�||j	d�d�|j||�y)Nr�r?rA)r2r3rHrrIrErGs    r9�test_parse_untyped_messagez)TestIdempotent.test_parse_untyped_messagesf��
�
�
���L�L��.�	��T�
�3���!�<�0�
�3�>�>��T�"�
�3�=�=��#�T�*�����d�#r;c�P�|jd�\}}|j||�y)Nry�r3rE�r6r8r�s   r9�test_simple_multipartz$TestIdempotent.test_simple_multipart#�$���L�L��.�	��T�����d�#r;c�P�|jd�\}}|j||�y)N�
msg_02.txtrLrMs   r9�test_MIME_digestzTestIdempotent.test_MIME_digest'rOr;c�P�|jd�\}}|j||�y)Nz
msg_27.txtrLrMs   r9�test_long_headerzTestIdempotent.test_long_header+rOr;c�P�|jd�\}}|j||�y)NrdrLrMs   r9�"test_MIME_digest_with_part_headersz1TestIdempotent.test_MIME_digest_with_part_headers/rOr;c�P�|jd�\}}|j||�y)N�
msg_06.txtrLrMs   r9�test_mixed_with_imagez$TestIdempotent.test_mixed_with_image3rOr;c�P�|jd�\}}|j||�y)Nr6rLrMs   r9�test_multipart_reportz$TestIdempotent.test_multipart_report7rOr;c�P�|jd�\}}|j||�y)NrrLrMs   r9rzTestIdempotent.test_dsn;rOr;c�P�|jd�\}}|j||�y)Nr
rLrMs   r9�test_preamble_epiloguez%TestIdempotent.test_preamble_epilogue?rOr;c�P�|jd�\}}|j||�y)Nz
msg_23.txtrLrMs   r9�test_multipart_one_partz&TestIdempotent.test_multipart_one_partCrOr;c�P�|jd�\}}|j||�y)Nz
msg_24.txtrLrMs   r9�test_multipart_no_partsz&TestIdempotent.test_multipart_no_partsGrOr;c�P�|jd�\}}|j||�y)Nr�rLrMs   r9r�z%TestIdempotent.test_no_start_boundaryKrOr;c�P�|jd�\}}|j||�y)N�
msg_32.txtrLrMs   r9�test_rfc2231_charsetz#TestIdempotent.test_rfc2231_charsetOrOr;c�P�|jd�\}}|j||�y)Nz
msg_33.txtrLrMs   r9�test_more_rfc2231_parametersz+TestIdempotent.test_more_rfc2231_parametersSrOr;c�P�|jd�\}}|j||�y)Nz
msg_34.txtrLrMs   r9�%test_text_plain_in_a_multipart_digestz4TestIdempotent.test_text_plain_in_a_multipart_digestWrOr;c�P�|jd�\}}|j||�y)Nzmsg_12a.txtrLrMs   r9�test_nested_multipart_mixedsz+TestIdempotent.test_nested_multipart_mixeds[s$���L�L��/�	��T�����d�#r;c�P�|jd�\}}|j||�y)NrdrLrMs   r9�%test_message_external_body_idempotentz4TestIdempotent.test_message_external_body_idempotent_rOr;c�T�|jd�\}}|j||d��y)N�
msg_43.txtTr�rLrMs   r9�test_message_delivery_statusz+TestIdempotent.test_message_delivery_statuscs)���L�L��.�	��T�����d�T��2r;c�P�|jd�\}}|j||�y�N�
msg_45.txtrLrMs   r9�test_message_signed_idempotentz-TestIdempotent.test_message_signed_idempotentgrOr;c�4�|j}|jd�\}}||j�d�i}|j�D]
\}}|||<�||dd�||dd�||jd|j
z�||j|j
�|t|j��d�|jd	�}||j�d
�||j�d|j
z�|jd�}||j�d
�||j�d|j
z�|jd
�}	||	j�d�|j|	t�|	j�}
|j|
t�|t|
�d�|
d	}|j|t�||j�d|j
z�y)Nr6r8r9r:rr<z$This is a MIME-encapsulated message.r�rr?zYadda yadda yaddar|r�r[)r2r3rHrrNr�rOr�rZr�rr�)r6r7r8r��params�pk�pvrer��msg3r��msg4s            r9�test_content_typez TestIdempotent.test_content_typeks���
�
�
���L�L��.�	��T�
�3���!�#5�6����n�n�&�F�B���F�2�J�'�
�6�-� �"3�4�
�6�*��F�G�
�3�<�<�?�$�,�,�N�O�
�3�<�<����&�
�3�s��� �!�1�%����q�!��
�4� � �"�L�1�
�4����2�T�\�\�A�B����q�!��
�4� � �"�L�1�
�4����2�T�\�\�A�B����q�!��
�4� � �"�$4�5����d�G�,��"�"�$�����g�t�,�
�3�w�<����q�z�����d�G�,�
�4����2�T�\�\�A�Br;c���|j}|jd�\}}||j�d�|j�}|j	|t
�|t
|�d�|d}|j	|t�||j�d�|j	|j�t�||j�|j�y)NrXr[r|rr?)
r2r3rHrZr�r�r�rr�r�)r6r7r8r�r�res      r9�test_parserzTestIdempotent.test_parser�s���
�
�
���L�L��.�	��T�
�3���!�#3�4��/�/�#�����g�t�,�
�3�w�<����q�z�����d�G�,�
�4� � �"�L�1����d�.�.�0�#�6�
�4����t�|�|�,r;N�F)r�r�r�r�r3rErHrJrNrRrTrVrYr[rr^r`rbr�rfrhrjrlrnrqrur|r~r�r;r9r?r?�
s����G���
$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�3�$�C�>-r;r?c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-e.j^�e0jbd,�d-���Z2d.�Z3d/�Z4d0�Z5d1�Z6d2�Z7d3�Z8d4�Z9d5�Z:d6�Z;d7�Z<d8�Z=d9�Z>d:�Z?d;�Z@d<�ZAy=)>�TestMiscellaneousc�"�tdd��5}|j�}ddd�tj�}t	�}t|d��}|j
|�|j||j��y#1swY�gxYw�Nr�rVr�rrt�	r'r�r�r�rrr�r2r��r6r�r�r8r�r�s      r9�test_message_from_stringz*TestMiscellaneous.test_message_from_string�sm��
�l�W�
5���7�7�9�D�6��'�'��-���J��
�a�a�(��	�	�	�#������q�z�z�|�,�6�
5�s�B�Bc�D�tdd��5}|j�}|jd�tj|�}t�}t
|d��}|j|�|j||j��ddd�y#1swYyxYwr�)
r'r��seekr�rrrr�r2r�r�s      r9�test_message_from_filez(TestMiscellaneous.test_message_from_file�sv��
�l�W�
5���7�7�9�D��G�G�A�J��)�)�"�-�C��
�A��!�!�,�A�
�I�I�c�N����T�1�:�:�<�0�6�
5�
5�s�A?B�Bc��tdd��5}|j�}ddd�Gd�dt�}tj|�}|j||�tdd��5}|j�}ddd�tj||�}|j
�D]}|j||��y#1swY��xYw#1swY�SxYw)Nr�rVr�c��eZdZy)�HTestMiscellaneous.test_message_from_string_with_class.<locals>.MyMessageN�r�r�r�r�r;r9�	MyMessager�����r;r�rQ)r'r�rr�r�r��walk)r6r�r�r�r8r�s      r9�#test_message_from_string_with_classz5TestMiscellaneous.test_message_from_string_with_class�s���
�l�W�
5���7�7�9�D�6�	��	��'�'��i�8�����c�9�-�
�l�W�
5���7�7�9�D�6��'�'��i�8���x�x�z�G��!�!�'�9�5�"�6�
5��6�
5�s�C�+C�C�Cc�t�Gd�dt�}tdd��5}tj||�}ddd�|j	|�tdd��5}tj||�}ddd�|j�D]}|j	||��y#1swY�oxYw#1swY�=xYw)Nc��eZdZy)�FTestMiscellaneous.test_message_from_file_with_class.<locals>.MyMessageNr�r�r;r9r�r��r�r;r�r�rVr�rQ)rr'r�rr�r�)r6r�r�r8r�s     r9�!test_message_from_file_with_classz3TestMiscellaneous.test_message_from_file_with_class�s���	��	��l�W�
5���)�)�"�i�8�C�6����c�9�-�
�l�W�
5���)�)�"�i�8�C�6��x�x�z�G��!�!�'�9�5�"�
6�
5��6�
5�s�B"�B.�"B+�.B7c�j�Gd�dt�}|jd|�}|j||�y)Nc���eZdZ�fd�Z�xZS)�STestMiscellaneous.test_custom_message_does_not_require_arguments.<locals>.MyMessagec�"��t�|��yrf)�super�__init__)r6�	__class__s �r9r�z\TestMiscellaneous.test_custom_message_does_not_require_arguments.<locals>.MyMessage.__init__�s����� �"r;)r�r�r�r��
__classcell__)r�s@r9r�r��s
���
#�
#r;r�zSubject: test

test)rr�r�)r6r�r8s   r9�.test_custom_message_does_not_require_argumentsz@TestMiscellaneous.test_custom_message_does_not_require_arguments�s1��	#��	#��m�m�3�Y�?�����c�9�-r;c�h�td�}|jt|j�gd��y)Nr�)rrArr �
feedparserr�r�r!rq�message_from_binary_filer�rr�r�r�r"r#)�
__import__r2�sorted�__all__)r6�modules  r9�test__all__zTestMiscellaneous.test__all__�s*���G�$���������/�2�	r;c���tj�}|jtjtj|��ddtj
|�dd�y)N�)r1r2r#�	parsedate�
formatdate�gmtime�r6r9s  r9�test_formatdatez!TestMiscellaneous.test_formatdate�sK���i�i�k���������)9�)9�#�)>�?���C����S�)�"�1�-�	/r;c���tj�}|jtjtj|d���ddtj
|�dd�y)NT�r2r�)r1r2r#r�r�r2r�s  r9�test_formatdate_localtimez+TestMiscellaneous.test_formatdate_localtime�sN���i�i�k������O�O�E�,�,�S�D�A�B�2�A�F��N�N�3����#�	%r;c	�f�tj�}|jtj|d��tjdtj
|���|jtj|dd��tjdtj
|���y)NFr�z%a, %d %b %Y %H:%M:%S -0000T)r2�usegmtz%a, %d %b %Y %H:%M:%S GMT)r1r2r#r�r5r�r�s  r9�test_formatdate_usegmtz(TestMiscellaneous.test_formatdate_usegmt�s���i�i�k��������S�E�2��M�M�7����S�9I�J�	L�	
������S�E�$�?��M�M�5�t�{�{�3�7G�H�	Jr;c��gd�}|D]e}|j|��5|jtj|��|jtj|��ddd��g|jtjd��|jtjd��y#1swY��xYw)N)	r+r,�0zA Complete Waste of Timez Wed, 3 Apr 2002 12.34.56.78+0800z17 June , 2022zFriday, -Nov-82 16:14:55 ESTzFriday, Nov--82 16:14:55 ESTzFriday, 19-Nov- 16:14:55 EST)�dtstr)�subTestr�r#r��parsedate_tz)r6�
invalid_datesr�s   r9�/test_parsedate_returns_None_for_invalid_stringszATestMiscellaneous.test_parsedate_returns_None_for_invalid_strings�s���

�
�#�E����E��*��!�!�%�/�/�%�"8�9��!�!�%�"4�"4�U�";�<�+�*�#�
	
���%�/�/�$�/�0����%�,�,�T�2�3�+�*�s�A	B8�8C	c���|jtjd�d�|jtjd�d�|jtjd�d�y)NzWed, 3 Apr 2002 14:58:26 +0800�
��r�r���:�rr|r,�pzWed,3 Apr 2002 14:58:26 +0800zWed 3 Apr 2002 14:58:26 +0800�r2r#r�r�s r9�test_parsedate_compactz(TestMiscellaneous.test_parsedate_compactsf������+�+�,L�M�B�	D�	
����+�+�,K�L�B�	D�	
����+�+�,K�L�B�	Dr;c��|j}|tjd�d�|tjd�d�y)N�5 Feb 2003 13:47:26 -0800�
��r���
�/r�rr|r,透��zFebruary 5, 2003 13:47:26 -0800r��r6r7s  r9�test_parsedate_no_dayofweekz-TestMiscellaneous.test_parsedate_no_dayofweeks?��
�
�
��
�5���9�:�5�	7�
�5���?�@�5�	7r;c�N�|jtjd�d�y)NzWed, 3 Apr 2002 14:58:26+0800r�r�r�s r9�.test_parsedate_no_space_before_positive_offsetz@TestMiscellaneous.test_parsedate_no_space_before_positive_offset!s!������+�+�,K�L�4�	6r;c�N�|jtjd�d�y)NzWed, 3 Apr 2002 14:58:26-0800)
r�r�r�r�r�r�rr|r,r�r�r�s r9�.test_parsedate_no_space_before_negative_offsetz@TestMiscellaneous.test_parsedate_no_space_before_negative_offset%s!������+�+�,K�L�5�	7r;c��|j}|tjd�d�|tjd�d�y)Nz5 Feb 2003 13.47.26 -0800r�z5 Feb 2003 13.47 -0800)
r�r�r�r�r�rrr|r,r�r�r�s  r9�%test_parsedate_accepts_time_with_dotsz7TestMiscellaneous.test_parsedate_accepts_time_with_dots*s?��
�
�
��
�5���9�:�5�	7�
�5���6�7�4�	6r;c�N�|jtjd�d�y)NzFriday, 19-Nov-82 16:14:55 EST)
i����r��7rr|r,i����r�r�s r9�test_parsedate_rfc_850z(TestMiscellaneous.test_parsedate_rfc_8501s!������+�+�,L�M�7�	9r;c�N�|jtjd�d�y)NzWed, 3 Apr 2002 14:58 +0800�
r�r�r�r�r�rrr|r,r�r�r�s r9�test_parsedate_no_secondsz+TestMiscellaneous.test_parsedate_no_seconds5s"������+�+�,I�J�A�	Cr;c��|jtjd�d�|jtjd�d�y)NzWed, 3 Apr 2002 14.58.26 +0800r�zWed, 3 Apr 2002 14.58 +0800r�r�r�s r9�!test_parsedate_dot_time_delimiterz3TestMiscellaneous.test_parsedate_dot_time_delimiter9sB������+�+�,L�M�B�	D�����+�+�,I�J�A�	Cr;c
��|j}tjd�}tt	j
|��}|t	j|�dd|dd�|tt	jd|��d�tjd�}tt	j
|dd��}|t	j|�dd|dd�|tt	jd|dd��d�y)Nr�r�z%Yr��	)	r2r#r��intr1�mktimer2r5r�)r6r7�timetupr�s    r9�+test_parsedate_acceptable_to_time_functionsz=TestMiscellaneous.test_parsedate_acceptable_to_time_functions?s���
�
�
���/�/�"=�>������G�$�%��
�4�>�>�!��R�a� �'�"�1�+�.�
�3�t�}�}�T�7�+�,�d�3��$�$�%@�A������G�B�Q�K�(�)��
�4�>�>�!��R�a� �'�"�1�+�.�
�3�t�}�}�T�7�2�A�;�/�0�$�7r;c��|jtjd�d�|jtjd�d�y)N)
�r|r|rrrr,r,r,rr)
r�r|r|rrrr,r,r,i�i.���)r2r#�	mktime_tzr�s r9�test_mktime_tzz TestMiscellaneous.test_mktime_tzJsE��������*9�:�;<�	>�������*<�=�>C�	Er;c���|jtjd�tjd��|jtjd�tjd��y)aTest for parsing a date with a two-digit year.

        Parsing a date with a two-digit year should return the correct
        four-digit year. RFC822 allows two-digit years, but RFC2822 (which
        obsoletes RFC822) requires four-digit years.

        z25 Feb 03 13:47:26 -0800z25 Feb 2003 13:47:26 -0800z25 Feb 71 13:47:26 -0800z25 Feb 1971 13:47:26 -0800Nr�r�s r9�test_parsedate_y2kz$TestMiscellaneous.test_parsedate_y2kPs\��	
����+�+�,F�G��+�+�,H�I�	K�����+�+�,F�G��+�+�,H�I�	Kr;c��|jtjd�d�|jtjtjd��d�y)Nz<>�r+r+r+�r2r#�	parseaddr�
formataddrr�s r9�test_parseaddr_emptyz&TestMiscellaneous.test_parseaddr_empty]s?���������.��9�����)�)�%�/�/�$�*?�@�"�Er;c���|jtjd�d�|jtjd�d�|jtjd�d�y)Nza@b@cr�za@b.c@cza@172.17.0.1@c�r2r#r�r�s r9�test_parseaddr_multiple_domainsz1TestMiscellaneous.test_parseaddr_multiple_domainsas^������O�O�G�$��	
�	
����O�O�I�&��	
�	
����O�O�,�-��	
r;c�N�|jtjd�d�y)N)zA Silly Person�person@dom.ainzA Silly Person <person@dom.ain>�r2r#r�r�s r9�test_noquote_dumpz#TestMiscellaneous.test_noquote_dumpos"��������A�B�-�	/r;c��|jtjd�d�|jtjd�d�d}d}|jtjtj||f��||f�y)N)zA (Very) Silly Personr�z("A (Very) Silly Person" <person@dom.ain>z*"A \(Very\) Silly Person" <person@dom.ain>zA \(Special\) Personr��r2r#r�r��r6r�r�s   r9�test_escape_dumpz"TestMiscellaneous.test_escape_dumptsz��������H�I�7�	9�	
����O�O�I�J�7�	9�
$�����������)9�)9�1�a�&�)A�B�Q��F�Kr;c���|jtjd�d�d}d}|jtjtj||f��||f�y)N)�Arthur \Backslash\ Foobarr�z."Arthur \\Backslash\\ Foobar" <person@dom.ain>r�r�r�r�s   r9�test_escape_backslashesz)TestMiscellaneous.test_escape_backslashessZ��������M�N�=�	?�
)�����������)9�)9�1�a�&�)A�B�Q��F�Kr;c��d}d}d}d}|jtj||f�|�|jtj||fd�|�y)N�Häns Würstr��-=?utf-8?b?SMOkbnMgV8O8cnN0?= <person@dom.ain>z0=?iso-8859-1?q?H=E4ns_W=FCrst?= <person@dom.ain>r=r�)r6r �addr�utf8_base64�
latin1_quopris     r9�test_quotes_unicode_namesz+TestMiscellaneous.test_quotes_unicode_names�sY��%����E��J�
�����)�)�4��,�7��E�����)�)�4��,��E��	r;c���d}d}d}d�G�fd�d�}|�}��d|�d�}|jtj||f|�|�|jtj||ftd	��|�y)
Nrr�r�FOOBARc���eZdZ�fd�Zy)�KTestMiscellaneous.test_accepts_any_charset_like_object.<locals>.CharsetMockc����Srfr�)r6�stringrNs  �r9�
header_encodezYTestMiscellaneous.test_accepts_any_charset_like_object.<locals>.CharsetMock.header_encode�s����
r;N)r�r�r�r)rNs�r9�CharsetMockr	�s���
r;r
z <�>rV)r2r#r�r
)r6r rrr
�mock�
mock_expectedrNs       @r9�$test_accepts_any_charset_like_objectz6TestMiscellaneous.test_accepts_any_charset_like_object�s~���%����E����	�	��}��%+�T�2�
�����)�)�4��,��=�}�M�����)�)�4��,���8H�I��	r;c�p�d}d}t�}|jttj||f|�y)Nrr�)�objectr��AttributeErrorr#r�)r6r r�bad_charsets    r9�-test_invalid_charset_like_object_raises_errorz?TestMiscellaneous.test_invalid_charset_like_object_raises_error�s4��%�����h�����.�%�*:�*:�T�4�L��	r;c��d}|jttjd|f�|jttjd|f�y)Nupersön@dom.in�Name)r��UnicodeErrorr#r��r6rs  r9�!test_unicode_address_raises_errorz3TestMiscellaneous.test_unicode_address_raises_error�s?��#�����,��(8�(8�4��,�G����,��(8�(8�6�4�.�Ir;c��d}d}d\}}|jtj|�||f�|jtj|�||f�|jtj||f�|�y)NzJohn X. Doe <jxd@example.com>z"John X. Doe" <jxd@example.com>)zJohn X. Doezjxd@example.comr�)r6r��yr�r�s     r9�test_name_with_dotz$TestMiscellaneous.test_name_with_dot�sn��+��-��1���1��������+�a��V�4��������+�a��V�4�����)�)�1�a�&�1�1�5r;c���|j}|tjd�d�|tjd�d�|tjd�d�y)N�""example" example"@example.com)r+r �!"\"example\" example"@example.com)r+r!�#"\\"example\\" example"@example.com)r+r"r�r�s  r9�2test_parseaddr_preserves_quoted_pairs_in_addresseszDTestMiscellaneous.test_parseaddr_preserves_quoted_pairs_in_addresses�sT���
�
��
�5�?�?�<�=�
1�	3�
�5�?�?�@�A�
5�	7�
�5�?�?�D�E�
9�	;r;c�v�|jdtjd��|jdtjd��|jdtjd��|jdtjd��|jdtjd	��y)
N)r+�merwok wok@xample.comr%)r+�merwok  wok@xample.comr&z merwok  wok  @xample.com)r+�merwok"wok"  wok@xample.comr')r+zmerwok.wok.wok@xample.comzmerwok. wok .  wok@xample.comr�r�s r9�-test_parseaddr_preserves_spaces_in_local_partz?TestMiscellaneous.test_parseaddr_preserves_spaces_in_local_part�s���	
���6��O�O�3�4�	6����7��O�O�4�5�	7����7��O�O�7�8�	:����<��O�O�9�:�	<����:��O�O�;�<�	>r;c��d}d}|jtj|�|�|jtj|�|�y)N)z#'foo@example.com' (foo@example.com)�foo@example.comz7"'foo@example.com' (foo@example.com)" <foo@example.com>r�)r6r�addrstrs   r9�6test_formataddr_does_not_quote_parens_in_quoted_stringzHTestMiscellaneous.test_formataddr_does_not_quote_parens_in_quoted_string�sE��#��C���������1�4�8�����)�)�$�/��9r;c�R�d}|jtj|�d�y)NzFoo
	Bar <foo@example.com>)zFoo Barr*r�)r6r�s  r9�test_multiline_from_commentz-TestMiscellaneous.test_multiline_from_comment�s%��
��	
�������+�-K�Lr;c�N�|jtjd�d�y)N)zA Silly; Personr�z""A Silly; Person" <person@dom.ain>r�r�s r9�test_quote_dumpz!TestMiscellaneous.test_quote_dump�s"��������B�C�1�	3r;c�X�|j}|j}t�}t�}||d�||d�||d�|d|�|d|�|d|�||d�||d�||d�|d|�|d|�|d|�|||�|||�y)NrN�US-ASCIIzUs-AsCiI�usascii�USASCII�UsAsCiI)r2�assertNotEqualr
)r6r7�ne�cset1�cset2s     r9�test_charset_richcomparisonsz.TestMiscellaneous.test_charset_richcomparisons�s���
�
�
��
�
 �
 ���	���	��
�5�*��
�5�*��
�5�*��
�:�u��
�:�u��
�:�u��
�5�)��
�5�)��
�5�)��
�9�e��
�9�e��
�9�e��
�5�%��
�5�%�r;c�\�|j}|tjddg�ddg�y)N�aperson@dom.ain (Al Person)zBud Person <bperson@dom.ain>�z	Al PersonrH)z
Bud PersonrI�r2r#�getaddressesr�s  r9�test_getaddressesz#TestMiscellaneous.test_getaddresses
s9��
�
�
��
�5���<�=�?�@�,�-�/�	0r;c�V�|jtjgd��gd��y)zGH-106669 regression test.)z"Bud, Person" <bperson@dom.ain>r<z#"Mariusz Felisiak" <to@example.com>))zBud, PersonrIr=)zMariusz Felisiak�to@example.comNr>r�s r9�test_getaddresses_comma_in_namez1TestMiscellaneous.test_getaddresses_comma_in_name
s(���������
�
�
	
r;c�	�d}d}d}dd|�d�|fgfdd|f|d|fgfdd|f|d|f|gfdd|f|d|fgfd	d|�d
|�d�fgfdd|f|d|fgfd
||d|fgfdd|f|d|fgfdd|fd|fgfdd|dzfd|fgfdd|fdd|�d�fgffD]�\}}|�|�d|�d�}|j|��5|jtj|g�|g�|jtj|gd��|�|jtj|g�|�|jtj|gd��d|f�ddd���|�d|�d�}|jtj|g�d|fd|fg�|jtj|gd��d|fd|fg�|jtj|g�|�|jtj|gd��d|f�d}d}|jtj|g�|g�|jtj|gd��|g�|jtj|g�|�|jtj|gd��d|f�d}d}|jtj|g�|g�|jtj|gd��|g�|jtj|g�|�|jtj|gd��d|f�d}|jtj|g�|g�|jtj|gd��gd��|jtj|g�|�|jtj|gd��d|f�d}|jtj|g�ddg�|jtj|gd��ddg�|jtj|g�|�|jtj|gd��d|f�|jt
jjd �y#1swY��BxYw)!z>Test for parsing errors from CVE-2023-27043 and CVE-2019-16056�alice@example.org�bob@example.comr��(�<r�)r+�[z[<z>]�]�@�;�:�.�")�addressF��strictNz,<z,"Alice, alice@example.org" <bob@example.com>)zAlice, alice@example.orgrFzalice@example.org (Alice))�AlicerEzalice@example.org )Alice())r+rEr�)r+rT�<"Jane Doe" <jane@example.net>, "John Doe" <john@example.net>)zJane Doezjane@example.net)zJohn Doezjohn@example.netT)r�r2r#r?r�r��supports_strict_parsing)r6�alice�bob�empty�invalid_separator�expected_non_strictrQ�expected_stricts        r9�test_parsing_errorsz%TestMiscellaneous.test_parsing_errors
s��#�������a��u�A�J��&�'�(�
�B��;���C�y�1�2�
�B��;���C�y�%�8�9�
�B��;���C�y�1�2�
�B�5�'��C�5��+�,�-�.�
�B��;���C�y�1�2�
�5�%�"�c��+�,�
�B��;���C�y�1�2�
�B��;��S�	�*�+�
�B����$�r�3�i�0�1�
�B��;��q���Q�Z� 0�1�2�7
�2��2��� 1�2�!�C�5��:�G����g��.�� � ��!3�!3�W�I�!>�"'��*�� � ��!3�!3�W�I�e�!L�!4�6�� � ����'��!;�!&�(�� � ����'��5�!I�"$�g��0�/�.�7
�6�G�2�c�U�!�$������+�+�W�I�6��u�+��C�y�1�	3�����+�+�W�I�e�D��u�+��C�y�1�	3�������'��3��	 �������'��5�A��g��	(�A��I������+�+�W�I�6��8I�J�����+�+�W�I�e�D��FW�X�������'��3�_�E�������'��5�A��g��	(�.��8������+�+�W�I�6��8I�J�����+�+�W�I�e�D��FW�X�������'��3�_�E�������'��5�A��g��	(�.������+�+�W�I�6���@�����+�+�W�I�e�D�M�	O�������'��3�U�;�������'��5�A��g��	(�Q������+�+�W�I�6�:�:�<�	=�	
����+�+�W�I�e�D�:�:�<�	=�	
������'��3�U�;�������'��5�A��g��	(�	
������<�<�d�C�/�.�s
�B R4�4R>	c��dgdgfdgdgfddgddgfdgdgfd	gdgfd
ggd�fdgd
gfdgdgfdgdgfdgddgff
D]l\}}|j|��5|jtj|�|�|jtj|d��|�ddd��ndg}|jtj|�dg�|jtj|d��gd��y#1swY��xYw)Nu&"Sürname, Firstname" <to@example.com>)uSürname, FirstnamerBzfoo: ;r�z#"Jason R. Mastaler" <jason@dom.ain>)zJason R. Mastalerz
jason@dom.ainz=Pete(A nice \) chap) <pete(his account)@silly.test(his host)>)z)Pete (A nice ) chap his account his host)zpete@silly.testz<(Empty list)(start)Undisclosed recipients  :(nobody(I know))z=Mary <@machine.tld:mary@example.net>, , jdoe@test   . example))�Maryzmary@example.netr�)r+zjdoe@test.examplez*John Doe <jdoe@machine(comment).  example>)zJohn Doe (comment)zjdoe@machine.examplez3"Mary Smith: Personal Account" <smith@home.example>)zMary Smith: Personal Accountzsmith@home.examplezUndisclosed recipients:;z7<boss@nil.test>, "Giant; \"Big\" Box" <bob@example.net>)r+z
boss@nil.test)zGiant; "Big" Boxzbob@example.net)�	addressesFrRz	[]*-- =~$)r�r�)r+z*--)r�r2r#r?)r6r`r�s   r9�test_getaddresses_nastyz)TestMiscellaneous.test_getaddresses_nastyt
s���6�
7�7�
8�
:��Z��Z�
��=�
>��>�
?�
A�O�
O�N�
O�
Q�M�
M��Z�
�N�
N�
P�
R�;�
;�<�
=�
?�D�
D�D�
E�
G�)�
)��Z�
�I�
I�#�%L�
M�
O�9$
��I�x�>���	��2�� � ��!3�!3�I�!>�!)�+�� � ��!3�!3�I�e�!L�!)�+�3�2�?$
�J!�M�	�����+�+�I�6�"��	%�����+�+�I�e�D�:�	<�3�2�s
�A
C;�;D	c�f�|j}tjdg�}||ddd�y)z(Test proper handling of a nested commentz%User ((nested comment)) <foo@bar.com>rr|�foo@bar.comNr>)r6r7�addrss   r9�"test_getaddresses_embedded_commentz4TestMiscellaneous.test_getaddresses_embedded_comment�
s3��
�
�
���"�"�$K�#L�M��
�5��8�A�;�
�&r;c�r�tjtd�g�}|j|ddd�y)z%Test the handling of a Header object.zAl Person <aperson@dom.ain>rr|rHN)r#r?rr2)r6rds  r9�test_getaddresses_header_objz.TestMiscellaneous.test_getaddresses_header_obj�
s4���"�"�F�+H�$I�#J�K������q��!��&7�8r;�cpuc�h�Gd�dt�}td�D�cgc]	}|���}}tj|�5	ddd�t	|D�cgc]}|j
��c}g�}|j
tt|��t|��ycc}w#1swY�`xYwcc}w)Nc��eZdZd�Zy)�BTestMiscellaneous.test_make_msgid_collisions.<locals>.MsgidsThreadc���g|_|jj}tj}tj
}|�dz}|�|kr||d���|�|kr�yy)Ng@�testdomain-string��domain)�msgidsr r#�
make_msgidr1�	monotonic)r6r rq�clock�tfins     r9�runzFTestMiscellaneous.test_make_msgid_collisions.<locals>.MsgidsThread.run�
sY�� ������+�+��"�-�-�
������w��}���g��n��:�-@�A�B��g��nr;N)r�r�r�rur�r;r9�MsgidsThreadrk�
s��
Cr;rvr�)	rrHr%�
start_threads�sumrpr2r��set)r6rvrB�threadsr��all_idss      r9�test_make_msgid_collisionsz,TestMiscellaneous.test_make_msgid_collisions�
s���		C�6�		C�,1��8�4�8�a�<�>�8��4�
�
+�
+�G�
4��5���1��A�q�x�x��1�2�6������S��\�*�C��L�9��	5�
4�
4��1s�B�B#�B/�#B,c��|j}t�}|jddd��||j�d�y)NrFrBzfoo\wacky"namerD)r2rrHrr5s   r9�test_utils_quote_unquotez*TestMiscellaneous.test_utils_quote_unquote�
sA��
�
�
���i�����,�l� 1�	�	3�
�3����0�1r;c�Z�td�}|j|j�d�y)Nz
not a charsetrW�r
r2�get_body_encoding�r6rAs  r9�)test_get_body_encoding_with_bogus_charsetz;TestMiscellaneous.test_get_body_encoding_with_bogus_charset�
s%���/�*������2�2�4�h�?r;c���|j}t�}d|d<||dd�|j�}|t|�d�||dd�t	|d�}||j�d�|j
d|�	�||j�d
�||jd��d�||d
d�t�}d|d<|j�}|t|�d�||dd�t	|d�}||j�tj�|j
d|�	�||j�d�||d
d�y)Nztext/plain; charset=UTF-8rDr@r|rrVrWr�rM�aGVsbG8gd29ybGQ=
TrXrBztext/plain; charset="US-ASCII"rNr�r�)
r2rrur�r
r�rRrZrr�)r6r7r8rvrAs     r9�-test_get_body_encoding_with_uppercase_charsetz?TestMiscellaneous.test_get_body_encoding_with_uppercase_charset�
sS��
�
�
���i��9��N��
�3�~�� ;�<��#�#�%��
�3�x�=�!��
�8�A�;�� ��(�1�+�&��
�7�$�$�&��1�������8�
�3�?�?��2�3�
�3�?�?�$�?�'��8�
�3�*�+�X�6��i��>��N���#�#�%��
�3�x�=�!��
�8�A�;�
�#��(�1�+�&��
�7�$�$�&��(?�(?�@����
�w��7�
�3�?�?��m�,�
�3�*�+�V�4r;c��td�}td�}|j|j�|j��y)NrNr2r�)r6�lc�ucs   r9�test_charsets_case_insensitivez0TestMiscellaneous.test_charsets_case_insensitive�
s8��
�Z�
 ��
�Z�
 ������-�-�/��1E�1E�1G�Hr;c��|j}|jd�}t�}tj||�||j�d�y)NrpaBmultipart/report
    text/plain
    message/delivery-status
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
        text/plain
    text/rfc822-headers
rkrms    r9�1test_partial_falls_inside_message_delivery_statuszCTestMiscellaneous.test_partial_falls_inside_message_delivery_status�
sI��
�
"�
"��
�l�l�<�(���j�����S�#�&�
�3�<�<�>��	r;c�j�|jtjjd��ddd�y)Nrmrni��z@testdomain-string>�r2r�r#rqr�s r9�test_make_msgid_domainz(TestMiscellaneous.test_make_msgid_domains0������K�K�"�"�*=�"�>�s�t�D�!�	#r;c�l�|jtjjdd��ddd�y)Nz
test-idstringrm)�idstringroi���z!.test-idstring@testdomain-string>r�r�s r9�test_make_msgid_idstringz*TestMiscellaneous.test_make_msgid_idstrings9������K�K�"�"�O�*�
#�
,�,/�D�
2�/�	1r;c���td�5}dx|_}|jtjj�j
d|zdz��ddd�y#1swYyxYw)Nzsocket.getfqdnzpythontest.example.comrLr)r	�return_valuer�r�r#rq�endswith)r6�mock_getfqdnros   r9�test_make_msgid_default_domainz0TestMiscellaneous.test_make_msgid_default_domainsY��
�#�
$��1I�I�L�%���O�O����&�&�(�1�1��&�L�3�&�(�
)�%�
$�
$�s�AA!�!A*c�l�tddd��5}|j�}ddd�jdd�}tj|�}t�}tjj|�}|j|�|j|j�|�y#1swY��xYw)N�
msg_26.txtrVr*�r��newliner�)r'r�r�r�r�rr�rr�r2r��r6�f�msgtxt�	msgtxt_nlr8r�r�s       r9�test_Generator_linendz'TestMiscellaneous.test_Generator_linend&s���
�l�W�d�
C�q��V�V�X�F�D��N�N�6�4�0�	��'�'��/���J���O�O�%�%�a�(��	�	�	�#���������y�1�D�
C�s�B*�*B3c��tddd��5}|j�}ddd�jdd�}tj|�}t�}tjj|�}|j|d��|j|j�jd�|�y#1swY��xYw)Nr�rVr*r�r�r�r�)r'r�r�r�r�rr�r
r�r2r�rYr�s       r9�test_BytesGenerator_linendz,TestMiscellaneous.test_BytesGenerator_linend1s���
�l�W�d�
C�q��V�V�X�F�D��N�N�6�4�0�	��'�'�	�2���I���O�O�*�*�1�-��	�	�	�#�v�	�&��������,�,�W�5�v�>�D�
C�s�B;�;Cc��tdd�5}|j�}ddd�jdd�}|jdd�}tj|�}t�}tjj|�}|j|d��|j|j�|�y#1swY��xYw)	Nr�r�swith attachmentsfo��
r�r�r�)r'r�r�r�r�rr�r
r�r2r�r�s       r9�)test_BytesGenerator_linend_with_non_asciiz;TestMiscellaneous.test_BytesGenerator_linend_with_non_ascii<s���
�l�D�
)�Q��V�V�X�F�*���� 2�I�>���N�N�7�E�2�	��&�&�y�1���I���O�O�*�*�1�-��	�	�	�#�v�	�&��������v�.�*�
)�s�B<�<Cc�2�tdd�5}|j�}ddd�tdd�5}|j�}ddd�tdftfftfft
t
�fftdftdfg}|D]�\}}|j|jd��5||�}|j|jtjj�ddd�|j|jd��5||d	tjji�}|j|jtjj�ddd���y#1swY��JxYw#1swY��2xYw#1swY��xYw#1swY��xYw)
Nr�r�r�)r+)r)r*rx)�clsr�r{r�)r'r�rrrrrrrr�r�r�r�r�rxr{)r6r��	audiodatar��classesr��constructorr�s        r9�!test_mime_classes_policy_argumentz3TestMiscellaneous.test_mime_classes_policy_argumentHsE��
�k�4�
(�B����	�I�)�
�l�D�
)�R��g�g�i�G�*��e�$�
���%�
��
�#�
�7�9�,�'�
�5�6�
�u��

��!(��C�����#�,�,�z��B���%���
�
�a�h�h����(=�(=�>�C����#�,�,�y��A���B�U�\�\�-A�-A�B���
�
�a�h�h����(<�(<�=�B�A�	!(�)�
(��
)�
)��C�B��B�A�s/�E&�E3�':F�AF�&E0�3E=�F		�F	c���|jttjd��gd��|jttjd��ddg�y)Nza\\b\"c\\"d)�rr�)r��\\)r�r�)r�z\")r��c)�r�)r�rP)rD�dza\r�)r|�\)r2r�r#�_iter_escaped_charsr�s r9�test_iter_escaped_charsz)TestMiscellaneous.test_iter_escaped_chars]sQ������e�7�7��G�H�%�	&�	
����e�7�7��>�?�"�I�.�	0r;c����fd�}|dd�|dd�|dd�|dd	�|d
d�|dd
�|dd�|dd�dD]'}�jtj|�|��)y)Nc�P���jtj|�|�yrf�r2r#�_strip_quoted_realnames)rr�r6s  �r9�checkz<TestMiscellaneous.test_strip_quoted_realnames.<locals>.checkks������U�:�:�4�@�(�Kr;rUz( <jane@example.net>,  <john@example.net>z""Jane \"Doe\"." <jane@example.net>z <jane@example.net>zbefore"name"after�beforeafterzbefore"name"�beforezb"name"r�z"name"after�afterz"name"ar�z"name"r+)z8Jane Doe <jane@example.net>, John Doe <john@example.net>zlone " quoter�)r6r�rs`  r9�test_strip_quoted_realnamesz-TestMiscellaneous.test_strip_quoted_realnamesjs����	L�	�L�8�	:�
�3�#�	%�	�"�M�2�
�o�x�(�
�j�#��
�n�g�&�
�j�#��
�i���
�D�
���U�:�:�4�@�$�G�	
r;c��d}|jtj|�d���|jtj|�d���|jtj|�d���|jtj|�d���|jtjd|����y)Nzalice@example.netz (Alice)z )Alice(z	 (Alice))z	 ((Alice)z")Alice((" )r�r#�_check_parenthesisrrs  r9�test_check_parenthesisz(TestMiscellaneous.test_check_parenthesis�s���"������0�0�D�6��1B�C�D�����1�1�T�F�(�2C�D�E�����1�1�T�F�)�2D�E�F�����1�1�T�F�)�2D�E�F�	
����0�0�;�t�f�1E�F�Gr;N)Br�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr#r(r,r.r0r:r@rCr]rarergr%�requires_working_threadingr$�requires_resourcer|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;r9r�r��sm��	-�
1�6�"6�.��/�
%�J�4�,D�7�6�7�
6�9�C�C�	8�E�K�F�
�/�
	L�L��
��J�6�;�$>�$:�M�3�
�(0�
�"VD�p*<�X'�9�
1��0�0�2��W���u�%�:�&�3�:�&2�@�5�4I�
(�T#�
1�)�	2�	?�
/�>�*0�H�2Hr;r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestIteratorsc�,�|j}|j}|jd�}tj|�}t|�}|t
|�d�|tj|�|j��|jd�}tj|�}t|�}|t
|�d�tdd��5}|tj|�|j��ddd�y#1swYyxYw)Nr�r�rQ�+z
msg_19.txtrVr�)r2rr3r!�body_line_iteratorr�r��EMPTYSTRINGr�rZr'r�)r6r7r�r8�itr�r�s       r9�test_body_line_iteratorz%TestIterators.test_body_line_iterator�s���
�
�
���#�#���l�l�<�(��
�
)�
)�#�
.���R���
�3�u�:�q���K���U�#�S�_�_�%6�7��l�l�<�(��
�
)�
)�#�
.���R���
�3�u�:�r��
�l�W�
5���� � ��'�����3�6�
5�
5�s�+D
�
Dc��|j}|jd�}tj|d�}g}d}|D]&}|dz
}|j	|j���(||d�|tj|�d�y)Nryr�rr|r�z`a simple kind of mirror
to reflect upon our own
a simple kind of mirror
to reflect upon our own
�r2r3r!�typed_subpart_iteratorr rZr�r��r6r7r8r�r��subpartsr�s       r9�test_typed_subpart_iteratorz)TestIterators.test_typed_subpart_iterator�s���
�
�
���l�l�<�(��
�
-�
-�c�6�
:�������G���M�H��L�L��,�,�.�/��	�8�Q��
�;���E�"�%�	r;c��|j}|jd�}tj|dd�}g}d}|D]&}|dz
}|j	|j���(||d�|tj|�d�y)Nr�r�r�rr|z%
Hi,

Do you like this message?

-Me
r�r�s       r9�(test_typed_subpart_iterator_default_typez6TestIterators.test_typed_subpart_iterator_default_type�s���
�
�
���l�l�<�(��
�
-�
-�c�6�7�
C�������G���M�H��L�L��,�,�.�/��	�8�Q��
�;���E�"�%�	r;c
���gd�}ddlm}m}|�}g}d}|D]`\}}|j|�||z
}d}	t	|j
|�D]}
|j
|
�|	dz
}	�|j||	��b|jt|�|�|jdj|D��cgc]\}}|��	c}}�dj|��ycc}}w)z�FeedParser BufferedSubFile.push() assumed it received complete
           line endings.  A CR ending one push() followed by a LF starting
           the next push() added an empty line.
        ))za
 
r�)r�r)zc
r|)r+r)zd
r|)ze
r)z
fr|)r�r|r��BufferedSubFile�NeedMoreDatar|r+N)
�email.feedparserr�r��push�iter�readliner r2r�r�)r6�imtr�r��bsf�om�nt�il�n�n1�ols           r9�test_pushCR_LFzTestIterators.test_pushCR_LF�s���
	��	C����
��
���E�B���H�H�R�L��!�G�B��B��3�<�<��6���	�	�"�
��a���7�
���Q��#��	
����R��"�%�������#�!6�#���Q�"�#�!6�7������E��!6s�3Cc�x��ddlm}m}d}d}d�dj�fd�t	|�D��dz}|jd	�}|�}g}t	dt
|�|�D]@}	||	|	|z}
|j|
�|jt|j|���B|j||�y)
Nrr�i'r�zabcd 	
r+c3�4�K�|]}t�����y�wrfr)rArB�charss  �r9rCz1TestIterators.test_push_random.<locals>.<genexpr>�s�����4�8�a�F�5�M�8�s�r*T)r�r�r�r�rHr�r�r��extendr�r�r2)r6r�r�r��	chunksizer��targetr�r�rB�chunkr�s           @r9�test_push_randomzTestIterators.test_push_random�s����B����	����G�G�4�5��8�4�4�t�;�����d�#��������q�#�a�&�)�,�A��a��)��$�E��H�H�U�O��L�L��c�l�l�L�9�:�-�	
�����'r;N)r�r�r�r�r�r�r�r�r�r;r9r�r��s��4�"�"�&F�<(r;r�c�$�eZdZd�Zd�Zd�Zd�Zy)�TestFeedParsersc�f�t�}|D]}|j|��|j�Srf)r)�feed�close)r6�chunksr�r�s    r9�parsezTestFeedParsers.parse�s.���\�
��E��O�O�E�"�����!�!r;c�z�|jd�}|j|dd�|j|dd�y)NzFirst: val
: bad
Second: valr��valr�)r�r2rhs  r9�test_empty_header_name_handledz.TestFeedParsers.test_empty_header_name_handled�s9���j�j�9�:������W��u�-�����X���.r;c���|jdg�}|j|j�gd��|jdg�}|j|j�gd��|jddg�}|j|j�ddg�|jdd	g�}|j|j�dd
g�|jddg�}|j|j�dd
g�|jdg�}|j|j�d
g�|jgd��}|j|j�ddg�y)Nz
a:
b:
c:
d:
)r�r�r�r�za:
b:
c:
d:za:
b�c:
r��bc�a:
zb:
r�z
b:
ua:…b:
c:
)r�u	…b:
c:)r�ub:…r��r�r+)r�u…c:)r�r2r�r�r�s  r9�
test_newlineszTestFeedParsers.test_newliness3���J�J�,�-�.���������#7�8��J�J�*�+�,���������#7�8��J�J���(�)���������C��;�/��J�J���'�(���������C��:�.��J�J���)�*���������C��:�.�
�J�J�,�-�.���������%<�$=�>��J�J�1�2���������Y��$@�Ar;c��d\}}|jdgd|zg|zz�}|j|j�dg�|j|j�d|z|z�|jdgd|zg|zz�}|j|j�dg�|j|j�d|z|z�|jdgd|zdzg|zz�}|j|j�dg�|j|j�d|zdz|z�|jddgd|zg|zz�}|j|j�d	d
d|z|zfg�y)N)i�i Nza:b

r�)r�r�za:b

�…r�zb: r�r�)r�r2r�rZ)r6�M�Nr�s    r9�test_long_lineszTestFeedParsers.test_long_liness\�����1��J�J�	�{�c�!�e�W�q�[�0�1���������Z�L�1��������#�a�%��'�2��J�J�	�{�c�!�e�W�q�[�0�1���������Z�L�1��������#�a�%��'�2��J�J�	�{�c�!�e�F�l�^�a�%7�7�8���������Z�L�1��������3�q�5��<��*:�;��J�J����#�a�%��1��4�5���������Y��c�!�e�A�g��$?�@r;N)r�r�r�r�r�r�rr�r;r9r�r��s��"�/�B�$
Ar;r�c�|�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dZd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TestParsersc�v�|j}tdd��5}t�j|�}ddd�|dd�||dd�||j	�d�|j|j
��|j|j�t�y#1swY�|xYw)	NrQrVr�r��ppp-request@zzz.orgr��ppp@zzz.orgrk)
r2r'rr�rHrrr�rZr��r6r7r�r8s    r9�test_header_parserzTestParsers.test_header_parser(s���
�
�
��
�l�W�
5���.�&�&�r�*�C�6�
�3�v�;�-�.�
�3�t�9�m�$�
�3���!�#4�5�����)�)�+�,����c�o�o�/��5�
6�
5�s�B/�/B8c���|j}tdd�5}tjj	�j|�}ddd�|dd�||dd�||j
�d�|j|j��|j|j�t�|j|jd�	�t�y#1swY��xYw)
NrQr�r�rr�rrkTrX)
r2r'r�r�r�r�rHrrr�rZr�r�rs    r9�test_bytes_header_parserz$TestParsers.test_bytes_header_parser3s���
�
�
��
�l�D�
)�R��,�,�0�0�2�8�8��<�C�*�
�3�v�;�-�.�
�3�t�9�m�$�
�3���!�#4�5�����)�)�+�,����c�o�o�/��5����c�o�o�T�o�:�E�B�*�
)�s�.C(�(C1c�6�tdd��5}|j�}ddd�tjj	tj
j��}|jd��}|j|jg�y#1swY�qxYw)Nz
msg_47.txtrVr�r�T)�headersonly)
r'r�r�r�rr�r{r�r2r�)r6r�r�r��
parsed_msgs     r9�%test_header_parser_multipart_is_validz1TestParsers.test_header_parser_multipart_is_valid?sr��
�l�W�
5���g�g�i�G�6����$�$�E�L�L�,@�,@�$�A���_�_�W�$�_�?�
�����+�+�R�0�
6�
5�s�B�Bc���tdd�5}tjj�j	|�|j|j�ddd�y#1swYyxYw)NrQr�)r'r�r��BytesParserr�r�closedr�s  r9�%test_bytes_parser_does_not_close_filez1TestParsers.test_bytes_parser_does_not_close_fileIsG��
�l�D�
)�R��L�L�$�$�&�,�,�R�0����R�Y�Y�'�*�
)�
)�s�A	A�A(c�X�tdd�5}tjj}|j	tj
j|tjj��j|�|j|j�ddd�y#1swYyxYw)Nr�r�r�)r'r�r�rr�r r�r�rSr�rr)r6r��bytesParsers   r9�2test_bytes_parser_on_exception_does_not_close_filez>TestParsers.test_bytes_parser_on_exception_does_not_close_fileNsr��
�l�D�
)�R��,�,�2�2�K����e�l�l�F�F�)����1D�1D�E�K�K� �
"�
���R�Y�Y�'�*�
)�
)�s�B
B � B)c���tdd��5}tjj�j	|�|j|j�ddd�y#1swYyxYw)NrQrVr�)r'r�r�rr�rrr�s  r9�test_parser_does_not_close_filez+TestParsers.test_parser_does_not_close_fileVsG��
�l�W�
5���L�L���!�'�'��+����R�Y�Y�'�6�
5�
5�s�A	A � A)c�Z�tdd��5}tjj}|j	tj
j|tjj��j|�|j|j�ddd�y#1swYyxYw)Nr�rVr�r�)r'r�r�rr�r r�r�rSr�rr)r6r�r�s   r9�,test_parser_on_exception_does_not_close_filez8TestParsers.test_parser_on_exception_does_not_close_file[sp��
�l�W�
5���\�\�(�(�F����e�l�l�F�F�$�E�L�L�,?�,?�@�F�F��
L����R�Y�Y�'�	6�
5�
5�s�B
B!�!B*c��|j}tjd�}||dd�||dd�||j�d�y)Nz�From: aperson@dom.ain
To: bperson@dom.ain
Subject: the next line has a space on it
 
Date: Mon, 8 Apr 2002 15:09:19 -0400
Message-ID: spam

Here's the message body
r��!the next line has a space on it
 r�spam�Here's the message body
�r2r�r�rZr5s   r9�test_whitespace_continuationz(TestParsers.test_whitespace_continuationb�V��
�
�
���'�'�	)�	��	�3�y�>�?�@�
�3�|��f�%�
�3�?�?��9�:r;c��|j}tjd�}||dd�||dd�||j�d�y)Nz�From: aperson@dom.ain
To: bperson@dom.ain
Date: Mon, 8 Apr 2002 15:09:19 -0400
Message-ID: spam
Subject: the next line has a space on it
 

Here's the message body
r�rrrrrr5s   r9�(test_whitespace_continuation_last_headerz4TestParsers.test_whitespace_continuation_last_headertrr;c��|j}tddd��5}t�j|�}ddd�|t	j��d�|jd�}||j
�d�||j�d�|jd	�}||j
�d
�y#1swY��xYw)Nr�rVr*r�r�rr?z!Simple email with attachment.

r|zapplication/riscos)r2r'rr�r�rZrH)r6r7r�r8�part1�part2s      r9�test_crlf_separationz TestParsers.test_crlf_separation�s���
�
�
��
�l�W�d�
C�r��(�.�.��$�C�D�
�3�s��� �!�1�%�����"��
�5�!�!�#�\�2�
�5���� G�H�����"��
�5�!�!�#�%9�:�D�
C�s�C�Cc�$�tddd��5}|j�}ddd�tj�}t	�}t|�}|j
|d��|j|j�|�y#1swY�gxYw)Nr�rVr*r�r�r�r�r�s      r9�test_crlf_flattenzTestParsers.test_crlf_flatten�sq��
�l�W�d�
C�r��7�7�9�D�D��'�'��-���J���a�L��	�	�	�#�v�	�&��������t�,�
D�
C�s�B�BNc���|j}|j}tdd��5}tj|�}ddd�|j�d�|t
|j��d�|jd�}||j�d�||j�d�|t
|j��d�|jd�}||j�d�||j�d�||j�d	�|jd�}||j�d�||j�d�|t
|j��d�|jd�}||j�d�||j�d�||j�d
�y#1swY���xYw)NrdrVr�r|r�rr[r?r"r#)	r2rr'r�rrr�rZrH)	r6r7r�r�r8r#�part1ar$�part2as	         r9�-test_multipart_digest_with_extra_mime_headersz9TestParsers.test_multipart_digest_with_extra_mime_headers�s���
�
�
���#�#��
�l�W�
5���)�)�"�-�C�6�	�3����q�!�
�3�s��� �!�1�%�����"��
�5�!�!�#�%5�6�
�5�����#�
�3�u� � �"�#�Q�'��"�"�1�%��
�6��� �!�$�
�6�"�"�$�l�3��F��� �-�0�����"��
�5�!�!�#�%5�6�
�5�����#�
�3�u� � �"�#�Q�'��"�"�1�%��
�6��� �!�$�
�6�"�"�$�l�3��F��� �-�0�56�
5�s�G&�&G0c��gd�}tjtj|��}|j	|dd�y)N)z$From: Andrew Person <aperson@dom.ainz
Subject: Testz%Date: Tue, 20 Aug 2002 16:43:45 +1000�datezTue, 20 Aug 2002 16:43:45 +1000)r�r�r�r�r2)r6r�r8s   r9�test_three_lineszTestParsers.test_three_lines�s8��:���'�'������7������V��&G�Hr;c��|j}d}d}d|�d|�d�}tj|�}||jd�|�||jd�|�y)Nr�z	more textzHeader: z
Next-Header: z

Body

rzNext-Header)r2r�r��get)r6r7�value1�value2r�r8s      r9�3test_strip_line_feed_and_carriage_return_in_headersz?TestParsers.test_strip_line_feed_and_carriage_return_in_headers�sY��
�
�
�������F�
���'�'��*��
�3�7�7�8��f�%�
�3�7�7�=�!�6�*r;c���|j}d}tj|�}|t|�d�|t	d�|D��gd��||j�d�y)Nz(>From: foo
From: bar
!"#QUX;~: zoo

bodyr�c3� K�|]}|���y�wrfr�)rA�fields  r9rCz9TestParsers.test_rfc2822_header_syntax.<locals>.<genexpr>�s����)�S�E�%�S���)z!"#QUX;~z>Fromr�r�)r2r�r�r�r�rZr�s    r9�test_rfc2822_header_syntaxz&TestParsers.test_rfc2822_header_syntax�sV��
�
�
��:���'�'��*��
�3�s�8�Q��
�6�)�S�)�)�+H�I�
�3�?�?��f�%r;c��|j}d}tj|�}|t|j	��d�y)Nz<>From foo@example.com 11:25:53
From: bar
!"#QUX;~: zoo

bodyr)r2r�r�r�r�r�s    r9�(test_rfc2822_space_not_allowed_in_headerz4TestParsers.test_rfc2822_space_not_allowed_in_header�s6��
�
�
��N���'�'��*��
�3�s�x�x�z�?�A�r;c���|j}d}tj|�}|j�}|j	�||gd��||j�d�y)Nz7A: first header
B: second header
CC: third header

body)�A�B�CCr�)r2r�r�r��sortrZ)r6r7r�r8�headerss     r9�!test_rfc2822_one_character_headerz-TestParsers.test_rfc2822_one_character_header�sR��
�
�
��I���'�'��*���(�(�*������
�7�$�%�
�3�?�?��f�%r;c��d}tj|�}|j|jd�j�j	d��y)Nz�From: foo@bar.com
To: baz
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=BOUNDARY

--BOUNDARY
Content-Type: text/plain

body ending with CRLF newline

--BOUNDARY--
rr�)r�r�r�rZr��r6r�r8s   r9�test_CRLFLF_at_end_of_partz&TestParsers.test_CRLFLF_at_end_of_part�sG��

�	
��'�'��*���������*�6�6�8�A�A�&�I�Jr;)r�r�r�rr	r
rrrrrr!r%r'r�r+r.r3r8r:rArDr�r;r9rr&sf��	6�
C�1�(�
(�(�
(�;�$;�$	;�-��G�1�>I�	+�&��&�Kr;rc	��eZdZejd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	Z
d
je
D���cgc]\}}|��	c}}}�dzjd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zejd�jd�Zd�Zd�Zejd�Zd�Z d�Z!d�Z"ejGd
�Z$dge$d d!d
je$�Z$d"�Z%ejd#�jd$�Z&ejd%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-Z/y-cc}}}w).�Test8BitBytesHandlingz�        From: foo@bar.com
        To: baz
        Mime-Version: 1.0
        Content-Type: text/plain; charset={charset}
        Content-Transfer-Encoding: {cte}

        {bodyline}
        c�*�|jjddd��jd�}tj|�}|j|j
�d�|j|j
d��djd��y)NrVr`�pöstal�rAr��bodyline�pöstal
TrX��bodytest_msgr�r�r�r�r2rZrCs   r9�test_known_8bit_CTEz)Test8BitBytesHandling.test_known_8bit_CTE
s������$�$�W�)/�.7�
%�
9�9?����	
��&�&�q�)��������*�K�8���������5�$�+�+�G�4�	6r;c�*�|jjddd��jd�}tj|�}|j|j
�d�|j|j
d��d	jd��y)
N�notavalidcharsetr`rHrIrVup��stal
TrXrKrLrCs   r9�test_unknown_8bit_CTEz+Test8BitBytesHandling.test_unknown_8bit_CTEs������$�$�-?�)/�.7�
%�
9�9?����	
��&�&�q�)��������*�,A�B���������5�$�+�+�G�4�	6r;c�*�|jjddd��jd�}tj|�}|j|j
�d�|j|j
d��djd��y)	NrVrC�p=C3=B6stálrIu
p=C3=B6stál
TrX�	pöstál
rLrCs   r9�test_8bit_in_quopri_bodyz.Test8BitBytesHandling.test_8bit_in_quopri_bodys���
���$�$�W�);�.<�
%�
>�>D�f�W�o�	
��&�&�q�)��������*�,<�=���������5�%�,�,�W�5�	7r;c�*�|jjddd��jd�}tj|�}|j|j
�d�|j|j
d��d	jd��y)
Nr�rCrSrIrVup=C3=B6st��l
TrXrTrLrCs   r9�.test_invalid_8bit_in_non_8bit_cte_uses_replacezDTest8BitBytesHandling.test_invalid_8bit_in_non_8bit_cte_uses_replace1s���
���$�$�W�);�.<�
%�
>�>D�f�W�o�	
��&�&�q�)��������*�,F�G���������5�$�+�+�G�4�	6r;c�D�|jjddd��jd�}tj|�}|j|j
d��djd��|j|jdtj�y)	NrVrWu
cMO2c3RhbAá=rITrXrHr)rMr�r�r�r�r2rZr�r�r r�rCs   r9�test_8bit_in_base64_bodyz.Test8BitBytesHandling.test_8bit_in_base64_bodyAs���
���$�$�W�)1�.=�
%�
?�?E�v�g��	
��&�&�q�)����������5�"�)�)�'�2�	4����c�k�k�!�n�$�B�B�	Dr;c���|jjddd��jd�}tj|�}|j|j
d��djd��y)NrVr�u
<,.V<W1A; á rITrXu<,.V<W1A; á 
rLrCs   r9�test_8bit_in_uuencode_bodyz0Test8BitBytesHandling.test_8bit_in_uuencode_bodyNsn��
���$�$�W�)3�.=�
%�
?�?E�v�g��	
��&�&�q�)����������5�*�1�1�'�:�	<r;c��tjd�jd�}tj|�}|j|j
�d�|j|j
d��djd��y)Nu�        From: foo@bar.com
        To: baz
        Mime-Version: 1.0
        Content-Type: text/plain; charset*=ansi-x3.4-1968''utf-8
        Content-Transfer-Encoding: 8bit

        pöstal
        rVrKTrX)r�r�r�r�r�r2rZrCs   r9�test_rfc2231_charset_8bit_CTEz3Test8BitBytesHandling.test_rfc2231_charset_8bit_CTEXsu���O�O��

��V�G�_�	
��&�&�q�)��������*�K�8���������5�$�+�+�G�4�	6r;))zFrom: foo@bar.com�r�rc)uTo: báz)r�z=?unknown-8bit?q?b=C3=A1z?=)uVSubject: Maintenant je vous présente mon collègue, le pouf célèbre
	Jean de Baddie)r�z�=?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_coll=C3=A8gue=2C_le_pouf_c=C3=A9l=C3=A8bre?=
 =?unknown-8bit?q?_Jean_de_Baddie?=)uFrom: göst)r�z=?unknown-8bit?b?Z8O2c3Q=?=r*z
Yes, they are flying.
rVc���tj|j�}|jt	|jd��d�|jt	|d�d�y)Nr��b��z)r�r��headertest_msgr2r�r0rhs  r9�test_get_8bit_headerz*Test8BitBytesHandling.test_get_8bit_headerusO���&�&�t�':�':�;������S�W�W�T�]�+�-=�>�����S��Y��)9�:r;c��tj|j�}|jt	|�tjd�j|jD��cgc]
\}}|d��c}}��ycc}}w)Nz�                            From: {}
                            To: {}
                            Subject: {}
                            From: {}

                            Yes, they are flying.
                            r|)	r�r�rar2r�r�r�r��headertest_headers)r6r8�_r�s    r9�test_print_8bit_headersz-Test8BitBytesHandling.test_print_8bit_headerszs����&�&�t�':�':�;������S��(����* �!�"(��(,�(?�(?�*A�(?�;H�1�h�(�1�+�(?�*A�B�		C��*As�#A<c��tj|j�}|j|j	�D�cgc]
}t|���c}gd��ycc}w)N)rcr`�]Maintenant je vous pr��sente mon coll��gue, le pouf c��l��bre
	Jean de Baddie�	g��st)r�r�ra�assertListEqualr�r��r6r8r�s   r9�test_values_with_8bit_headersz3Test8BitBytesHandling.test_values_with_8bit_headers�sI���&�&�t�':�':�;�����c�j�j�l�;�l��c�!�f�l�;�2�	3��;s�Ac
���tj|j�}|j|j	�D��cgc]\}}t|�t|�f��c}}gd��ycc}}w)N)r^)r�r`)r�rh)r�ri)r�r�rarjr�r�)r6r8r�rs    r9�test_items_with_8bit_headersz2Test8BitBytesHandling.test_items_with_8bit_headers�sV���&�&�t�':�':�;�����S�Y�Y�[�I�[�6�A�q�s�1�v�s�1�v�.�[�I�<�	=��Is� A*
c��tj|j�}|j|j	d�D�cgc]
}t|���c}ddg�ycc}w)Nr�rcri)r�r�rarjr4r�rks   r9�test_get_all_with_8bit_headersz4Test8BitBytesHandling.test_get_all_with_8bit_headers�sT���&�&�t�':�':�;�����c�k�k�&�.A�B�.A��c�!�f�.A�B�,�0�2�	3��Bs�Ac�2�tjtjd�j	d��}|j|j
�d�|j|j�d�|j|j�d�y)NuA            Content-Type: text/pl§in; charset=utf-8
            r�utext/pl�inr�upl�in)	r�r�r�r�r�r2rHrnr�rhs  r9�test_get_content_type_with_8bitz5Test8BitBytesHandling.test_get_content_type_with_8bit�sz���&�&�x���8�(���	�"�$��	
����-�-�/�1B�C�����1�1�3�V�<�����0�0�2�L�Ar;c� �tjdjd��}|j|j	d��gd��|j|jdd��d�|j|jdd��d�y)	Nu(X-Header: foo=§ne; b§r=two; baz=three
r�r
r))r���ne)ub�rrr�Foortub§r)r�r�r�r2rrIrhs  r9�test_get_params_with_8bitz/Test8BitBytesHandling.test_get_params_with_8bit�sz���&�&�;�B�B�9�M�O��������z��:�G�	I�������u�Z��@�*�M�������x�
��C�T�Jr;c��tjtjd�j	d��}|j|j
d�d�y)N�n            Content-Type: text/plain; charset=us-ascii;
             title*=us-ascii'en'This%20is%20not%20f§nr��title)rN�enuThis is not f�n)r�r�r�r�r�r2rIrhs  r9�!test_get_rfc2231_params_with_8bitz7Test8BitBytesHandling.test_get_rfc2231_params_with_8bit�sL���&�&�x���8<�(��v�i� �"��	
������w�/�6�	8r;c���tjtjd�j	d��}|jdd�|j
|jd�d�y)Nrxr�ry�test)r�r�r�r�r�r3r2rIrhs  r9�!test_set_rfc2231_params_with_8bitz7Test8BitBytesHandling.test_set_rfc2231_params_with_8bit�sW���&�&�x���8<�(��v�i� �"��	�
�
�g�v�&�������w�/��8r;c��tjtjd�j	d��}|jd�|j
|jd�d�|j
|j�d�y)Nrxr�ryr�)	r�r�r�r�r�r=r2rIrnrhs  r9�!test_del_rfc2231_params_with_8bitz7Test8BitBytesHandling.test_del_rfc2231_params_with_8bit�sn���&�&�x���8<�(��v�i� �"��	�
�
�g��������w�/��6�����1�1�3�V�<r;c��tjtjd�j	d��}|j|j
�d�|j|j
d��d�y)Nu�            Content-Transfer-Encoding: b§se64
            Content-Type: text/plain; charset=latin-1

            payload
            r�zpayload
TrXspayload
)r�r�r�r�r�r2rZrhs  r9�%test_get_payload_with_8bit_cte_headerz;Test8BitBytesHandling.test_get_payload_with_8bit_cte_header�sb���&�&�x���8�(�
��	�"�$��	
������*�K�8���������5�|�Dr;u0        From: foo@bar.com
        To: báz
        Subject: Maintenant je vous présente mon collègue, le pouf célèbre
        	Jean de Baddie
        Mime-Version: 1.0
        Content-Type: text/plain; charset="utf-8"
        Content-Transfer-Encoding: 8bit

        Да, они летят.
        c��tj|j�}t�}tjj|�j
|�|j|j�|j�yrf)	r�r��non_latin_bin_msgrr�r
r�r2r��r6r8r�s   r9�test_bytes_generatorz*Test8BitBytesHandling.test_bytes_generator�sX���&�&�t�'=�'=�>���i��
���&�&�s�+�3�3�C�8���������)?�)?�@r;c���tjj�}t�}tjj|�j
|�|j|j�d�y)Nr�)	r�rqrrr�r
r�r2r�r�s   r9�&test_bytes_generator_handles_None_bodyz<Test8BitBytesHandling.test_bytes_generator_handles_None_body�sN���m�m�#�#�%���i��
���&�&�s�+�3�3�C�8���������/r;a�        From: foo@bar.com
        To: =?unknown-8bit?q?b=C3=A1z?=
        Subject: =?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_coll=C3=A8gue?=
         =?unknown-8bit?q?=2C_le_pouf_c=C3=A9l=C3=A8bre?=
         =?unknown-8bit?q?_Jean_de_Baddie?=
        Mime-Version: 1.0
        Content-Type: text/plain; charset="utf-8"
        Content-Transfer-Encoding: base64

        0JTQsCwg0L7QvdC4INC70LXRgtGP0YIuCg==
        c��tj|j�}t�}tjj|�j
|�|j|j�|j�yrf)
r�r�r�rr�rr�r2r�� non_latin_bin_msg_as7bit_wrappedr�s   r9�test_generator_handles_8bitz1Test8BitBytesHandling.test_generator_handles_8bitsX���&�&�t�'=�'=�>���j��
���!�!�#�&�.�.�s�3���������)N�)N�Or;c�v�tj|j�}t�}t	|�j|�|j
�}tt��j|�t�}t	|�j|�|j|j
�|�yrf)
r�r�r�rr
r�r�rrr2)r6r8r��
orig_values    r9�;test_str_generator_should_not_mutate_msg_when_handling_8bitzQTest8BitBytesHandling.test_str_generator_should_not_mutate_msg_when_handling_8bits����&�&�t�'=�'=�>���i���s��#�#�C�(��\�\�^�
��(�*��%�%�c�*��i���s��#�#�C�(���������4r;c��tj|j�}t�}tjj|�j
|d��|j�jd�}|j|dj�dd�|jdj|dd�|j�y)NTr�r�rsFromr|)r�r�r�rr�r
r�r�r�r2r�)r6r8r�r�s    r9�#test_bytes_generator_with_unix_fromz9Test8BitBytesHandling.test_bytes_generator_with_unix_froms����&�&�t�'=�'=�>���i��
���&�&�s�+�3�3�C�$�3�G�����$�$�U�+������q����)�!�,�g�6�������E�!�"�I�.��0F�0F�Gr;zkSubject: =?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_coll=C3=A8gue=2C_le_pouf_c=C3=A9l=C3=A8bre?=r�r�c��d}|jt|�t|d�5}|j|j�ddd�t|d�5}t
jj�j|�}ddd�|jt�|j�y#1swY�qxYw#1swY�;xYw)Nztest.msg�wbr�)�
addCleanupr&�open�writer�r�r�rr�r2r��non_latin_bin_msg_as7bit)r6r��testfiler�s    r9�test_message_from_binary_filez3Test8BitBytesHandling.test_message_from_binary_file!s���
�������#�
�"�d�^�x��N�N�4�1�1�2��
�"�d�^�x����(�(�*�0�0��:�A������Q���!>�!>�?�	�^��
�^�s�B1�.B=�1B:�=Cu        From: foo@bar.com
        To: Dinsdale
        Subject: Nudge nudge, wink, wink
        Mime-Version: 1.0
        Content-Type: text/plain; charset="latin-1"
        Content-Transfer-Encoding: 8bit

        oh là là, know what I mean, know what I mean?
        r�a         From: foo@bar.com
        To: Dinsdale
        Subject: Nudge nudge, wink, wink
        Mime-Version: 1.0
        Content-Type: text/plain; charset="iso-8859-1"
        Content-Transfer-Encoding: quoted-printable

        oh l=E0 l=E0, know what I mean, know what I mean?
        c��tj|j�}|jt	|�|j
�yrf)r�r��
latin_bin_msgr2r��latin_bin_msg_as7bitr�s  r9�:test_string_generator_reencodes_to_quopri_when_appropriatezPTest8BitBytesHandling.test_string_generator_reencodes_to_quopri_when_appropriate@s2���$�$�T�%7�%7�8������Q���!:�!:�;r;c�*�tj|j�}t�}tjj|�j
|�|j|j�|jjd�dz�y)Nr�r*)
r�r�r�rr�rr�r2r�rY)r6r�r�s   r9�)test_decoded_generator_emits_unicode_bodyz?Test8BitBytesHandling.test_decoded_generator_emits_unicode_bodyDsm���$�$�T�%7�%7�8���j��
���(�(��-�5�5�a�8�	
����������%�%�i�0��5�	7r;c�6�tjj�}tdt	|j
�d�D]#}|j
|j
||dz��%|j�}|jt|�|j�y)NrrD)r�r��BytesFeedParserrHr�r�r�r�r2r�r�)r6�bfprBr�s    r9�test_bytes_feedparserz+Test8BitBytesHandling.test_bytes_feedparserNsv�����.�.�0���q�#�d�0�0�1�2�6�A��H�H�T�'�'��!�B�$�/�0�7��I�I�K������Q���!:�!:�;r;c�H�tdd�5}|j�}ddd�tj�}t	�}tj
j
|�}|j|d��|j|j�|�y#1swY�{xYw)Nr�r�r�r�)
r'r�r�r�rr�r
r�r2r�r�s      r9r'z'Test8BitBytesHandling.test_crlf_flattenUsx��
�l�D�
)�R��7�7�9�D�*��&�&�t�,���I���O�O�*�*�1�-��	�	�	�#�v�	�&��������t�,�
*�
)�s�B�B!c�*�tjd�jd�}tj|�}t�}tjj|�}|j|�|j|j�|�y)Nuo            Date: Fri, 18 Mar 2011 17:15:43 +0100
            To: foo@example.com
            From: foodwatch-Newsletter <bar@example.com>
            Subject: Aktuelles zu Japan, Klonfleisch und Smiley-System
            Message-ID: <76a486bee62b0d200f33dc2ca08220ad@localhost.localdomain>
            MIME-Version: 1.0
            Content-Type: multipart/alternative;
                    boundary="b1_76a486bee62b0d200f33dc2ca08220ad"

            --b1_76a486bee62b0d200f33dc2ca08220ad
            Content-Type: text/plain; charset="utf-8"
            Content-Transfer-Encoding: 8bit

            Guten Tag, ,

            mit großer Betroffenheit verfolgen auch wir im foodwatch-Team die
            Nachrichten aus Japan.


            --b1_76a486bee62b0d200f33dc2ca08220ad
            Content-Type: text/html; charset="utf-8"
            Content-Transfer-Encoding: 8bit

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/html4/loose.dtd">
            <html lang="de">
            <head>
                    <title>foodwatch - Newsletter</title>
            </head>
            <body>
              <p>mit gro&szlig;er Betroffenheit verfolgen auch wir im foodwatch-Team
                 die Nachrichten aus Japan.</p>
            </body>
            </html>
            --b1_76a486bee62b0d200f33dc2ca08220ad--

            rV)r�r�r�r�r�rr�r
r�r2r�)r6r�r8r�r�s     r9�test_8bit_multipartz)Test8BitBytesHandling.test_8bit_multipart^st�����%"�%�J����K	�L�&�&�v�.���I���O�O�*�*�1�-��	�	�	�#���������v�.r;c���t�}td�|d<t�}tjj|�}|j
|d��|j|j�d�y)N�žluťoučký kůňr�r�r�s5Subject: =?utf-8?b?xb5sdcWlb3XEjWvDvSBrxa/FiA==?=

)	rrrr�r�r
r�r2r��r6r�r�r�s    r9�'test_bytes_generator_b_encoding_linesepz=Test8BitBytesHandling.test_bytes_generator_b_encoding_linesep�s^���I���3�4��)���I���O�O�*�*�1�-��	�	�	�!�V�	�$����
�J�J�L�H�	Jr;c���t�}td�|d<t�}tjj|�}|j
|d��|j|j�d�y)Nr�r�r�r�z5Subject: =?utf-8?b?xb5sdcWlb3XEjWvDvSBrxa/FiA==?=

)	rrrr�r�rr�r2r�r�s    r9�!test_generator_b_encoding_linesepz7Test8BitBytesHandling.test_generator_b_encoding_linesep�s^���I���3�4��)���J���O�O�%�%�a�(��	�	�	�!�V�	�$����
�J�J�L�G�	Ir;N)0r�r�r�r�r�rMrNrQrUrWrYr[r]rdr�r�rarbrfrlrnrprrrvr{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r'r�r�r�r�)rA�srcres000r9rFrF�s���#�8�?�?�$�
�L�6�6�7�$
6� D�<�
6� 	
���i�i�5G� H�5G��#�q��5G� H�I�#�$�%+�V�G�_��;�
C�	3�
=�3�B�K�8�9�=�E�(����
)�

��V�G�_��A�0�(7�x���8�(
�$�P�5�	H� @�E�E�d�K��	8�%9��Q�q�!� $�y�y�)A�B��@�$�H�O�O�	%�	
��V�I�
��+�8�?�?�	,�	
��<�7�<�-�,/�\
J�
I��G��e	!Is�D?rFc��eZdZdZd�Zdd�Zy)� BaseTestBytesGeneratorIdempotentNc���t|d�5}|j�}ddd�|jj|j�}tj|�}||fS#1swY�HxYw)Nr�)r'r��normalize_linesep_regex�sub�blinesepr�r�rCs     r9r3z(BaseTestBytesGeneratorIdempotent._msgobj�s]��
�h��
%���7�7�9�D�&��+�+�/�/��
�
�t�D���&�&�t�,���D�y��	&�
%�s�A%�%A.c���t�}tjj|d��}|j	|||j
��|j
||j��y)Nrrt)r�r�)rr�r�r
r�r�r2r�)r6r8r\r�r�r�s      r9rEz,BaseTestBytesGeneratorIdempotent._idempotent�sN���I���O�O�*�*�1�1�*�=��	�	�	�#��$�,�,�	�?�����q�z�z�|�,r;r)r�r�r�r�r3rEr�r;r9r�r��s���G��-r;r�c�8�eZdZdZdZejd�Zy)�TestBytesGeneratorIdempotentNLr*r�s\r\nN�r�r�r�r�r��re�compiler�r�r;r9r�r��s���G��H�(�b�j�j��2�r;r�c�8�eZdZdZdZejd�Zy)� TestBytesGeneratorIdempotentCRLFr�r�s	(?<!\r)\nNr�r�r;r9r�r��s���G��H�(�b�j�j��7�r;r�c�$�eZdZd�Zd�Zd�Zd�Zy)�
TestBase64c	�B�|j}|tjd�ttjdd����td�D]K}|dk(rd}n"|dkrd}n|d	krd
}n|dkrd}n
|dkrd
}nd}|tjd|z�|��My)N�hello�hellor+��eol�rr�r�r�r�r��r��r�)r2r�
header_lengthr��body_encoderH)r6r7�size�bsizes    r9�test_lenzTestBase64.test_len�s���
�
�
��
�:�#�#�G�,��z�%�%�h�B�7�8�	:��"�I�D����Q�U����Q�U����Q�U����R�U����R�U�%'�U��z�'�'��d�
�3�U�;�r;c��|j}|tjd�d�|tjd�d�y)Nr+r;zaGVsbG8=r�)r2rrYr�s  r9�test_decodezTestBase64.test_decode�s7��
�
�
��
�:���R� �#�&�
�:���Z�(�(�3r;c�>�|j}|tjd�d�|tjd�d�|tjd�d�|tjdd�	�d
�|tjddd��d
�y)Nr;r+r�z	aGVsbG8=
shello
z	aGVsbG8K
sdxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx �(rz�eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IA==
r��rr�z�eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IA==
)r2rr�r�s  r9�test_encodezTestBase64.test_encode�s���
�
�
��
�:�!�!�#�&��+�
�:�!�!�(�+�\�:�
�:�!�!�*�-�|�<�
�:�!�!�-�B�?�B�	�	�:�!�!�-�B�F�K��	r;c���|j}tj}||d�d�||d�d�||d�d�||dd��d	�||d�d�y)
Nr�z=?iso-8859-1?b?aGVsbG8=?=�hello
worldz!=?iso-8859-1?b?aGVsbG8NCndvcmxk?=�hello
worldz!=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=rrrMz=?iso-8859-2?b?aGVsbG8=?=)r2rr)r6r7�hes   r9�test_header_encodezTestBase64.test_header_encode�sj��
�
�
��
�
%�
%��
�2�g�;�3�4�
�2���!D�E�
�2�n��B�C�
�2�g�|�,�.I�J�
�2�n��B�Cr;N)r�r�r�r�r�r�r�r�r;r9r�r��s��<�4�
�,Dr;r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�ZdEd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�ZdEd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,dFd,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:d:�Z;d;�Z<d<�Z=d=�Z>d>�Z?d?�Z@d@�ZAdA�ZBdB�ZCdC�ZDdD�ZEy)G�
TestQuopric�z�ttttd�td�dz�ttd�td�dz�ttd�td�dz�d�d	D���|_td
�D�cgc]}||jvs�|��c}|_t
|j�t
|j
�zd
k(sJ�tttd�td�dz��|_|jjtd
��|jjtd��td
�D�cgc]}||jvs�|��c}|_
t
|j�t
|j�zd
k(sJ�ycc}wcc}w)Nr��zr|r<�Zr��9c3� K�|]}|���y�wrfr�)rAr�s  r9rCz#TestQuopri.setUp.<locals>.<genexpr>s����!��1�Q��r7s!*+-/�r,�~r�=)r�rrH�ord�hlit�hnonr��blitr �remove�bnon�r6r�s  r9r�zTestQuopri.setUp�sN�����#�c�(�C��H�q�L�)��#�c�(�C��H�q�L�)��#�c�(�C��H�q�L�)�!��!�	#�$��	�!&�c�
�A�
�1�a�t�y�y�.@�Q�
�A��	��4�9�9�~��D�I�I��.�#�5�5�5���s�3�x��S��A��6�7��	��	�	����T��#��	�	����S��"�!&�c�
�A�
�1�a�t�y�y�.@�Q�
�A��	��4�9�9�~��D�I�I��.�#�5�5�5��B��Bs�F3�"F3�"F8�6F8c��|jD]3}|jtj|�dt	|�z��5|j
D]3}|j
tj|�dt	|�z��5y)Nz'Should not be header quopri encoded: %sz#Should be header quopri encoded: %s)r�rr"�header_check�chrr�r�r�s  r9�test_quopri_header_checkz#TestQuopri.test_quopri_header_checksn�����A����Z�4�4�Q�7�A�C��F�J�
L�����A��O�O�J�3�3�A�6�A�C��F�J�
L�r;c��|jD]3}|jtj|�dt	|�z��5|j
D]3}|j
tj|�dt	|�z��5y)Nz%Should not be body quopri encoded: %sz!Should be body quopri encoded: %s)r�rr"�
body_checkr�r�r�r�s  r9�test_quopri_body_checkz!TestQuopri.test_quopri_body_checksn�����A����Z�2�2�1�5�?�#�a�&�H�
J�����A��O�O�J�1�1�!�4�?�#�a�&�H�
J�r;c	���|j}|tjd�d�|ttjdd���tjd�dz�|tjd�d�|ttjdd���tjd�dz�|j
D]5}|tjt
|g��dd	t|�z��7|jD]D}|td
�k(r�|tjt
|g��ddt|�z��F|tjd
�d�y)Nr�r��xxxrMrDs
h@e@l@l@o@r�r|zexpected length 1 for %rr,r�zexpected length 3 for %r� )
r2r"r�r�rr�r�r�r�r��r6r7r�s   r9�test_header_quopri_lenz!TestQuopri.test_header_quopri_len"s4��
�
�
��
�:�#�#�H�-�q�1�
�3�z�'�'��%�@�A��#�#�H�-�
��	�	�:�#�#�M�2�B�7�
�3�z�'�'�
�u�E�F��#�#�M�2�
��	����A��z�'�'��q�c�
�3�Q�)�C��F�2�
4�����A��C��H�}���z�'�'��q�c�
�3�Q�)�C��F�2�
4�	�	�:�#�#�D�)�1�-r;c��|j}|jD](}|tjt	|g��d��*|j
D](}|tjt	|g��d��*y)Nr|r�)r2r�r"�body_lengthr�r�r�s   r9�test_body_quopri_lenzTestQuopri.test_body_quopri_len;s_��
�
�
�����A��z�%�%�e�Q�C�j�1�1�5�����A��z�%�%�e�Q�C�j�1�1�5�r;c��td�D]E}t|�}|jtjtj
|��|��Gy)Nr�)rHr�r2r"r$�quote)r6r�r�s   r9�test_quote_unquote_idempotentz(TestQuopri.test_quote_unquote_idempotentBs?���s��A��A��A����Z�/�/�
�0@�0@��0C�D�a�H�r;Nc��|�tj|�}ntj||�}|j||�yrf)r"rr2)r6r��expected_encoded_headerrA�encoded_headers     r9�_test_header_encodezTestQuopri._test_header_encodeGs:���?�'�5�5�f�=�N�'�5�5�f�g�F�N�����)@�Ar;c�(�|jdd�y)Nr;r+�r�r�s r9�test_header_encode_nullz"TestQuopri.test_header_encode_nullNs��� � ��b�)r;c�(�|jdd�y)Nr�z=?iso-8859-1?q?hello?=r�r�s r9�test_header_encode_one_wordz&TestQuopri.test_header_encode_one_wordQs��� � ��+C�Dr;c�(�|jdd�y)Nshello
worldz=?iso-8859-1?q?hello=0Aworld?=r�r�s r9�test_header_encode_two_linesz'TestQuopri.test_header_encode_two_linesTs��� � �� @�	Br;c�(�|jdd�y)Nshello�therez=?iso-8859-1?q?hello=C7there?=r�r�s r9�test_header_encode_non_asciiz'TestQuopri.test_header_encode_non_asciiXs��� � �!2� @�	Br;c�,�|jddd��y)Nr�z=?iso-8859-2?q?hello?=rrrMr�r�s r9�test_header_encode_alt_charsetz)TestQuopri.test_header_encode_alt_charset\s��� � ��+C�$�	!�	&r;c�R�tj|�}|j||�yrf)r"�
header_decoder2)r6r��expected_decoded_header�decoded_headers    r9�_test_header_decodezTestQuopri._test_header_decode`s#��#�1�1�.�A������)@�Ar;c�(�|jdd�y�Nr+�rr�s r9�test_header_decode_nullz"TestQuopri.test_header_decode_nullds��� � ��R�(r;c�(�|jdd�y�Nr�rr�s r9�test_header_decode_one_wordz&TestQuopri.test_header_decode_one_wordgs��� � ��'�2r;c�(�|jdd�y)Nz
hello=0Aworldr�rr�s r9�test_header_decode_two_linesz'TestQuopri.test_header_decode_two_linesjs��� � ��.�Ar;c�(�|jdd�y)Nz
hello=C7thereuhelloÇthererr�s r9�test_header_decode_non_asciiz'TestQuopri.test_header_decode_non_asciims��� � ��2B�Cr;c�N�|jtjd�d�y)Na=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30=30�00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)r2r"rr�s r9�test_header_decode_re_bug_18380z*TestQuopri.test_header_decode_re_bug_18380ps������1�1�+�>�	�Jr;c��|�tj|�}ntj||��}|j||�y)Nr�)r"rYr2)r6�encoded�expected_decodedr��decodeds     r9�_test_decodezTestQuopri._test_decodets:���;� �'�'��0�G� �'�'��S�9�G�����"2�3r;c�(�|jdd�yr
�rr�s r9�test_decode_null_wordz TestQuopri.test_decode_null_word{������"�b�!r;c�(�|jdd�y)Nr�r*r r�s r9�test_decode_null_line_null_wordz*TestQuopri.test_decode_null_line_null_word~s�����&�$�'r;c�(�|jdd�yrr r�s r9�test_decode_one_wordzTestQuopri.test_decode_one_word�s�����'�7�+r;c�,�|jddd��y)Nr��Xr�r r�s r9�test_decode_one_word_eolz#TestQuopri.test_decode_one_word_eol�s�����'�7���4r;c�(�|jdd�y�N�hello
�hello
r r�s r9�test_decode_one_linezTestQuopri.test_decode_one_line�������+�y�1r;c�(�|jdd�y�Nr-r r�s r9�test_decode_one_line_lfz"TestQuopri.test_decode_one_line_lf�������)�Y�/r;c�(�|jdd�y)Nzhello
r-r r�s r9�test_decode_one_line_crz"TestQuopri.test_decode_one_line_cr�r3r;c�,�|jddd��y)Nr-�helloXr(r�r r�s r9�test_decode_one_line_nlz"TestQuopri.test_decode_one_line_nl�s�����)�X�3��7r;c�,�|jddd��y)Nr,r7r(r�r r�s r9�test_decode_one_line_crnlz$TestQuopri.test_decode_one_line_crnl�s�����+�x�S��9r;c�(�|jdd�y)Nr�r�r r�s r9�test_decode_one_line_one_wordz(TestQuopri.test_decode_one_line_one_word�s�����*�N�;r;c�,�|jddd��y)Nr��helloXworldr(r�r r�s r9�!test_decode_one_line_one_word_eolz,TestQuopri.test_decode_one_line_one_word_eol�s�����*�M�s��Cr;c�(�|jdd�y)N�hello
world
�hello
world
r r�s r9�test_decode_two_linesz TestQuopri.test_decode_two_lines�s�����.�0@�Ar;c�,�|jddd��y)NrA�helloXworldXr(r�r r�s r9�test_decode_two_lines_eolz$TestQuopri.test_decode_two_lines_eol�s�����.��C��Hr;c�(�|jdd�y)N��SpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamr r�s r9�test_decode_one_long_linez$TestQuopri.test_decode_one_long_line�s�����,��5r;c�(�|jdd�y)Nr,r+r r�s r9�test_decode_one_spacez TestQuopri.test_decode_one_space�s�����#�r�"r;c�(�|jdd�y)Nz     r+r r�s r9�test_decode_multiple_spacesz&TestQuopri.test_decode_multiple_spaces�s�����'�2�&r;c�(�|jdd�y)Nzhello    
r-r r�s r9�$test_decode_one_line_trailing_spacesz/TestQuopri.test_decode_one_line_trailing_spaces�s�����/�9�5r;c�(�|jdd�y)Nzhello    
world   
rBr r�s r9�%test_decode_two_lines_trailing_spacesz0TestQuopri.test_decode_two_lines_trailing_spaces�s�����5�7G�Hr;c�(�|jdd�y)Nz=22quoted=20words=22z"quoted words"r r�s r9�test_decode_quoted_wordz"TestQuopri.test_decode_quoted_word�s�����0�2B�Cr;c�(�|jdd�y)Nzab=CD=EF�abÍïr r�s r9�test_decode_uppercase_quotingz(TestQuopri.test_decode_uppercase_quoting�������*�l�3r;c�(�|jdd�y)Nzab=cd=efrUr r�s r9�test_decode_lowercase_quotingz(TestQuopri.test_decode_lowercase_quoting�rWr;c�(�|jdd�y)Nzsoft line=
breakzsoft linebreakr r�s r9�test_decode_soft_line_breakz&TestQuopri.test_decode_soft_line_break�s�����/�1A�Br;c�(�|jdd�y)NzA=1,B=A ==> A+B==2r r�s r9�test_decode_false_quotingz$TestQuopri.test_decode_false_quoting�s�����.�0D�Er;c��i}|�d}n||d<|�d}n||d<tj|fi|��}|j||�|dk(s|dk(r1|j�D]}|j	t|�|��yy)Nr�rr*r�r�)r"r�r2r�r�r�)r6r��expected_encoded_bodyrr��kwargs�encoded_bodyr�s        r9�_test_encodezTestQuopri._test_encode�s��������J�#-�F�<� ��;��C��F�5�M�!�-�-�d�=�f�=������'<�=��$�;�#��-�%�/�/�1���$�$�S��Y�
�;�2�(r;c�(�|jdd�yr
�rbr�s r9�test_encode_nullzTestQuopri.test_encode_null�r"r;c�(�|jdd�y)Nz

rdr�s r9�test_encode_null_linesz!TestQuopri.test_encode_null_lines�s�����&�&�)r;c�(�|jdd�yr1rdr�s r9�test_encode_one_linezTestQuopri.test_encode_one_line�r3r;c�(�|jdd�yr+rdr�s r9�test_encode_one_line_crlfz$TestQuopri.test_encode_one_line_crlf�r/r;c�,�|jddd��y)Nr-r,r�r�rdr�s r9�test_encode_one_line_eolz#TestQuopri.test_encode_one_line_eol�s�����)�[�f��=r;c�h�|jdjd�jd�dd��y)Nuhelloυ
rV�latin1z
hello=CF=85
r�r�)rbr�rYr�s r9�(test_encode_one_line_eol_after_non_asciiz3TestQuopri.test_encode_one_line_eol_after_non_ascii�s2�����/�0�0��9�@�@��J�+��	�	9r;c�(�|jdd�y)Nr,z=20rdr�s r9�test_encode_one_spacez TestQuopri.test_encode_one_space�s�����#�u�%r;c�(�|jdd�y)Nz 
z=20
rdr�s r9�test_encode_one_line_one_spacez)TestQuopri.test_encode_one_line_one_space�s�����%��)r;c�(�|jdd�y)Nz 
 
z=20
=20
rdr�s r9�test_encode_two_lines_one_spacez*TestQuopri.test_encode_two_lines_one_space�s�����(�L�1r;c�(�|jdd�y)Nzhello   z
hello  =20rdr�s r9�$test_encode_one_word_trailing_spacesz/TestQuopri.test_encode_one_word_trailing_spaces�rWr;c�(�|jdd�y)Nz	hello   
zhello  =20
rdr�s r9�$test_encode_one_line_trailing_spacesz/TestQuopri.test_encode_one_line_trailing_spaces�s�����,��7r;c�(�|jdd�y)Nzhello  	z
hello  =09rdr�s r9�!test_encode_one_word_trailing_tabz,TestQuopri.test_encode_one_word_trailing_tab�s�����+�|�4r;c�(�|jdd�y)Nz	hello  	
zhello  =09
rdr�s r9�!test_encode_one_line_trailing_tabz,TestQuopri.test_encode_one_line_trailing_tab�s�����-��8r;c�,�|jddd��y)N�
abcd 
1234zabcd =

1234r�rrdr�s r9�,test_encode_trailing_space_before_maxlinelenz7TestQuopri.test_encode_trailing_space_before_maxlinelens�����-�)9�a��Hr;c�,�|jddd��y)Nr�zabcd=
=20
1234r�rrdr�s r9�(test_encode_trailing_space_at_maxlinelenz3TestQuopri.test_encode_trailing_space_at_maxlinelen������-�);���Jr;c�,�|jddd��y)Nr�zabc=
d=20
1234r�rrdr�s r9�,test_encode_trailing_space_beyond_maxlinelenz7TestQuopri.test_encode_trailing_space_beyond_maxlinelenr�r;c�(�|jdd�y)Nz
 
 
 
 
 
z=20
=20
=20
=20
=20
rdr�s r9�test_encode_whitespace_linesz'TestQuopri.test_encode_whitespace_liness�����)�[�1r;c�(�|jdd�y)Nza = bza =3D brdr�s r9�test_encode_quoted_equalsz$TestQuopri.test_encode_quoted_equalss�����'�9�-r;c�(�|jdd�y)N�dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxrdr�s r9�test_encode_one_long_stringz&TestQuopri.test_encode_one_long_strings�����)�%@�Ar;c�(�|jdd�y)Nzexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zgxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxx
rdr�s r9�test_encode_one_long_linez$TestQuopri.test_encode_one_long_lines�����*�,N�Or;c�(�|jdd�y)Nz�xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
z�xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
rdr�s r9�test_encode_one_very_long_linez)TestQuopri.test_encode_one_very_long_lines�����*�8�	:r;c�,�|jddd��y)Nz=====z=3D=
=3D=
=3D=
=3D=
=3Dr�rrdr�s r9�test_encode_shortest_maxlinelenz*TestQuopri.test_encode_shortest_maxlinelens�����'�#7�A��Fr;c�L�|jt|jddd��y)Nr+r�r)r�rRrbr�s r9� test_encode_maxlinelen_too_smallz+TestQuopri.test_encode_maxlinelen_too_smalls!�����*�d�&7�&7��R�A��Nr;c�v�|j}|tjd�d�|tjd�d�|tjd�d�|tjdd��d�|tjddd	�
�d�|tjd�d�y)
Nr+r�r�r��dxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx r�rzjxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=
 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=
x xxxx xxxx xxxx xxxx=20r�r�zlxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=
 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=
x xxxx xxxx xxxx xxxx=20zone line

two line)r2r"r�r�s  r9r�zTestQuopri.test_encode!s���
�
�
��
�:�!�!�"�%�r�*�
�:�!�!�'�*�G�4�
�:�!�!�"2�3�^�D�
�:�!�!�,�2�>�A�	�
	�:�!�!�,�2�6�J��	�
	�:�!�!�#�
��	
r;rf)NN)Fr�r�r�r�r�r�r�r�r�r�r�rrrrrrrrrrrr!r$r&r)r.r2r5r8r:r<r?rCrFrIrKrMrOrQrSrVrYr[r]rbrergrirkrmrprrrtrvrxrzr|r~r�r�r�r�r�r�r�r�r�r�r�r�r;r9r�r��sj��6�,L�J�.�26�I�
B�*�E�B�B�&�B�)�3�B�D�K�4�"�(�,�5�2�0�0�8�:�<�D�B�I�6�#�'�6�I�D�4�4�C�F�<�("�*�0�2�>�9�
&�*�2�4�8�5�9�I�K�K�2�.�B�P�:�G�O�
r;r�c�$�eZdZd�Zd�Zd�Zd�Zy)�TestCharsetc�J�ddlm}	|jd=y#t$rYywxYw)NrrM�fake)r�rA�CHARSETSr�)r6�
CharsetModules  r9�tearDownzTestCharset.tearDown>s*��2�	��&�&�v�.���	��	�s�
�	"�"c���|j}td�}||jd�d�d}|jt|j|�td�}||j|�d�y)NrN�Hello World!u¤¢¤¤¤¦¤¨¤ªrVz(=?utf-8?b?wqTCosKkwqTCpMKmwqTCqMKkwqo=?=)r2r
rr�r)r6r7r�r�s    r9�test_codec_encodeablez!TestCharset.test_codec_encodeableEsc��
�
�
���J���
�1�?�?�>�*�N�;�6�����,�����;��G���
�1�?�?�1��I�Jr;c��|j}td�}|d|jd��td�}|d|jd��td�}|d|jd��td	�}d
dlm}|jd|jdd�td�}|d|jd��y)
Nr=z
hello w=F6rlduhello wörldrVr�r�rNr�rrrMr�)r2r
r�r�rA�add_charset�QP)r6r7r�r�s    r9�test_body_encodezTestCharset.test_body_encodePs���
�
�
���L�!��
�?�A�M�M�*:�;�<��G���
�����~�!>�?��J���
�=�!�-�-�
�6�7��H���	3��!�!�&�-�*:�*:�D�'�J��F�O��
�=�!�-�-�
�6�7r;c��td�}|jt|�d�|jtj
td�y)NrNuascÿii)r
r2r�r�r �CharsetErrorr�s  r9�test_unicode_charset_namez%TestCharset.test_unicode_charset_nameos8���*�%������W��z�2����&�-�-�w��Dr;N)r�r�r�r�r�r�r�r�r;r9r�r�=s���	K�8�>Er;r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
TestHeaderc��|j}td�}||j�d�|jd�||j�d�y)Nr�z Goodbye World!zHello World!  Goodbye World!�rrr�r r,s   r9�test_simplezTestHeader.test_simplexsE��
�
"�
"���>�"��
�1�8�8�:�~�&�	���"�#�
�1�8�8�:�5�6r;c��|j}td�}||j�d�|jd�||j�d�y)Nr�zGoodbye World!zHello World! Goodbye World!r�r,s   r9�test_simple_surprisezTestHeader.test_simple_surprisesE��
�
"�
"���>�"��
�1�8�8�:�~�&�	���!�"�
�1�8�8�:�4�5r;c�D�d}|jt|�|dfg�y)Nzno decoding neededr�r7s  r9�test_header_needs_no_decodingz(TestHeader.test_header_needs_no_decoding�s"�� ������q�)�Q��I�;�7r;c��tdd��}|jd��jd�D]}|jt	|�d��y)Na�I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.r�rr,)�
splitcharsz
 )rr�r�r�r�)r6r�ls   r9�	test_longzTestHeader.test_long�sI���L� �
"�����S��)�/�/��6�A�� � ��Q���,�7r;c�,�|j}td�}td�}td�}d}d}d}t||�}|j||�|j||�|j	d��}	||	d	�t|	�}
|t
|
�d
�||
d|df�||
d|df�||
d
|j	d�df�t|�}||djd��tt|	��}|||�y)Nr=rrrVrrrr�ra=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_kom?=
 =?iso-8859-1?q?fortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wand?=
 =?iso-8859-1?q?gem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef=F6r?=
 =?iso-8859-1?q?dert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutily?=
 =?iso-8859-2?q?_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?=
 =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC?=
 =?utf-8?b?5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn?=
 =?utf-8?b?44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFz?=
 =?utf-8?b?IE51bnN0dWNrIGdpdCB1bmQgU2xvdGVybWV5ZXI/IEphISBCZWloZXJodW5k?=
 =?utf-8?b?IGRhcyBPZGVyIGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIA=?=
 =?utf-8?b?44Gj44Gm44GE44G+44GZ44CC?=r�rr|r�s�Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an südlündischen Wandgemälden vorbei, gegen die rotierenden Klingen befördert. Finančni metropole se hroutily pod tlakem jejich důvtipu.. 正確に言うと翻訳はされていません。一部はドイツ語ですが、あとはでたらめです。実際には「Wenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.」と言っています。)
rr
rr r�rr�r�rYr)
r6r7r�r!r"r#r$r%r�encr�ustr�newhs
             r9�test_multilingualzTestHeader.test_multilingual�s&��
�
"�
"���L�!��
�\�
"���w���B��$��0�	�
�6�1���	����"��	����D�!��h�h�"�h�%��
�3�)�	*� ��$��
�3�w�<���
�7�1�:���-�.�
�7�1�:���.�/�
�7�1�:�	�(�(��1�7�;�<��1�v��
�4�
D� �f�W�o�#	�&�=��-�.��
�4��r;c�X�t�}|j|j�d�yr
r6r7s  r9�test_empty_header_encodez#TestHeader.test_empty_header_encode�s���H���������R�(r;c��|j}t�}||d�|jdtd��||d�y)Nr+r�r=)rrr r
r,s   r9�test_header_ctor_default_argsz(TestHeader.test_header_ctor_default_args�s9��
�
"�
"���H��
�1�b�	�	������-�.�
�1�e�r;c�b�|j}d}t|�}||j�d�|t|�|�t|d��}||j�d�|t|�|�t|dd��}||j�|�|t|�|�y)Nz|A very long line that must get split to something other than at the 76th character boundary to test the non-default behaviorz}A very long line that must get split to something other than at the 76th
 character boundary to test the non-default behaviorr�rz}A very long line that must get split to something other than at the
 76th character boundary to test the non-default behaviori)rr)rrr�r�rs    r9�test_explicit_maxlinelenz#TestHeader.test_explicit_maxlinelen�s���
�
"�
"����
�4�L��
�1�8�8�:�8�	9�	�3�q�6�4���4�Y�/��
�1�8�8�:�=�	>�	�3�q�6�4���4�D�i�@��
�1�8�8�:�t��
�3�q�6�4�r;c
��|j}tdd��}d}|j|�|j�}||d�||t	tt
|����tdd��}|jd�|j�}||d�||t	tt
|����y)Nr=r��rArr�a=?iso-8859-1?q?xxx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_x?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?x_?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?xx?=
 =?iso-8859-1?q?_?=r�z�=?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xxx?=
 =?iso-8859-1?q?x_xxxx_xxxx_xxxx_xxxx_?=
 =?iso-8859-1?q?xxxx_xxxx_xxxx_xxxx_xx?=
 =?iso-8859-1?q?xx_xxxx_xxxx_xxxx_xxxx?=
 =?iso-8859-1?q?_xxxx_xxxx_?=�rrr r�r�rr�r6r7rr�r�s     r9�test_quopri_splittablez!TestHeader.test_quopri_splittable�s���
�
"�
"���<�B�7����	�����
�H�H�J��
�1�2�2	�f	�1�c�+�m�A�.�/�0�1��<�B�7��	�����
�H�H�J��
�1�!�	"�	�1�c�+�m�A�.�/�0�1r;c
��|j}tdd��}d}|j|�|j�}||d�||t	tt
|����tdd��}|j|�|j�}||d�||t	tt
|����y)Nrsr�r�r�a�=?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IHh4?=
 =?koi8-r?b?eHgg?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?eCB4?=
 =?koi8-r?b?eHh4?=
 =?koi8-r?b?IA==?=r�z�=?koi8-r?b?eHh4eCB4eHh4IHh4eHggeHh4?=
 =?koi8-r?b?eCB4eHh4IHh4eHggeHh4eCB4?=
 =?koi8-r?b?eHh4IHh4eHggeHh4eCB4eHh4?=
 =?koi8-r?b?IHh4eHggeHh4eCB4eHh4IHh4?=
 =?koi8-r?b?eHggeHh4eCB4eHh4IHh4eHgg?=
 =?koi8-r?b?eHh4eCB4eHh4IA==?=r�r�s     r9�test_base64_splittablez!TestHeader.test_base64_splittable2s���
�
"�
"���8��3����	�����
�H�H�J��
�1�"�"	�F	�1�c�+�m�A�.�/�0�1��8��3��	�����
�H�H�J��
�1�"�	#�	�1�c�+�m�A�.�/�0�1r;c��|j}d}t|�}||dg�t|�}|||j��y)Nr�)r�N�r2rrr�)r6r7r�r�rs     r9�test_us_ascii_headerzTestHeader.test_us_ascii_headerhsB��
�
�
�����!���
�1��� ���N��
�1�a�h�h�j�r;c�f�|j}t�}|jdd�||d�y)Nr�r=)r2rr r,s   r9�test_string_charsetzTestHeader.test_string_charsetps+��
�
�
���H��	����,�'�
�1�g�r;c��|j}tdd�}||j�d�tdd�}||j�d�y)NrHrVz=?utf-8?q?p=C3=B6stal?=u菊地時夫z=?utf-8?b?6I+K5Zyw5pmC5aSr?=�r2rr�r,s   r9�test_utf8_shortestzTestHeader.test_utf8_shortestsH��
�
�
���;��(��
�1�8�8�:�0�1��-�w�7��
�1�8�8�:�5�6r;c�H�|j}|j}d}|tt|�t�}|t|j|�|jdd�}|t
t|d���|�|j	|d��|t
|�|�y)N�0Ynwp4dUEbay Auction Semiar- No Charge � Earn BigrVr�r)r�r2rrr rYr�)r6r@r7r�r�es      r9�test_bad_8bit_headerzTestHeader.test_bad_8bit_header�s����"�"��
�
�
��B���|�V�Q�'��H���|�Q�X�X�q�)�
�H�H�W�i�(��
�3�v�a�	�*�+�Q�/�	����9��%�
�3�q�6�1�
r;c��d}|jdd�}t|tjj��}|jt
|�d�|jtjj|�|dfg�y)Nr�r��surrogateescaperM�2Ynwp4dUEbay Auction Semiar- No Charge � Earn Big�unknown-8bit)	rYrr�rA�UNKNOWN8BITr2r�r�r)r6r�r�rs    r9�test_escaped_8bit_headerz#TestHeader.test_escaped_8bit_header�sm��B��
�H�H�W�/�0���1�e�m�m�7�7�8������Q��O�	Q�������3�3�A�6�!�^�9L�8M�Nr;c���d}t|tjj��}|j	t|�d�|j	tjj|�|dfg�y�Nr�rMr�r�)rr�rAr�r2r�r�r)r6r�rs   r9�&test_header_handles_binary_unknown8bitz1TestHeader.test_header_handles_binary_unknown8bit�s\��B���1�e�m�m�7�7�8������Q��O�	Q�������3�3�A�6�!�^�9L�8M�Nr;c�d�d}t|tjj��}tjjtjj
|��}|jt|�d�|jtjj
|�|dfg�yr�)	rr�rAr�r�rrr2r�)r6r�r�h2s    r9�+test_make_header_handles_binary_unknown8bitz6TestHeader.test_make_header_handles_binary_unknown8bit�s��B���1�e�m�m�7�7�8��
�\�\�
%�
%�e�l�l�&@�&@��&C�
D������R��O�	Q�������3�3�B�7�1�n�:M�9N�Or;c��td�}tjj|�}|j	d�|jt
|�d�y)Nr})r��test2)rr�r�rr r2r�)r6rr�s   r9�0test_modify_returned_list_does_not_change_headerz;TestHeader.test_modify_returned_list_does_not_change_header�s@���6�N�����+�+�A�.���
�
�(�)�����Q���(r;c��|j}t�}|jdd�|jd�|j�}||d�t	t|��}||j�|�y)Nr�r=�worldz=?iso-8859-1?q?hello?= world)r2rr r�rr)r6r7rr�s    r9� test_encoded_adjacent_nonencodedz+TestHeader.test_encoded_adjacent_nonencoded�sc��
�
�
���H��	����,�'�	�����
�H�H�J��
�1�,�-��
�a�(�)��
�1�8�8�:�q�r;c��|j}d}t|�}||gd��t|�}||j�d�y)NzGSubject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.))s	Subject: N)s������� � ��������rs)s zz.Nz6Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.r�)r6r7r��parts�hdrs     r9�test_whitespace_keeperz!TestHeader.test_whitespace_keeper�sK��
�
�
��U���a� ��
�5�Y�	Z��%� ��
�3�:�:�<�C�	Er;c�X�|j}d}|tjt|�y)NzXSubject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3I ?=)r�r r�r)r6r@r�s   r9�test_broken_base64_headerz$TestHeader.test_broken_base64_header�s$���"�"��f���v�&�&�
�q�9r;c�^�tdd��}|j|j�d�y)Nr4�	shift_jisrMr5r6r7s  r9�test_shift_jis_charsetz!TestHeader.test_shift_jis_charset�s%���5�+�.���������%E�Fr;c�d�tjd�}|jt|�d�y)NzEmptyHeader:zEmptyHeader: 

)r�r�r2r�rhs  r9�!test_flatten_header_with_no_valuez,TestHeader.test_flatten_header_with_no_value�s)���'�'��7������S��#6�7r;c�X�t�}d|d<|jt|�d�y)Nz   value with leading ws�
SomeHeaderz&SomeHeader:    value with leading ws

)rr2r�rhs  r9�)test_encode_preserves_leading_ws_on_valuez4TestHeader.test_encode_preserves_leading_ws_on_value�s(���i��6��L������S��#M�Nr;c�V�|jtd�j�d�y)Nr,r�r�s r9�test_whitespace_headerz!TestHeader.test_whitespace_header�s��������+�+�-�s�3r;N)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;r9r�r�ws���7�6�8�-�=�~)���&C2�J42�l��7�
�O�O�P�)��E�:�
G�8�O�
4r;r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z y) �TestRFC2231c��|j}|jd�}||jd�d�||jdd��d�y)Nz
msg_29.txtry�rNrz�%This is even more ***fun*** isn't it!Fr#)rNrzz'"This is even more ***fun*** isn't it!")r2r3rIr5s   r9rzTestRFC2231.test_get_param�sM��
�
�
���l�l�<�(��
�3�=�=��!�G�	I�
�3�=�=��%�=�0�I�	Kr;c�`�|j}t�}|jddd��||jd�d�|jdddd��||jd�d�|j	d	�}|jdddd��||jd
��d�y)
Nryr�rNrM)rNr+r�rz�rA�languager�r�rprta"Return-Path: <bbb@zzz.org>
Delivered-To: bbb@zzz.org
Received: by mail.zzz.org (Postfix, from userid 889)
	id 27CEAD38CC; Fri,  4 May 2001 14:05:44 -0400 (EDT)
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Message-ID: <15090.61304.110929.45684@aaa.zzz.org>
From: bbb@ddd.com (John X. Doe)
To: bbb@zzz.org
Subject: This is a test message
Date: Fri, 4 May 2001 14:05:44 -0400
Content-Type: text/plain; charset=us-ascii;
 title*=us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21


Hi,

Do you like this message?

-Me
)rrr3rIr3r�r5s   r9r4zTestRFC2231.test_set_param�s���
�
"�
"���i���
�
�g�G�(�	�	*�
�3�=�=��!�E�	G��
�
�g�G�(�4�	�	9�
�3�=�=��!�G�	I��l�l�<�(���
�
�g�G�(�4�	�	9�
�3�=�=�b�=�)�,�	r;c�
�t�}|jdd�|j|dd�|jddd��|j|dd�|jdd	d��|j|dd
�y)Nryr�r@ztext/plain; title="foo"rF)�requoteztext/plain; title=barz	(bar)bellztext/plain; title="(bar)bell")rr3r2rhs  r9�test_set_param_requotez"TestRFC2231.test_set_param_requotes}���i���
�
�g�u�%�����^�,�.G�H��
�
�g�u�e�
�4�����^�,�.E�F��
�
�g�{�E�
�:�����^�,�.M�Nr;c���|j}|jd�}|jdddd��|jdddd��|jdd	�
�||j	d��d
�y)Nr�r�rrNrzr�ryr�rDrrprta$Return-Path: <bbb@zzz.org>
Delivered-To: bbb@zzz.org
Received: by mail.zzz.org (Postfix, from userid 889)
	id 27CEAD38CC; Fri,  4 May 2001 14:05:44 -0400 (EDT)
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Message-ID: <15090.61304.110929.45684@aaa.zzz.org>
From: bbb@ddd.com (John X. Doe)
To: bbb@zzz.org
Subject: This is a test message
Date: Fri, 4 May 2001 14:05:44 -0400
Content-Type: text/plain; charset="us-ascii";
 title*=us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21


Hi,

Do you like this message?

-Me
)rr3r3r=r�r5s   r9r?zTestRFC2231.test_del_paramst��
�
"�
"���l�l�<�(���
�
�e�U�J��
�F��
�
�g�G���	�	/��
�
�e�N�
�3�
�3�=�=�b�=�)�,�	r;c�l�|j}|jd�}||j�d�y)NrerN)r2r3�get_content_charsetr5s   r9� test_rfc2231_get_content_charsetz,TestRFC2231.test_rfc2231_get_content_charset9s.��
�
�
���l�l�<�(��
�3�"�"�$�j�1r;c���tjd�}tj|�}|j	|j�d�|j	||j
��y)Nz�            Content-Disposition: inline;
            	filename*0*=''This%20is%20even%20more%20;
            	filename*1*=%2A%2A%2Afun%2A%2A%2A%20;
            	filename*2="is it not.pdf"

            �)This is even more ***fun*** is it not.pdf�r�r�r�r�r2rr�rCs   r9�test_rfc2231_parse_rfc_quotingz*TestRFC2231.test_rfc2231_parse_rfc_quoting?�Z���O�O��
���'�'��*������)�)�+�D�	F�����C�M�M�O�,r;c���tjd�}tj|�}|j	|j�d�|j	||j
��y)Nz�            Content-Disposition: inline;
            	filename*0*="''This%20is%20even%20more%20";
            	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
            	filename*2="is it not.pdf"

            rrrCs   r9� test_rfc2231_parse_extra_quotingz,TestRFC2231.test_rfc2231_parse_extra_quotingMr	r;c��d}tj|�}|jd�}|j|t�|j|d�y)NaContent-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm"
Content-Type: text/html; NAME*0=file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEM; NAME*1=P_nsmail.htm

�NAMEzMfile____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm�r�r�rI�assertNotIsInstance�tupler2�r6r�r8�params    r9�#test_rfc2231_no_language_or_charsetz/TestRFC2231.test_rfc2231_no_language_or_charset]sN��
���'�'��*���
�
�f�%��� � ���.�����[�	]r;c�r�d}tj|�}|j|j�d�y�Nz�Content-Disposition: inline;
	filename*0*="''This%20is%20even%20more%20";
	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2="is it not.pdf"

rrrCs   r9�/test_rfc2231_no_language_or_charset_in_filenamez;TestRFC2231.test_rfc2231_no_language_or_charset_in_filenamel�8��
���'�'��*������)�)�+�D�	Fr;c�r�d}tj|�}|j|j�d�yrrrCs   r9�7test_rfc2231_no_language_or_charset_in_filename_encodedzCTestRFC2231.test_rfc2231_no_language_or_charset_in_filename_encodedyrr;c�r�d}tj|�}|j|j�d�y)Nz�Content-Disposition: inline;
	filename*0="''This%20is%20even%20more%20";
	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2="is it not.pdf"

z1This%20is%20even%20more%20***fun*** is it not.pdfrrCs   r9�test_rfc2231_partly_encodedz'TestRFC2231.test_rfc2231_partly_encoded�s9��
���'�'��*���������?�	Ar;c�r�d}tj|�}|j|j�d�y)Nz�Content-Disposition: inline;
	filename*0="This%20is%20even%20more%20";
	filename*1="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2="is it not.pdf"

z?This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20is it not.pdfrrCs   r9�test_rfc2231_partly_nonencodedz*TestRFC2231.test_rfc2231_partly_nonencoded�s9��
���'�'��*���������M�	Or;c�r�d}tj|�}|j|j�d�y)Nz�Content-Type: multipart/alternative;
	boundary*0*="''This%20is%20even%20more%20";
	boundary*1*="%2A%2A%2Afun%2A%2A%2A%20";
	boundary*2="is it not.pdf"

rr	rCs   r9�/test_rfc2231_no_language_or_charset_in_boundaryz;TestRFC2231.test_rfc2231_no_language_or_charset_in_boundary�rr;c�r�d}tj|�}|j|j�d�y)Nz�Content-Type: text/plain;
	charset*0*="This%20is%20even%20more%20";
	charset*1*="%2A%2A%2Afun%2A%2A%2A%20";
	charset*2="is it not.pdf"

z)this is even more ***fun*** is it not.pdf�r�r�r2rrCs   r9�.test_rfc2231_no_language_or_charset_in_charsetz:TestRFC2231.test_rfc2231_no_language_or_charset_in_charset�s8��
���'�'��*������0�0�2�D�	Fr;c�r�d}tj|�}|j|j�d�y)Nz�Content-Disposition: inline;
	filename*0*="bogus'xx'This%20is%20even%20more%20";
	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2="is it not.pdf"

rrrCs   r9�%test_rfc2231_bad_encoding_in_filenamez1TestRFC2231.test_rfc2231_bad_encoding_in_filename�rr;c�r�d}tj|�}|j|j�d�y)Nz:Content-Type: text/plain; charset*=bogus''utf-8%E2%80%9D

r!rCs   r9�$test_rfc2231_bad_encoding_in_charsetz0TestRFC2231.test_rfc2231_bad_encoding_in_charset��6��
���'�'��*��	
����0�0�2�D�9r;c�r�d}tj|�}|j|j�d�y)Nz:Content-Type: text/plain; charset*=ascii''utf-8%E2%80%9D

r!rCs   r9�%test_rfc2231_bad_character_in_charsetz1TestRFC2231.test_rfc2231_bad_character_in_charset�r'r;c�r�d}tj|�}|j|j�d�y)Nz�Content-Disposition: inline;
	filename*0*="ascii'xx'This%20is%20even%20more%20";
	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2*="is it not.pdf%E2"

u,This is even more ***fun*** is it not.pdf�rrCs   r9�&test_rfc2231_bad_character_in_filenamez2TestRFC2231.test_rfc2231_bad_character_in_filename�s8��
���'�'��*������)�)�+�J�	Lr;c�r�d}tj|�}|j|j�d�y)Nz^Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename*=X-UNKNOWN''myfile.txt

�
myfile.txtrrCs   r9�test_rfc2231_unknown_encodingz)TestRFC2231.test_rfc2231_unknown_encoding��4��
��
�'�'��*������)�)�+�\�:r;c�r�d}tj|�}|j|j�d�y)NucContent-Transfer-Encoding: 8bit
Content-Disposition: inline; filename*=utf-8���''myfile.txt

r-rrCs   r9�&test_rfc2231_bad_character_in_encodingz2TestRFC2231.test_rfc2231_bad_character_in_encoding�r/r;c��|j}d}tj|�}|jd�\}}}||d�||d�||d�y)NzJContent-Type: application/x-foo;
	name*0*="Frank's"; name*1*=" Document"

r �Frank's Documentr�r6r7r�r8rAr�r�s       r9�-test_rfc2231_single_tick_in_filename_extendedz9TestRFC2231.test_rfc2231_single_tick_in_filename_extended�sZ��
�
�
��
��
�'�'��*��"�}�}�V�4����1�
�7�D��
�8�T��
�1� �!r;c��d}tj|�}|jd�}|j|t�|j|d�y)NzGContent-Type: application/x-foo; name*0="Frank's"; name*1=" Document"

r r3rrs    r9�$test_rfc2231_single_tick_in_filenamez0TestRFC2231.test_rfc2231_single_tick_in_filenamesJ��
���'�'��*���
�
�f�%��� � ���.����� 2�3r;c�r�d}tj|�}|j|j�d�y)NzAContent-Disposition: inline;
	filename*0*="'This%20is%20broken";
z'This is brokenrrCs   r9�test_rfc2231_missing_tickz%TestRFC2231.test_rfc2231_missing_ticks8��
���'�'��*����������	r;c�r�d}tj|�}|j|j�d�y)NzAContent-Disposition: inline;
	filename*0*="'This%20is%E2broken";
u'This is�brokenrrCs   r9�0test_rfc2231_missing_tick_with_encoded_non_asciiz<TestRFC2231.test_rfc2231_missing_tick_with_encoded_non_asciis8��
���'�'��*���������"�	$r;c��|j}d}tj|�}|jd�\}}}||d�||d�||d�y)NzYContent-Type: application/x-foo;
	name*0*="us-ascii'en-us'Frank's"; name*1*=" Document"

r rN�en-usr3rr4s       r9�!test_rfc2231_tick_attack_extendedz-TestRFC2231.test_rfc2231_tick_attack_extended&sZ��
�
�
��
��
�'�'��*��"�}�}�V�4����1�
�7�J��
�8�W��
�1� �!r;c��d}tj|�}|jd�}|j|t�|j|d�y)NzWContent-Type: application/x-foo;
	name*0="us-ascii'en-us'Frank's"; name*1=" Document"

r zus-ascii'en-us'Frank's Documentrrs    r9�test_rfc2231_tick_attackz$TestRFC2231.test_rfc2231_tick_attack4sJ��
��
�'�'��*���
�
�f�%��� � ���.����� A�Br;c�z�|j}d}tj|�}||jd�d�y)Nz:Content-Type: application/x-foo; name="Frank's Document"

r r3rr�s    r9�test_rfc2231_no_extended_valuesz+TestRFC2231.test_rfc2231_no_extended_values@s:��
�
�
��
���'�'��*��
�3�=�=�� �"4�5r;c��|j}d}tj|�}|jd�\}}}||d�||d�||d�y)NziContent-Type: application/x-foo;
	name*0*="us-ascii'en-us'My";
	name*1=" Document";
	name*2*=" For You"

r rNr=�My Document For Yourr4s       r9�,test_rfc2231_encoded_then_unencoded_segmentsz8TestRFC2231.test_rfc2231_encoded_then_unencoded_segmentsJ�Z��
�
�
��
���'�'��*��"�}�}�V�4����1�
�7�J��
�8�W��
�1�#�$r;c��|j}d}tj|�}|jd�\}}}||d�||d�||d�y)NziContent-Type: application/x-foo;
	name*0="us-ascii'en-us'My";
	name*1*=" Document";
	name*2*=" For You"

r rNr=rDrr4s       r9�,test_rfc2231_unencoded_then_encoded_segmentsz8TestRFC2231.test_rfc2231_unencoded_then_encoded_segments[rFr;c��ddg}|D]2}|j|��5tj|�}ddd��4y#1swY�?xYw)Nz�From: user@host.com
To: user@host.com
Bad-Header:
 =?us-ascii?Q?LCSwrV11+IB0rSbSker+M9vWR7wEDSuGqmHD89Gt=ea0nJFSaiz4vX3XMJPT4vrE?=
 =?us-ascii?Q?xGUZeOnp0o22pLBB7CYLH74Js=wOlK6Tfru2U47qR?=
 =?us-ascii?Q?72OfyEY2p2=2FrA9xNFyvH+fBTCmazxwzF8nGkK6D?=

Hello!
u�From: ����� �������� <xxx@xxx>
To: "xxx" <xxx@xxx>
Subject:   ��� ���������� ����� ����� � ��������� �� ����
MIME-Version: 1.0
Content-Type: text/plain; charset="windows-1251";
Content-Transfer-Encoding: 8bit

�� ����� � ���� ������ ��� ��������
)r�)r�r�r�)r6�messagesr�r8s    r9�+test_should_not_hang_on_invalid_ew_messagesz7TestRFC2231.test_should_not_hang_on_invalid_ew_messagesjsL������"�A������"��/�/��2��#�"��"�"�s	�=�A	N)!r�r�r�rr4rr?rrrrrrrrrr"r$r&r)r+r.r1r5r7r9r;r>r@rBrErHrKr�r;r9r�r��s���K�#�JO��B2�-�-� ]�
F�
F�A�O�
F�F�
F�:�:�
L�;�;�"�4��$�"�	C�6�
%�"
%�3r;r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestSignedc��t|d��5}|j�}tj|�}ddd�||fS#1swYfSxYwrArB)r6rEr��originalr8s     r9�_msg_and_objzTestSigned._msg_and_obj�sL��
�h��
1�R��w�w�y�H��+�+�H�5�C�2���}��2���}��s�&A�Ac��ddl}|jd|j|jz�}|j	|�jd�}|j	|�jd�}|j
||�y)Nrz^--([^\n]+)\n(.*?)\n--\1$r�)r�r��Sr��search�groupr2)r6rO�resultr��repart�inpart�outparts       r9�_signed_parts_eqzTestSigned._signed_parts_eq�sf�������8�"�$�$����+�F�����x�(�.�.�q�1���-�-��'�-�-�a�0������&�)r;c�p�|jd�\}}|j�}|j||�yrs�rPr�rY�r6rOr8rUs    r9�test_long_headers_as_stringz&TestSigned.test_long_headers_as_string�s1���)�)�,�7�
��#���������h��/r;c�t�|jd�\}}|jd��}|j||�y)Nrt�<rtr[r\s    r9�(test_long_headers_as_string_maxheaderlenz3TestSigned.test_long_headers_as_string_maxheaderlen�s6���)�)�,�7�
��#����B��/�����h��/r;c��|jd�\}}t�}t|�j|�|j	�}|j||�yrs)rPrrr�r�rY)r6rOr8r�rUs     r9�test_long_headers_flattenz$TestSigned.test_long_headers_flatten�sJ���)�)�,�7�
��#�
�Z���"�
���c�"���������h��/r;N)r�r�r�rPrYr]r`rbr�r;r9rMrM�s���*�0�
0�
0r;rMc��eZdZd�Zy)�TestHeaderRegistryc��t�}|dd�}|j|jdtj�y)NrAzattachment; 0*00="foo"r)rr�r�r �InvalidHeaderDefect)r6�regr�s   r9�test_HeaderRegistryz&TestHeaderRegistry.test_HeaderRegistry�s6������%�'?�@�����a�i�i��l�F�,F�,F�Gr;N)r�r�r�rhr�r;r9rdrd�s��Hr;rd�__main__)gr�r1rWr$r��iorr�	itertoolsr�randomr�	threadingr�
unittest.mockr	r��email.policy�email.utils�
email.charsetr
�email.generatorrrr
�email.headerrrr�email.headerregistryr�
email.messager�email.mime.applicationr�email.mime.audior�email.mime.baser�email.mime.imager�email.mime.messager�email.mime.multipartr�email.mime.nonmultipartr�email.mime.textr�email.parserrrrrr r!r"r#r}r$�test.supportr%�test.support.os_helperr&�test.test_emailr'r(r)r�r�rGr.�TestCaser�r
r�r�r�r�rr'r~r�r�r9r?r�r�r�rrFr�r�r�r�r�r�r�r�rMrdr��mainr�r;r9�<module>r�s���

��
��� ��������!�G�G�;�;�/�!�2�&�$�&�*�.�4�$�-��������)�)�3�$�	������r�]�r�l?�8�$�$�?�Fx>�m�x>�zK/�x�(�(�K/�^/D�H�%�%�/D�h7D�H�%�%�7D�vXC�(�+�+�XC�x7A�8�$�$�7A�x~6�M�~6�BkK�
�kK�^}<�-�}<�BsK�m�sK�n		J�}�	J�"Z-�]�Z-�~nH�
�nH�dd(�M�d(�N-A�m�-A�`QK�-�QK�hj�M�j�Z
-�-�$3�%E�$2�3�8�'G�'5�8�1D��"�"�1D�h}
��"�"�}
�D
5E�(�#�#�5E�ta4��a4�La3�-�a3�N
0��0�BH��H��z���H�M�M�O�r;

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists