
    2hh |                    8   S SK r S SKrS SKrS SKrS SKrS SKJrJr  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S SKrS SKrS SKrS SKJr  S SKJrJrJr  S S	KJrJrJr  S S
KJr  S SKJ r   S SK!J"r"  S SK#J$r$  S SK%J&r&  S SK'J(r(  S SK)J*r*  S SK+J,r,  S SK-J.r.  S SK/J0r0  S SK1J2r2J3r3  S SKJ4r4  S SKJ5r5  S SKJ6r6  S SKJ7r7  S SKJ8r8  S SKJ9r9  S SK:J;r;  S SK<J=r=  S SK>J?r?  S SK@JArAJBrB  S SK1JCrC  S rDS!rES"rF " S# S$\B5      rG " S% S&\R                  5      rI " S' S(\B5      rJ " S) S*\R                  5      rK " S+ S,\R                  5      rL " S- S.\R                  5      rM " S/ S0\R                  5      rN " S1 S2\R                  5      rO " S3 S4\B5      rP " S5 S6\B5      rQ " S7 S8\B5      rR " S9 S:\B5      rS " S; S<\B5      rT " S= S>\B5      rU " S? S@\B5      rV " SA SB\B5      rW " SC SD\B5      rX " SE SF\B5      rY " SG SH\B5      rZ " SI SJ5      r[ " SK SL\[\U5      r\ " SM SN\[\U5      r] " SO SP\R                  5      r^ " SQ SR\R                  5      r_ " SS ST\R                  5      r` " SU SV\B5      ra " SW SX\B5      rb " SY SZ\B5      rc " S[ S\\B5      rd\eS]:X  a  \R                  " 5         gg)^    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                   *   \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,S+ r-S, r.S- r/S. r0S/ r1S0 r2S1 r3S2 r4S3 r5S4 r6S5 r7S6 r8S7 r9S8 r:S9 r;S: r<S; r=S< r>S= r?S> r@S? rAS@ rBSA rCSB rDSC rESD rFSE rGSF rHSG rISH rJSI rKSJ rLSK rMSL rNSM rOSN rPSO rQSP rRSQ rSSR rTSS rUST rVSU rWSV rXSW rYSX rZSY r[SZ r\S[r]g\)]TestMessageAPI9   c                     U R                   nU R                  S5      nU" UR                  S5      / SQ5        U" UR                  SS5      S5        g )Nz
msg_20.txtcc)zccc@zzz.orgzddd@zzz.orgzeee@zzz.orgxxzn/a)assertEqual_msgobjget_allselfeqmsgs      C/opt/python-3.13.8/usr/lib/python3.13/test/test_email/test_email.pytest_get_allTestMessageAPI.test_get_all:   sD    ll<(
3;;tKL
3;;tU#U+    c                    U R                   n[        5       nU" UR                  5       S 5        [        S5      nUR	                  U5        U" US   S5        U" UR                  5       S5        U" US   S5        U" UR                  S5      S5        U" US   S	5        U" UR                  5       R                  S5        UR	                  S 5        U" UR                  5       S 5        U" US   S5        [        5       nS
US'   SUS'   SUS'   UR	                  U5        U" US   S
5        U" US   S5        U" US   S5        g )N
iso-8859-1mime-versionz1.0
text/plaincontent-typez text/plain; charset="iso-8859-1"charsetcontent-transfer-encodingquoted-printablez2.0zMIME-Versionztext/x-weirdContent-Typezquinted-puntableContent-Transfer-Encodingz"text/x-weird; charset="iso-8859-1")r3   r   get_charsetr
   set_charsetget_content_type	get_paraminput_charsetr7   r8   r9   rC   s       r:   test_getset_charset"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                     U R                   n[        5       nUR                  S5        U" UR                  5       R                  S5        U" US   S5        g )Nus-asciirB   text/plain; charset="us-ascii")r3   r   rI   rH   rL   r6   s      r:   test_set_charset_from_string+TestMessageAPI.test_set_charset_from_stringZ   sG    i
#
3??**J7
3~ @Ar=   c                     [        5       n[        S5      nUR                  SU5        U R                  UR	                  5       R
                  S5        g )Nr?   zThis is a string payload)r   r
   set_payloadr3   rH   rL   )r7   r9   rC   s      r:   test_set_payload_with_charset,TestMessageAPI.test_set_payload_with_charseta   s?    i,'2G<*88,Gr=   c                     Sn[        S5      n[        5       nUR                  X5        U R                  US   S5        U R                  UR	                  SS9U5        U R                  UR	                  5       S5        g )N   АБВutf-8rD   base64Tdecodez	0JDQkdCS
)r
   r   rV   r3   get_payloadr7   datarC   r9   s       r:   +test_set_payload_with_8bit_data_and_charset:TestMessageAPI.test_set_payload_with_8bit_data_and_charsetg   sl    *'"i&898D5t<*L9r=   c                     Sn[        S5      nS Ul        [        5       nUR                  UR	                  S5      U5        U R                  US   S5        U R                  UR                  SS9U5        g NrZ   r[   rD   8bitTr]   )r
   body_encodingr   rV   r^   r3   r_   r`   s       r:   >test_set_payload_with_non_ascii_and_charset_body_encoding_noneMTestMessageAPI.test_set_payload_with_non_ascii_and_charset_body_encoding_nonep   sh    *'" $iG,g6896B5t<r=   c                     Sn[        S5      nS Ul        [        5       nUR                  X5        U R	                  US   S5        U R	                  UR                  SS9U5        g re   )r
   rg   r   rV   r3   r_   r`   s       r:   >test_set_payload_with_8bit_data_and_charset_body_encoding_noneMTestMessageAPI.test_set_payload_with_8bit_data_and_charset_body_encoding_noney   s]    *'" $i&896B5t<r=   c                 z    [        5       nUR                  / 5        U R                  UR                  5       / 5        g Nr   rV   r3   r_   r7   r9   s     r:   test_set_payload_to_list'TestMessageAPI.test_set_payload_to_list   s,    i*B/r=   c                     [        5       nSUS'   UR                  S5        [        [        5       5      nU R                  [        SUR
                  U5        g )Nmultipart/mixedrF   zstring payloadz[Aa]ttach.*non-multipart)r   rV   r   assertRaisesRegex	TypeErrorattach)r7   r9   sub_msgs      r:   "test_attach_when_payload_is_string1TestMessageAPI.test_attach_when_payload_is_string   sH    i/N()gi(y*D"zz7	4r=   c                 &   U R                   nU R                  S5      nUR                  5       nU" U/ SQ5        U R                  S5      nUR                  S5      nU" U/ SQ5        U R                  S5      nUR                  5       nU" U/ SQ5        g )Nz
msg_08.txt)NrQ   r?   
iso-8859-2koi8-rz
msg_09.txtdingbat)r~   rQ   r?   r~   r}   z
msg_12.txt)NrQ   r?   Nr|   z
iso-8859-3rQ   r}   )r3   r4   get_charsets)r7   r8   r9   charsetss       r:   test_get_charsets TestMessageAPI.test_get_charsets   s    ll<(##%
8MNll<(##I.
8   	! ll<(##%
8 : 	;r=   c                 *   U R                   nU R                  S5      nUR                  5        Vs/ s H  o3R                  5       PM     nnU" USS/5        U R                  S5      nUR                  S5      nU" UR                  5       S5        g s  snf )N
msg_04.txtmsg.txt
msg_07.txt   dingusfish.gifr3   r4   r_   get_filename)r7   r8   r9   p	filenamessubparts         r:   test_get_filename TestMessageAPI.test_get_filename   s    ll<(/2/@A/@!^^%/@	A
9y),-ll<(//!$
7!#34 Bs   Bc                     U R                   nU R                  S5      nUR                  5        Vs/ s H  o3R                  5       PM     nnU" USS/5        g s  snf )Nz
msg_44.txtr   r   )r7   r8   r9   r   r   s        r:   %test_get_filename_with_name_parameter4TestMessageAPI.test_get_filename_with_name_parameter   sR    ll<(/2/@A/@!^^%/@	A
9y),- Bs   Ac                 l    U R                   nU R                  S5      nU" UR                  5       S5        g )Nr   BOUNDARY)r3   r4   get_boundaryr6   s      r:   test_get_boundary TestMessageAPI.test_get_boundary   s.    ll<(
3z*r=   c                    U R                   nU R                  S5      nUR                  S5        UR                  5       S   u  p4U" UR	                  5       S5        U" US5        U R                  S5      nUR                  S5        UR                  5       S   u  p4U" UR	                  5       S5        U" US5        U R                  S5      nU R                  [        R                  UR                  S5        g )	N
msg_01.txtr      rB   z3text/plain; charset="us-ascii"; boundary="BOUNDARY"r   z$multipart/mixed; boundary="BOUNDARY"
msg_03.txt)r3   r4   set_boundaryitemslowerassertRaisesr    HeaderParseError)r7   r8   r9   headervalues        r:   test_set_boundary TestMessageAPI.test_set_boundary   s     ll<($		A
6<<>>*
5GH ll<($		A
6<<>>*
589ll<(&11**J	8r=   c                     [        S5      nU R                  UR                  5       S   S   S5        UR                  5         U R	                  UR                  5       S   S   S5        g )Nz	form-datar   r   zmultipart/form-dataz!multipart/form-data; boundary="==)r   r3   r   	as_stringassertStartsWithrp   s     r:   test_make_boundary!TestMessageAPI.test_make_boundary   sZ    K( 	Q*,ABciik!nQ/A	Cr=   c                 4   [        SSS9 nUR                  5       nS S S 5        [        5       nUR                  W5      n[	        5       n[        USS5      nUR                  US5        U R                  UR                  5       U5        g ! , (       d  f       Ns= f)N
msg_46.txtr[   encodingTr   F)	r'   readr   parsestrr   r   flattenr3   getvaluer7   fpmsgdataparserr9   outgens          r:   test_message_rfc822_only'TestMessageAPI.test_message_rfc822_only   sw     lW5ggiG 6oog&jT1%C1 65s   B		
Bc                    [        SSS9 nUR                  5       R                  S5      nS S S 5        [        R                  R                  5       nUR                  W5      n[        5       n[        R                  R                  U5      nUR                  U5        U R                  UR                  5       U5        g ! , (       d  f       N= f)Nr   r[   r   ascii)r'   r   encodeemailr   BytesHeaderParser
parsebytesr   	generatorr   r   r3   r   r   s          r:   test_byte_message_rfc822_only,TestMessageAPI.test_byte_message_rfc822_only   s    lW5ggi&&w/G 6//1(ioo,,S1C1 65s    B==
Cc                    U R                   nU R                  S5      nU" UR                  SS9S 5        U" UR                  S5      R                  SS9S5        U" UR                  S5      R                  SS9S5        U" UR                  S5      R                  SS9S	5        U" UR                  S
5      R                  SS9S5        U" UR                  S5      R                  SS9S5        g )Nz
msg_10.txtTr]   r   s    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.
)r3   r4   r_   r6   s      r:   test_get_decoded_payload'TestMessageAPI.test_get_decoded_payload   s    ll<(
3??$?'.
3??1)))6/	1 	3??1)))6?	A 	3??1)))6/	1 	3??1)))61	3 	3??1)))6>	@r=   c                     U R                   n[        5       nUR                  S5        S H  nX2S'   U" UR                  SS9S5        M     UR                  S5        U" UR                  SS9S5        g )	Nz$begin 666 -
+:&5L;&\@=V]R;&0 
 
end
z
x-uuencodeuuencodeuuezx-uuerD   Tr]      hello worldfoos   foo)r3   r   rV   r_   )r7   r8   r9   ctes       r:   test_get_decoded_uu_payload*TestMessageAPI.test_get_decoded_uu_payload  sl    iCD=C/2+,sd+^< > 	
3??$?'0r=   c                 Z    [        5       nU R                  [        UR                  S5        g )Nr   )r   r   rv   r_   rp   s     r:   *test_get_payload_n_raises_on_non_multipart9TestMessageAPI.test_get_payload_n_raises_on_non_multipart  s    i)S__a8r=   c                     U R                   nU R                  S5      n[        SSS9 nUR                  5       nS S S 5        [	        5       n[        U5      nUR                  U5        U" UR                  5       W5        g ! , (       d  f       NL= f)Nr   z
msg_17.txtr[   r   )r3   r4   r'   r   r   r   r   r   )r7   r8   r9   r   textsgs          r:   test_decoded_generator%TestMessageAPI.test_decoded_generator  sl    ll<(lW5779D 6JQ			#
1::< 65s   A??
Bc                    [        5       nSUS'   SUS'   U R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        g )	NMeFromYoutofromFROMToTO)r   assertInrp   s     r:   test__contains__TestMessageAPI.test__contains__  so    iFD	fc"fc"fc"dC dC dC r=   c                 ~   U R                  S5      n[        SSS9 nUR                  5       nS S S 5        U R                  W[	        U5      5        UR                  SS9nUR                  S5      nU R                  US   S5        U R                  U[        R                  US	S  5      5        g ! , (       d  f       N= f)
Nr   r[   r   Tunixfromr*   r   zFrom r   )
r4   r'   r   r3   strr   splitr   NLjoin)r7   r9   r   r   fullreprliness         r:   test_as_stringTestMessageAPI.test_as_string+  s    ll<(lW5779D 6s3x(==$=/t$eAh0rwwuQRy12 65s   B..
B<c                     U R                  S5      nUR                  R                  SS9nUR                  US9n[	        5       n[        XBS9nUR                  U5        U R                  X4R                  5       5        g Nr   
lineseppolicy)	r4   r   cloner   r   r   r   r3   r   r7   r9   	newpolicyr   r   r   s         r:   test_as_string_policy$TestMessageAPI.test_as_string_policy5  sg    ll<(JJ$$V$4	==	=2Ja*			#::<0r=   c                     [         R                  " S5      nUR                  S5      n[         R                  " S5      n[        R                  " U5      nU R                  UR                  5       U5        g )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_bytesr3   r   r7   msourceexpectedr9   s        r:   #test_nonascii_as_string_without_cte2TestMessageAPI.test_nonascii_as_string_without_cte>  s`    OO   ,'?? $  &&v.(3r=   c                     [         R                  " S5      nUR                  S5      nUR                  SS5      n[        R
                  " U5      nU R                  UR                  5       U5        g )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   r^   r   r   r3   r   r  s        r:   *test_nonascii_as_string_with_ascii_charset9TestMessageAPI.test_nonascii_as_string_with_ascii_charsetT  s[    OO   ,'==)4&&v.(3r=   c                     [         R                  " S5      nUR                  S5      nUR                  SS5      n[        R
                  " U5      nU R                  UR                  5       U5        g )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        r:   4test_nonascii_as_string_without_content_type_and_cteCTestMessageAPI.test_nonascii_as_string_without_content_type_and_ctec  s[    OO   ,'==)4&&v.(3r=   c                    U R                  S5      n[        SSS9 nUR                  5       R                  S5      nS S S 5        U R	                  W[        U5      5        UR                  SS9nUR                  S5      nU R                  US   S	5        U R	                  USR                  US
S  5      5        g ! , (       d  f       N= f)Nr   r[   r   r   Tr      
r   s   From r   )
r4   r'   r   r   r3   bytesas_bytesr   r   r   )r7   r9   r   ra   r   r   s         r:   test_as_bytesTestMessageAPI.test_as_bytesp  s    ll<(lW5779##G,D 6uSz*<<<.u%eAh1uzz%)45 65s    B99
Cc                     U R                  S5      nUR                  R                  SS9nUR                  US9n[	        5       n[        XBS9nUR                  U5        U R                  X4R                  5       5        g r   )	r4   r   r   r  r   r   r   r3   r   r   s         r:   test_as_bytes_policy#TestMessageAPI.test_as_bytes_policyz  sg    ll<(JJ$$V$4	<<y<1I1.			#::<0r=   c                 r    [         R                  " S5      nU R                  UR                  S5      S5        g )NzContent-Type: blarg; baz; boo
bazr+   r   message_from_stringr3   rK   rp   s     r:   test_bad_paramTestMessageAPI.test_bad_param  s,    ''(IJu-r2r=   c                 t    [         R                  " S5      nUR                  5       nU R                  US5        g )NziContent-Disposition: attachment; filename*="ignored"; filename*0*="utf-8''foo%20"; filename*1*="bar.txt"
zfoo bar.txtr   r  r   r3   r7   r9   filenames      r:   $test_continuation_sorting_part_order3TestMessageAPI.test_continuation_sorting_part_order  s7    ''(
 ##%=1r=   c                 t    [         R                  " S5      nUR                  5       nU R                  US5        g )Nz6Content-Disposition: attachment; filename*="bar.txt"; zbar.txtr  r   s      r:   test_sorting_no_continuations,TestMessageAPI.test_sorting_no_continuations  s7    ''&
 ##%9-r=   c                 p    [         R                  " S5      nU R                  UR                  5       S 5        g Nz
From: foo
r   r  r3   r   rp   s     r:   test_missing_filename$TestMessageAPI.test_missing_filename  +    ''6))+T2r=   c                 p    [         R                  " S5      nU R                  UR                  5       S5        g )Nz%Content-Disposition: blarg; filename
r+   r)  rp   s     r:   test_bogus_filename"TestMessageAPI.test_bogus_filename  s.    ''02))+R0r=   c                 p    [         R                  " S5      nU R                  UR                  5       S 5        g r(  r   r  r3   r   rp   s     r:   test_missing_boundary$TestMessageAPI.test_missing_boundary  r,  r=   c                 ^   U R                   n[        R                  " S5      nU" UR                  SS9/ SQ5        [        R                  " S5      nU" UR                  SS9/ SQ5        U" UR                  5       S 5        [        R                  " S5      nU" UR                  SS9/ SQ5        g )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+   )r9  r8  )r  r:  "X-Header: foo; bar="one"; baz=two
)r3   r   r  
get_paramsr6   s      r:   test_get_paramsTestMessageAPI.test_get_params  s    ''57
3>>>,=	?''/1
3>>>,8	:
3>>T"''13
3>>>,8	:r=   c                 d    [        5       nSUS'   U R                  UR                  S5      S5        g )Nz>Content-Type: Multipart/mixed; boundary = "CPIMSSMTPC06p5f3tG"rF   boundaryCPIMSSMTPC06p5f3tG)r   r3   rK   rp   s     r:   test_get_param_liberal%TestMessageAPI.test_get_param_liberal  s-    i^Nz24HIr=   c                    U R                   n[        R                  " S5      nU" UR                  SSS9S5        U" UR                  SSS9S 5        U" UR                  S5      S 5        [        R                  " S5      nU" UR                  SSS9S	5        U" UR                  SSS9S
5        U" UR                  SSS9S5        g )Nr5  r9  r6  r7  r:  quuzr=  r   r+   r8  r  r3   r   r  rK   r6   s      r:   test_get_paramTestMessageAPI.test_get_param  s    ''57
3==z=2E:
3==
=3T:
3== $'''13
3==z=2B7
3==z=2E:
3==z=2E:r=   c                     U R                  S5      nU R                  UR                  S5      R                  S5      S5        g )Nz
msg_22.txtr   namez
wibble.JPG)r4   r3   r_   rK   rp   s     r:   'test_get_param_funky_continuation_lines6TestMessageAPI.test_get_param_funky_continuation_lines  s4    ll<(+55f=|Lr=   c                     [         R                  " S5      nU R                  UR                  S5      S5        U R                  UR                  SSS9S5        g )Nz4Content-Type: image/pjpeg; name="Jim&amp;&amp;Jill"
rL  zJim&amp;&amp;JillFunquotez"Jim&amp;&amp;Jill"r  rp   s     r:   #test_get_param_with_semis_in_quotes2TestMessageAPI.test_get_param_with_semis_in_quotes  sP    ''CEv.0CDvu=.	0r=   c                     [         R                  " S5      nU R                  UR                  S5      S5        [         R                  " S5      nU R                  UR                  S5      S5        g )Nz5Content-Type: foo; bar*0="baz\"foobar"; bar*1="\"baz"r9  zbaz"foobar"bazr  rp   s     r:   test_get_param_with_quotes)TestMessageAPI.test_get_param_with_quotes  s^    ''EGu-/?@''KMu-/?@r=   c                     [         R                  " S5      nU R                  SU5        U R                  SU5        U R                  SU5        U R                  SU5        g )NzHeader: existsr   r   HEADERheaderx)r   r  r   assertNotInrp   s     r:   test_field_containment%TestMessageAPI.test_field_containment  sM    ''(89h$h$h$C(r=   c                    U R                   n[        5       nUR                  SS5        U" UR                  S5      S5        UR                  SS5        U" UR                  S5      S5        U" UR                  SSS9S5        U" UR	                  5       / SQ5        U" UR	                  SS9/ S	Q5        UR                  SS
SS9  U" UR                  SSS9S
5        g )NrC   iso-2022-jp
importance
high valueFrP  "high value")rA   r+   )rC   r^  )r_  r`  )rb  )rC   z"iso-2022-jp")r_  ra  ziso-9999-xxzX-Jimmyr7  )r3   r   	set_paramrK   r>  r6   s      r:   test_set_paramTestMessageAPI.test_set_param  s    ii/
3==#]3lL1
3==&5
3==u=5~F
3>> < 	= 	3>>%>( +G 	H 	iyA
3==9=5}Er=   c                 B   U R                   nU R                  S5      nU" UR                  5       / SQ5        UR                  S5      nUR	                  S5        U" UR                  5       SS/5        UR                  SU5        U" UR                  5       SSSU4/5        g )N
msg_05.txt)multipart/reportr+   )report-typedelivery-statusrB  %D1690A7AC1.996856090/mail.example.comrj  rh  rl  )r3   r4   r>  rK   	del_paramrc  )r7   r8   r9   old_vals       r:   test_del_paramTestMessageAPI.test_del_param  s    ll<(
3>>C	D --.m$
3>>$AC	D 	mW-
3>>$AG$&	'r=   c                     [        5       nUR                  SSSS9  UR                  SS5        U R                  US   S5        g )NContent-Disposition
attachmentbud.gifr!  r!  content-dispositionr   
add_headerrn  r3   rp   s     r:   test_del_param_on_other_header-TestMessageAPI.test_del_param_on_other_header  sA    i,lYOj"7823\Br=   c                 <    [        5       nUR                  SS5        g )Nr!  rw  )r   rn  rp   s     r:   $test_del_param_on_nonexistent_header3TestMessageAPI.test_del_param_on_nonexistent_header  s    ij"78r=   c                     [        5       nUR                  SSSS9  US   nUR                  SSS9  U R                  US   U5        g )NrF   rA   r[   rC   foobarr7  rx  )r7   r9   existing_headers      r:   test_del_nonexistent_param)TestMessageAPI.test_del_nonexistent_param  sJ    i~|WEn-h~6^,o>r=   c                 "   U R                   n[        5       nU R                  [        UR                  S5        UR	                  S5        U" US   S5        UR                  SS5        U" US   S5        UR	                  S5        U" US   S5        g )	Nr   rA   rB   rC   rQ   rR   z	text/htmlztext/html; charset="us-ascii")r3   r   r   
ValueErrorset_typerc  r6   s      r:   test_set_typeTestMessageAPI.test_set_type  s    i*cllF;\"
3~-i,
3~ @A[!
3~ ?@r=   c                 p    [        5       nSUS'   UR                  SS5        U R                  US   S5        g )NrA   zX-Content-Typeapplication/octet-streamzx-content-type)r   r  r3   rp   s     r:   test_set_type_on_other_header,TestMessageAPI.test_set_type_on_other_header*  s;    i ,/1AB-.0JKr=   c                 X    [        5       nU R                  UR                  5       S5        g )NrA   )r   r3   rJ   rp   s     r:   test_get_content_type_missing,TestMessageAPI.test_get_content_type_missing0  s"    i--/>r=   c                 z    [        5       nUR                  S5        U R                  UR                  5       S5        g )Nmessage/rfc822)r   set_default_typer3   rJ   rp   s     r:   /test_get_content_type_missing_with_default_type>TestMessageAPI.test_get_content_type_missing_with_default_type4  s2    i-.--/1ABr=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )N
msg_30.txtr   r  r4   r3   r_   rJ   rp   s     r:   +test_get_content_type_from_message_implicit:TestMessageAPI.test_get_content_type_from_message_implicit9  5    ll<(+<<>)	+r=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )N
msg_28.txtr   r  r  rp   s     r:   +test_get_content_type_from_message_explicit:TestMessageAPI.test_get_content_type_from_message_explicit>  r  r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   rA   r4   r3   rJ   rp   s     r:   6test_get_content_type_from_message_text_plain_implicitETestMessageAPI.test_get_content_type_from_message_text_plain_implicitC  )    ll<(--/>r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   rA   r  rp   s     r:   6test_get_content_type_from_message_text_plain_explicitETestMessageAPI.test_get_content_type_from_message_text_plain_explicitG  r  r=   c                 X    [        5       nU R                  UR                  5       S5        g )Nr   r   r3   get_content_maintyperp   s     r:   !test_get_content_maintype_missing0TestMessageAPI.test_get_content_maintype_missingK  s"    i113V<r=   c                 z    [        5       nUR                  S5        U R                  UR                  5       S5        g )Nr  message)r   r  r3   r  rp   s     r:   3test_get_content_maintype_missing_with_default_typeBTestMessageAPI.test_get_content_maintype_missing_with_default_typeO  s1    i-.113Y?r=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )Nr  r   r  r4   r3   r_   r  rp   s     r:   /test_get_content_maintype_from_message_implicit>TestMessageAPI.test_get_content_maintype_from_message_implicitT  2    ll<(+@@BINr=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )Nr  r   r  r  rp   s     r:   /test_get_content_maintype_from_message_explicit>TestMessageAPI.test_get_content_maintype_from_message_explicitX  r  r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   r   r4   r3   r  rp   s     r:   :test_get_content_maintype_from_message_text_plain_implicitITestMessageAPI.test_get_content_maintype_from_message_text_plain_implicit\  )    ll<(113V<r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   r   r  rp   s     r:   :test_get_content_maintype_from_message_text_plain_explicitITestMessageAPI.test_get_content_maintype_from_message_text_plain_explicit`  r  r=   c                 X    [        5       nU R                  UR                  5       S5        g )Nplainr   r3   get_content_subtyperp   s     r:    test_get_content_subtype_missing/TestMessageAPI.test_get_content_subtype_missingd  s"    i002G<r=   c                 z    [        5       nUR                  S5        U R                  UR                  5       S5        g )Nr  rfc822)r   r  r3   r  rp   s     r:   2test_get_content_subtype_missing_with_default_typeATestMessageAPI.test_get_content_subtype_missing_with_default_typeh  s1    i-.002H=r=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )Nr  r   r  r4   r3   r_   r  rp   s     r:   .test_get_content_subtype_from_message_implicit=TestMessageAPI.test_get_content_subtype_from_message_implicitm  2    ll<(+??A8Lr=   c                     U R                  S5      nU R                  UR                  S5      R                  5       S5        g )Nr  r   r  r  rp   s     r:   .test_get_content_subtype_from_message_explicit=TestMessageAPI.test_get_content_subtype_from_message_explicitq  r  r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   r  r4   r3   r  rp   s     r:   9test_get_content_subtype_from_message_text_plain_implicitHTestMessageAPI.test_get_content_subtype_from_message_text_plain_implicitu  )    ll<(002G<r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nr   r  r  rp   s     r:   9test_get_content_subtype_from_message_text_plain_explicitHTestMessageAPI.test_get_content_subtype_from_message_text_plain_explicity  r  r=   c                 b    [        5       nSUS'   U R                  UR                  5       S5        g )Nno-slash-in-this-stringrF   r   r  rp   s     r:   test_get_content_maintype_error.TestMessageAPI.test_get_content_maintype_error}  s,    i7N113V<r=   c                 b    [        5       nSUS'   U R                  UR                  5       S5        g )Nr  rF   r  r  rp   s     r:   test_get_content_subtype_error-TestMessageAPI.test_get_content_subtype_error  s,    i7N002G<r=   c                 x   U R                   n[        5       nUR                  SS5        UR                  SS5        UR                  SS5        U" UR                  5       / SQ5        U" UR	                  5       / SQ5        UR                  SS	5        U" UR                  5       / SQ5        U" UR	                  5       / S
Q5        UR                  SS5        UR                  SS5        U" UR                  5       / SQ5        U" UR	                  5       / SQ5        U R                  [        UR
                  SS5        g )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)r3   r   ry  keysvaluesreplace_headerr   KeyErrorr6   s      r:   test_replace_header"TestMessageAPI.test_replace_header  s    iw&x'w(
388:34
3::<018X.
388:34
3::<34w)7M2
388:<=
3::<EF(C$6$6)Lr=   c                    [        5       nU R                  UR                  5       5        UR                  SSSS9  U R	                  UR                  5       S5        UR                  SS5        U R	                  UR                  5       S5        UR                  SS5        U R	                  UR                  5       S5        g )Nrs  rt  z
random.avirv  inlineInlinE)r   assertIsNoneget_content_dispositionry  r3   r  rp   s     r:   test_get_content_disposition+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                     Sn[        5       nSUS'   SUS'   UR                  U5        U R                  UR                  SS9S5        U R	                  UR
                  S	   [        R                  5        g )
NzAwDp0P7//y6LwKEAcPa/6Q=9zaudio/x-midirB   r\   rD   Tr]   s    . pr   )r   rV   r3   r_   assertIsInstancedefectsr    InvalidBase64CharactersDefectr7   xr9   s      r:   test_broken_base64_payload)TestMessageAPI.test_broken_base64_payload  ss    &i,N+3'(57	9 	ckk!n$BB	Dr=   c                     Sn[        5       nSUS'   SUS'   UR                  U5        U R                  UR                  SS9[	        US5      5        g )	Nu   this is a bröken thing to dorA   rB   rf   rD   Tr]   zraw-unicode-escape)r   rV   r3   r_   r  r  s      r:   test_broken_unicode_payload*TestMessageAPI.test_broken_unicode_payload  sW     .i*N+1'(5q"67	9r=   c                     SR                  S5      n[        5       nSUS'   SUS'   Xl        U R                  UR	                  SS9U5        g )	Nu#   this is a quéstionable thing to dor[   text/plain; charset="utf-8"rB   rf   rD   Tr]   )r   r   _payloadr3   r_   r  s      r:   test_questionable_bytes_payload.TestMessageAPI.test_questionable_bytes_payload  sP     288Ai;N+1'(5q9r=   c                 d    [        5       nUR                  SSSS9  U R                  SUS   5        g )Nrs  rt  ru  rv  zattachment; filename="bud.gif"r   ry  r3   rp   s     r:   test_ascii_add_header$TestMessageAPI.test_ascii_add_header  s<    i,l ) 	 	+9%&	(r=   c                 d    [        5       nUR                  SSSS9  U R                  SUS   5        g )Nrs  rt     Fußballer.pptrv  z/attachment; filename*=utf-8''Fu%C3%9Fballer.pptr  rp   s     r:   test_noascii_add_header&TestMessageAPI.test_noascii_add_header  s<    i,l% 	 	'?%&	(r=   c                 d    [        5       nUR                  SSSS9  U R                  SUS   5        g )Nrs  rt  )r?   r+   r  rv  z1attachment; filename*=iso-8859-1''Fu%DFballer.pptr  rp   s     r:   #test_nonascii_add_header_via_triple2TestMessageAPI.test_nonascii_add_header_via_triple  s<    i,l9 	 	;A%&	(r=   c                 d    [        5       nUR                  SSSS9  U R                  SUS   5        g )Nrs  rt  zwindows [filename].pptrv  z-attachment; filename="windows [filename].ppt"r  rp   s     r:   #test_ascii_add_header_with_tspecial2TestMessageAPI.test_ascii_add_header_with_tspecial  s<    i,l- 	 	/;%&	(r=   c                 d    [        5       nUR                  SSSS9  U R                  SUS   5        g )Nrs  rt  u   Fußballer [filename].pptrv  z@attachment; filename*=utf-8''Fu%C3%9Fballer%20%5Bfilename%5D.pptr  rp   s     r:   &test_nonascii_add_header_with_tspecial5TestMessageAPI.test_nonascii_add_header_with_tspecial  s<    i,l0 	 	2N%&	(r=   c                     S HN  n[        5       nSU-  US'   SUS'   UR                  S5        U R                  UR                  SS9S	S
U-  5        MP     g )Nlatin-1r   text/plain; charset=%srB   rE   rD   s   foo=e6=96=87barTr]   	   foo文bar1get_payload returns wrong result with charset %s.ro   r7   rC   r9   s      r:   test_binary_quopri_payload)TestMessageAPI.test_binary_quopri_payload  sb    +G)C":W"DC/AC+,OO./t,%CgMO ,r=   c                     S HN  n[        5       nSU-  US'   SUS'   UR                  S5        U R                  UR                  SS9S	S
U-  5        MP     g )Nr  r  rB   r\   rD   s   Zm9v5paHYmFyTr]   r   r!  ro   r"  s      r:   test_binary_base64_payload)TestMessageAPI.test_binary_base64_payload  sa    +G)C":W"DC/7C+,OOO,t,%CgMO ,r=   c           
          S Hk  nS Hb  n[        5       nSU-  US'   X#S'   UR                  S5        U R                  UR                  SS9S	[	        S
5      R                  X5      5        Md     Mm     g )Nr  r   r  rB   rD   s    begin 666 -
)9F]OYI:'8F%R
 
end
Tr]   r   )z!get_payload returns wrong result z"with charset {0} and encoding {1}.)r   rV   r3   r_   r   format)r7   rC   r   r9   s       r:   test_binary_uuencode_payload+TestMessageAPI.test_binary_uuencode_payload  sz    +GFi&>&HN#3;/0 GH  OO4O0) ? @w13 G ,r=   c                 d    [        5       nUR                  SSS S9  U R                  SUS   5        g )Nrs  r  )foo_barzinline; foo-barr  rp   s     r:   $test_add_header_with_name_only_param3TestMessageAPI.test_add_header_with_name_only_param  s3    i,hE*C0E,FGr=   c                 f    [        5       nUR                  SS 5        U R                  SUS   5        g )NzX-Statusr+   r  rp   s     r:   test_add_header_with_no_value,TestMessageAPI.test_add_header_with_no_value  s+    iz4(S_-r=   c                     [        5       n[        S5      US'   U R                  [        R                  UR
                  5        g Nzdummy
X-Injected-Header: testDummy)r   r   r   r    r   r   rp   s     r:   (test_embedded_header_via_Header_rejected7TestMessageAPI.test_embedded_header_via_Header_rejected  s2    i>?G&113==Ar=   c                 v    [        5       nSUS'   U R                  [        R                  UR                  5        g r4  )r   r   r    r   r   rp   s     r:   (test_embedded_header_via_string_rejected7TestMessageAPI.test_embedded_header_via_string_rejected"  s,    i7G&113==Ar=   c                     [        S5      nSUS'   U R                  [        U5      [        R                  " S5      5        g )Nzabc
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
            r   r3   r   r   r   r7   r  s     r:   -test_unicode_header_defaults_to_utf8_encoding<TestMessageAPI.test_unicode_header_defaults_to_utf8_encoding'  s9    W )Q 1 ! 	r=   c                 x    [        S5      nU R                  [        U5      [        R                  " S5      5        g )Nu   É testabc
z            Content-Type: text/plain; charset="utf-8"
            MIME-Version: 1.0
            Content-Transfer-Encoding: base64

            w4kgdGVzdGFiYwo=
            r=  r>  s     r:   +test_unicode_body_defaults_to_utf8_encoding:TestMessageAPI.test_unicode_body_defaults_to_utf8_encoding4  s0    ^$Q 1 ! 	r=   c                    [         R                  " [        R                  " S5      [         R                  R
                  S9nU R                  UR                  SS9S5        U R                  US   R                  / 5        g )NzP        Content-Transfer-Encoding: base64

        SGVsbG8uIFRlc3Rpbmc=
        r   Tr]      Hello. TestingrD   
r   r  r   r   r   defaultr3   r_   assertDefectsEqualr  rp   s     r:   #test_string_payload_with_base64_cte2TestMessageAPI.test_string_payload_with_base64_cte?  sk    '' 9 ) \\))	+
 	57HI$? @ H H"Mr=    N)^__name__
__module____qualname____firstlineno__r;   rN   rS   rW   rb   rh   rk   rq   ry   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.  r2  r?  rD  rI  rM  rR  rU  r[  rd  rp  rz  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  r  r  r  r  r#  r&  r*  r.  r1  r6  r9  r?  rB  rI  __static_attributes__rK  r=   r:   r.   r.   9   s   ,A4BH:==0
4;"	5.+8,C
2	2@,	19
!314,446132.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
	Nr=   r.   c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
TestEncodersiK  c           
      x   [        SS5       nUR                  5       nS S S 5        [        R                  R                  R                  W5      nUR                  5       nUR                  S5      nU R                  [        U Vs/ s H  n[        U5      PM     sn5      S5        g ! , (       d  f       N= fs  snf )N
python.gifrbr*   L   )r'   r   r   mimeimager   r_   r   assertLessEqualmaxlen)r7   r   bindatamimedbase64edr   r   s          r:   test_EncodersEncode_base64'TestEncoders.test_EncodersEncode_base64M  s    lD)RggiG *

  **73$$&t$S5!:5a3q65!:;R@ *) ";s   B&B7&
B4c                 j    U R                   n[        5       nUR                  S5        U" US   S5        g )NrQ   rD   7bit)r3   r   rI   r6   s      r:   test_encode_empty_payload&TestEncoders.test_encode_empty_payloadV  s0    i
#
3*+V4r=   c                     U R                   n[        S5      nU" US   S5        [        S5      nU" US   S5        [        SSS9nU" US   S5        g )	Nhello worldrD   rb  u   hello ø worldr\   r?   _charsetrE   )r3   r   r6   s      r:   test_default_cteTestEncoders.test_default_cte\  s`    }%
3*+V4)*
3*+X6)LA
3*+-?@r=   c                     U R                   n[        SSS9nU" US   S5        U" UR                  5       [        R                  " S5      5        g )Nu   文
euc-jprg  rD   rb  z            MIME-Version: 1.0
            Content-Type: text/plain; charset="iso-2022-jp"
            Content-Transfer-Encoding: 7bit

            $BJ8(B
            )r3   r   r   r   r   r6   s      r:   test_encode7or8bitTestEncoders.test_encode7or8bith  sK     w2
3*+V4
3==?HOO -  	r=   c                 |    [        SSS5      nU R                  [        U5      [        R                  " S5      5        g )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=  rp   s     r:   test_qp_encode_latin1"TestEncoders.test_qp_encode_latin1w  s4    |V\:S8?? 4 $ 	r=   c                 |    [        SSS5      nU R                  [        U5      [        R                  " S5      5        g )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=  rp   s     r:   test_qp_encode_non_latin1&TestEncoders.test_qp_encode_non_latin1  s4    z6<8S8?? 4 $ 	r=   rK  N)rL  rM  rN  rO  r_  rc  ri  rm  rp  rs  rP  rK  r=   r:   rR  rR  K  s"    A5
A	r=   rR  c                      \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S*r,g)+TestLongHeadersi  Nc                     U R                   n[        R                  " S5      n[        5       n[	        U5      nUR                  U5        U" UR                  5       S5        g )NzSubject: bug demonstration
	12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
	more text

test
)ndiffAssertEqualr   r  r   r   r   r   r7   r8   r9   sfpr   s        r:   test_split_long_continuation,TestLongHeaders.test_split_long_continuation  sT    ""'' )  jcN			#
3<<>  	r=   c                     U R                   nSn[        USS9nU" UR                  5       S5        [        UR                  SS5      5      nU" UR                  5       S5        g )Nzbug demonstration
	12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
	more text	continuation_wsr,   zbug demonstration
 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789
 more text)rx  r   r   r  r7   r8   hstrhs       r:   ,test_another_long_almost_unsplittable_header<TestLongHeaders.test_another_long_almost_unsplittable_header  sc    "" 4.
188:  	 4<<c*+
188:  	r=   c                    U R                   n[        S5      n[        S5      n[        S5      nSnSnSn[        XRSS9nUR                  Xc5        UR                  Xt5        [	        5       n	XS'   [        5       n
[        U
5      nUR                  U	5        U" U
R                  5       S	5        U" UR                  S
S9S5        g )Nr?   r|   r[      Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an sdlndischen Wandgemlden vorbei, gegen die rotierenden Klingen befrdert. ;   Finanni metropole se hroutily pod tlakem jejich dvtipu..    正確に言うと翻訳はされていません。一部はドイツ語ですが、あとはでたらめです。実際には「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?=

rV  
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?=)
rx  r
   r   appendr   r   r   r   r   r   )r7   r8   r   czutf8g_headcz_head	utf8_headr  r9   rz  s              r:   test_long_nonstring#TestLongHeaders.test_long_nonstring  s    ""L!\"w$$0	 6)4		!iIjcN			#
3<<>  	 	188r8" %1 	2r=   c                 ^    U R                   n[        SSS9nU" UR                  5       S5        g )Niwasnipoop; 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"rx  r   r   r7   r8   r  s      r:   test_long_header_encode'TestLongHeaders.test_long_header_encode  s7    "" O:< 	188: > 	?r=   c                 `    U R                   n[        SSSS9nU" UR                  5       S5        g )Nr  r  r~  r  r  r  r  r  s      r:   <test_long_header_encode_with_tab_continuation_is_just_a_hintLTestLongHeaders.test_long_header_encode_with_tab_continuation_is_just_a_hint  s:    "" O:#') 	188: > 	?r=   c                 `    U R                   n[        SSSS9nU" UR                  5       S5        g )Nziwasnipoop; giraffes="very-long-necked-animals";	spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"r  r~  r  zjwasnipoop; giraffes="very-long-necked-animals";
	spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"r  r  s      r:   -test_long_header_encode_with_tab_continuation=TestLongHeaders.test_long_header_encode_with_tab_continuation   s;    "" O:#') 	188: ? 	@r=   c                 \    [        SS5      nU R                  UR                  5       S5        g )N   文rl  =?iso-2022-jp?b?GyRCSjgbKEI=?=r   r3   r   r7   r  s     r:   0test_header_encode_with_different_output_charset@TestLongHeaders.test_header_encode_with_different_output_charset
  s%    5(#%EFr=   c                 ~    [        SR                  S5      S5      nSnU R                  UR                  5       U5        g )Ns6   test-ja Ƥ줿᡼ϻʲԤξǧԤäƤޤrl  z=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKMnE8VCROPjUbKEI=?=
 =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=)r   r^   r3   r   )r7   r  ress      r:   5test_long_header_encode_with_different_output_charsetETestLongHeaders.test_long_header_encode_with_different_output_charset  s?     $ %+F8$4h@7 	S)r=   c                     U R                   n[        S5      nSUS'   [        5       n[        U5      nUR	                  U5        U" UR                  5       S5        g )Nr+   r  r  zContent-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"

)rx  r   r   r   r   r   ry  s        r:   test_header_splitter$TestLongHeaders.test_header_splitter  sY    ""rlH 	'( jcN			#
3<<>  	r=   c                 &   U R                   n[        5       nSUS'   [        R                  S [	        S5       5       5      US'   UR                  S5        [        5       n[        U5      nUR                  U5        U" UR                  5       S5        g )Ntest@dom.ainr   c              3   ,   #    U  H
  nS U-  v   M     g7f)z<%d@dom.ain>NrK  ).0is     r:   	<genexpr>@TestLongHeaders.test_no_semis_header_splitter.<locals>.<genexpr>0  s     &M9a~'99s   
   
ReferencesTestzFrom: 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)
rx  r   SPACEr   rangerV   r   r   r   r   ry  s        r:   test_no_semis_header_splitter-TestLongHeaders.test_no_semis_header_splitter,  sv    ""i$F!JJ&M59&MMLjcN			#
3<<>  		r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )NzSubject: 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_itselfzSubject: 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      r:   "test_last_split_chunk_does_not_fit2TestLongHeaders.test_last_split_chunk_does_not_fit<  5    ""   	188: b 	cr=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )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      r:   >test_splittable_leading_char_followed_by_overlong_unsplittableNTestLongHeaders.test_splittable_leading_char_followed_by_overlong_unsplittableE  r  r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )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      r:   Gtest_multiple_splittable_leading_char_followed_by_overlong_unsplittableWTestLongHeaders.test_multiple_splittable_leading_char_followed_by_overlong_unsplittableN  r  r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )NzTthis_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;r  r  s      r:   1test_trailing_splittable_on_overlong_unsplittableATestLongHeaders.test_trailing_splittable_on_overlong_unsplittableW  s1    "" * +
188: * 	+r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )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      r:   Itest_trailing_splittable_on_overlong_unsplittable_with_leading_splittableYTestLongHeaders.test_trailing_splittable_on_overlong_unsplittable_with_leading_splittable^  s5    "" + , 	188: Z 	[r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )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      r:   5test_long_header_with_multiple_sequential_split_charsETestLongHeaders.test_long_header_with_multiple_sequential_split_charsg  s3    "" F G
188: ) 	*r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )NKthisverylongheaderhas;semicolons;and,commas,butthey;arenotlegal;fold,pointsr  r  s      r:   :test_splitter_split_on_punctuation_only_if_fws_with_headerJTestLongHeaders.test_splitter_split_on_punctuation_only_if_fws_with_headero  s1    "" + ,
188: 2 	3r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )Nzthis 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;zthis 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      r:   Dtest_leading_splittable_in_the_middle_just_before_overlong_last_partTTestLongHeaders.test_leading_splittable_in_the_middle_just_before_overlong_last_partv  s5    "" * + 	188: Y 	Zr=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )NzTthis_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself r  r  s      r:   /test_overlong_last_part_followed_by_split_point?TestLongHeaders.test_overlong_last_part_followed_by_split_point  s1    "" * +
188: = 	>r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )Nzthis_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; zthis_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      r:   @test_multiline_with_overlong_parts_separated_by_two_split_pointsPTestLongHeaders.test_multiline_with_overlong_parts_separated_by_two_split_points  5    "" + , 	188: Z 	[r=   c                 `    U R                   n[        S5      nU" UR                  5       S5        g )Nzthis 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; zthis 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      r:   >test_multiline_with_overlong_last_part_followed_by_split_pointNTestLongHeaders.test_multiline_with_overlong_last_part_followed_by_split_point  r  r=   c                    U R                   n[        5       nSUS'   [        R                  S/S-  5      US'   UR	                  S5        [        5       n[        U5      nUR                  U5        U" UR                  5       S5        g )Nr  r   z<foo@dom.ain>  r  r  r  zFrom: 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	rx  r   r  r   rV   r   r   r   r   ry  s        r:   %test_long_header_with_whitespace_runs5TestLongHeaders.test_long_header_with_whitespace_runs  su    ""i$F!JJ(9':R'?@LjcN			#
3<<>  		r=   c                    U R                   n[        5       nSUS'   [        R                  S/S-  5      S-   US'   UR	                  S5        [        5       n[        U5      nUR                  U5        U" UR                  5       S5        g )	Nr  r   z<foo@dom.ain>r  z; abcr  r  zFrom: 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

Testr  ry  s        r:   'test_long_run_with_semi_header_splitter7TestLongHeaders.test_long_run_with_semi_header_splitter  sy    ""i$F!JJ'82'=>HLjcN			#
3<<>  		r=   c                     U R                   n[        5       nSUS'   SUS'   UR                  S5        [        5       n[	        U5      nUR                  U5        U" UR                  5       S5        g )Nr  r   r  r  r  zrFrom: test@dom.ain
References: 
 thisverylongheaderhas;semicolons;and,commas,butthey;arenotlegal;fold,points

Test)rx  r   rV   r   r   r   r   ry  s        r:   .test_splitter_split_on_punctuation_only_if_fws>TestLongHeaders.test_splitter_split_on_punctuation_only_if_fws  se    ""i$F+LjcN			#
3<<>  		r=   c                     U R                   nSn[        U5      nU" UR                  5       S5        [        S5      nU" UR                  5       S5        g )Nz\References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz]References:
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxPxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr  r  s       r:   test_no_split_long_header)TestLongHeaders.test_no_split_long_header  sQ    ""(4L 	188: U 	V 8
188:ijr=   c                 b    U R                   nSn[        USS9nU" UR                  5       S5        g )NaW  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~  r  a_  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  r  s       r:   "test_splitting_multiple_long_lines2TestLongHeaders.test_splitting_multiple_long_lines  s7    ""
 4.
188: ) 	*r=   c                 f    U R                   nSn[        USSSS9nU" UR                  5       S5        g )Nzfrom 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 -0400N   Receivedr~  )r  r  r  zfrom 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  r  s       r:   &test_splitting_first_line_only_is_long6TestLongHeaders.test_splitting_first_line_only_is_long  sA    ""A
 4BJ#')
188: A 	Br=   c                     U R                   n[        5       n[        SSSS9nUR                  S5        U" UR	                  SS9S5        X2S'   U" UR                  SS	9S
5        U" UR                  SS	9S5        g )NzBritische Regierung gibtr?   r<  r  u-   grünes Licht für Offshore-WindkraftprojekterV  r  zl=?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?=

r   zdSubject: =?iso-8859-1?q?Britische_Regierung_gibt_gr=FCnes_Licht_f=FCr_Offshore-Windkraftprojekte?=

)rx  r   r   r  r   r   )r7   r8   r9   r  s       r:   test_long_8bit_header%TestLongHeaders.test_long_8bit_header  s    ""i-| )+	DE
188r8" %, 	- I
3==b=) , 	
 	3==a=( + 	r=   c                     U R                   n[        5       nSnX2S'   U" UR                  SS9S5        [        5       n[        USS9US'   U" UR                  SS9S5        g )Nuh   Britische Regierung gibt grünes Licht für Offshore-Windkraftprojekte <a-very-long-address@example.com>zReply-Tor  r  zReply-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  )rx  r   r   r   )r7   r8   r9   header_strings       r:    test_long_8bit_header_no_charset0TestLongHeaders.test_long_8bit_header_no_charset  st    ""i= (J
3==b=) , 	
 i -79J
3==b=) , 	r=   c                 h    U R                   nSn[        5       nX#S'   U" UR                  SS9S5        g )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   r  r  zTo: "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>

)rx  r   r   )r7   r8   r   r9   s       r:   test_long_to_header#TestLongHeaders.test_long_to_header-  s>    "";
 iD	
3==b=) , 	r=   c                     U R                   nSn[        U5      nUR                  S5        U" UR                  SS9S5        g )NzIThis is an example of string which has almost the limit of header length.zAdd another line.rV  r  z\This is an example of string which has almost the limit of header length.
 Add another line.rx  r   r  r   r7   r8   r   r  s       r:   test_long_line_after_append+TestLongHeaders.test_long_line_after_append>  sB    ""W1I	$%
188r8" % 	r=   c                     U R                   nSn[        U5      nUR                  S5        U" UR                  5       S5        g )NzThis is a shorter line.z!Add another sentence. (Surprise?)z9This is a shorter line. Add another sentence. (Surprise?)r  r	  s       r:   test_shorter_line_with_append-TestLongHeaders.test_shorter_line_with_appendG  s<    ""%1I	45
188:F	Hr=   c                 f    U R                   nSnSn[        USUS9nU" UR                  SS9S5        g )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?   r  rV  r  a  =?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  )r7   r8   fngsr  s        r:   test_long_field_name$TestLongHeaders.test_long_field_nameO  sE    ""0 2|4
188r8" %A 	Br=   c                 |    Sn[        5       n[        USS9US'   XS'   U R                  UR                  SS9S5        g )	Nzfrom 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 -0700r~  r  
Received-1
Received-2r  r  a1  Received-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

r   r   rx  r   r7   r  r9   s      r:   test_long_received_header)TestLongHeaders.test_long_received_header^  sK    / i"1d;LLcmmm< ? 	r=   c                 ~    Sn[        5       n[        USSS9US'   XS'   U R                  UR                  SS9S5        g )	Nz<15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100")r  r~  r  r  r  r  a#  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      r:   test_string_headerinst_eq)TestLongHeaders.test_string_headerinst_eqp  sP    1 i"1,379LLcmmm< ? 	r=   c                     U R                   n[        5       nSnX2S'   [        USS9US'   SU-   US'   U" UR                  SS9S	5        g )
NziVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzpzFace-1zFace-2r  r,   zFace-3r  r  a  Face-1: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp
Face-2: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp
Face-3: 
 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9
 locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp

rx  r   r   r   )r7   r8   r9   ts       r:   -test_long_unbreakable_lines_with_continuation=TestLongHeaders.test_long_unbreakable_lines_with_continuation  s^    ""iM Hqh7HaH 	3==b=) , 	r=   c                 x    U R                   nSn[        R                  " U5      nU" UR                  SS9S5        g )NzReceived: 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 -0700r  r  zReceived: 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

)rx  r   r  r   r7   r8   r  r9   s       r:   "test_another_long_multiline_header2TestLongHeaders.test_another_long_multiline_header  s@    ""/ ''*
3==b=) , 	r=   c                     U R                   nSn[        5       nX#S'   [        USS9US'   U" UR                  SS9S5        g )NzList-Unsubscribe: <http://lists.sourceforge.net/lists/listinfo/spamassassin-talk>,        <mailto:spamassassin-talk-request@lists.sourceforge.net?subject=unsubscribe>Listr  r  r  a_  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  )r7   r8   r  r9   s       r:   %test_long_lines_with_different_header5TestLongHeaders.test_long_lines_with_different_header  sN    ""% iFQF3F
3==b=) , 	r=   c                     [        [        R                  " S5      SSS9nU R                  UR	                  5       S-   [        R                  " S5      S-   5        g )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 worksr[   r  )rC   r  r*   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?=)r   r   r   r3   r   r  s     r:   *test_long_rfc2047_header_with_embedded_fws:TestLongHeaders.test_long_rfc2047_header_with_embedded_fws  sZ    8?? $, - #%' 	D(// ;7 +8 9=	+= 	>r=   rK  )-rL  rM  rN  rO  maxDiffr{  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
  r  r  r  r  r!  r%  r)  r,  rP  rK  r=   r:   rv  rv    s    G("42l??@G*(	 ccc+[*3	Z>	[	[	"	"	$
k*,B (*"HB$&0&>r=   rv  c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
TestFromManglingi  c                 v    [        5       U l        SU R                  S'   U R                  R                  S5        g )Nzaaa@bbb.orgr   z(From the desk of A.A.A.:
Blah blah blah
)r   r9   rV   r7   s    r:   setUpTestFromMangling.setUp  s0    9(  	r=   c                     [        5       n[        USS9nUR                  U R                  5        U R	                  UR                  5       S5        g )NTmangle_from_z<From: aaa@bbb.org

>From the desk of A.A.A.:
Blah blah blah
r   r   r   r9   r3   r   r7   r   r   s      r:   test_mangled_from"TestFromMangling.test_mangled_from  s@    Jad+			$(( ( 	r=   c                     [        5       n[        USS9nUR                  U R                  5        U R	                  UR                  5       S5        g )NFr6  z;From: aaa@bbb.org

From the desk of A.A.A.:
Blah blah blah
r8  r9  s      r:   test_dont_mangle_from&TestFromMangling.test_dont_mangle_from  s@    Jae,			$(( ( 	r=   c           
      n   [        5       n[        USS9n[        R                  " [        R
                  " S5      5      nUR                  U5        U R                  [        UR                  5       R                  S5       Vs/ s H  nUR                  S5      (       d  M  SPM     sn5      S5        g s  snf )NTr6  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   )r   r   r   r  r   r   r   r3   r[  r   r   
startswith)r7   r   r   r9   r   s        r:   'test_mangle_from_in_preamble_and_epilog8TestFromMangling.test_mangle_from_in_preamble_and_epilog  s    Jad+'' 9 )   	
		#););D)A =)AA%&\\(%;  )A = >?@	B =s   B2B2c                    [         R                  " S5      R                  S5      n[        R                  " US-   5      n[        5       n[        USS9nUR                  U5        U R                  UR                  5       US-   5        g )Nz            Content-Type: text/plain; charset="utf-8"
            MIME-Version: 1.0
            Content-Transfer-Encoding: 8bit
            From: aaa@bbb.org

        r[   s   From Rölli
Tr6  s   >From Rölli
)
r   r   r   r   r   r   r   r   r3   r   )r7   r  r9   br   s        r:    test_mangled_from_with_bad_bytes1TestFromMangling.test_mangled_from_with_bad_bytes  su     "  VG_ 	 &&v0F'FGI140			#v0G'GHr=   c                 z    [         R                  " S5      R                  S5      n[        R                  " U5      ng )Nu               From: aperson@example.com
            Content-Type: multipart/mixed; boundary="1"
            Content-Transfer-Encoding: È
        r[   )r   r   r   r   r   )r7   r  r9   s      r:   $test_multipart_with_bad_bytes_in_cte5TestFromMangling.test_multipart_with_bad_bytes_in_cte  s5     "  VG_	 	
 &&v.r=   )r9   N)rL  rM  rN  rO  r3  r:  r=  rA  rE  rH  rP  rK  r=   r:   r0  r0    s"    		B.I/r=   r0  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestMIMEAudioi  c                     [        SU 3S5       nUR                  5       U l        S S S 5        [        U R                  5      U l        g ! , (       d  f       N)= f)Nzsndhdr.rU  )r'   r   
_audiodatar   _aur7   extr   s      r:   _make_audioTestMIMEAudio._make_audio  s?    uot, ggiDO -T__- -,   A		
Ac                     SSSSS.R                  5        HJ  u  pU R                  U5        Uc  UOUnU R                  U R                  R	                  5       SU 35        ML     g )Nzx-aiffzx-wavbasic)aifcaiffwavauzaudio/)r   rQ  r3   rN  rJ   r7   rP  subtypes      r:   test_guess_minor_type#TestMIMEAudio.test_guess_minor_type   si    	

 %'LC S!$_c'GTXX668F7):LMr=   c                     U R                  S5        U R                  R                  5       nU R                  [        R
                  " [        US5      5      U R                  5        g )NrY  r   )rQ  rN  r_   r3   r\   decodebytesr  rM  r7   payloads     r:   test_encodingTestMIMEAudio.test_encoding+  sK    ((&&(++E'7,CD	*r=   c                     U R                  S5        [        U R                  S5      nU R                  UR	                  5       S5        g )NrY  fishz
audio/fish)rQ  r   rM  r3   rJ   )r7   rY  s     r:   test_checkSetMinor TestMIMEAudio.test_checkSetMinor1  s9    t/,,.=r=   c                 p   U R                  S5        U R                  nU R                  R                  SSSS9  U" U R                  S   S5        U" U R                  R	                  SS9S	S
/5        U" U R                  R                  SSS9S5        / nU" U R                  R                  SSS9S5        U R                  U R                  R                  SUSS9U5        U R                  U R                  R                  SU5      U5        U R                  U R                  R                  SUSS9U5        g )NrY  rs  rt  	sndhdr.aurv  rw  z attachment; filename="sndhdr.au"r7  rt  r+   )r!  ri  r!  r+   r   failobjr   r  )rQ  r3   rN  ry  r>  rK   assertIsr7   r8   missings      r:   test_add_headerTestMIMEAudio.test_add_header6  s8   1<%0 	 	2
488)*-	/
488&;< 9:	<
488j1FG	
488l3HI2Ndhh((7( ) *+2	4 	dhh((7;WEdhh((w08 ) :;B	Dr=   )rN  rM  N)
rL  rM  rN  rO  rQ  r\  rb  rf  rp  rP  rK  r=   r:   rK  rK    s    .
	N*>
Dr=   rK  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestMIMEImageiN  c                     [        SU 3S5       nUR                  5       U l        S S S 5        [        U R                  5      U l        g ! , (       d  f       N)= f)Nzpython.rU  )r'   r   _imgdatar   _imrO  s      r:   _make_imageTestMIMEImage._make_imageO  s?    uot,GGIDM -T]]+ -,rS  c                     S S S SS S S S SSS S S S.R                  5        HJ  u  pU R                  U5        Uc  UOUnU R                  U R                  R	                  5       SU 35        ML     g )Njpegrastrgb)bmpexrgifjpgpbmpgmpngppmrassgitiffwebpxbmzimage/)r   rw  r3   rv  rJ   rZ  s      r:   r\  #TestMIMEImage.test_guess_minor_typeT  s    
 %'LC S!$_c'GTXX668F7):LM#r=   c                     U R                  S5        U R                  R                  5       nU R                  [        R
                  " [        US5      5      U R                  5        g )Nr  r   )rw  rv  r_   r3   r\   r_  r  ru  r`  s     r:   rb  TestMIMEImage.test_encodingh  sK    ((&&(++E'7,CD	(r=   c                     U R                  S5        [        U R                  S5      nU R                  UR	                  5       S5        g )Nr  re  z
image/fish)rw  r   ru  r3   rJ   )r7   ims     r:   rf   TestMIMEImage.test_checkSetMinorn  s9    t}}f-,,.=r=   c                 p   U R                  S5        U R                  nU R                  R                  SSSS9  U" U R                  S   S5        U" U R                  R	                  SS9S	S
/5        U" U R                  R                  SSS9S5        / nU" U R                  R                  SSS9S5        U R                  U R                  R                  SUSS9U5        U R                  U R                  R                  SU5      U5        U R                  U R                  R                  SUSS9U5        g )Nr  rs  rt  r   rv  rw  z%attachment; filename="dingusfish.gif"r7  rj  )r!  r   r!  r+   r   rk  r  )rw  r3   rv  ry  r>  rK   rm  rn  s      r:   rp  TestMIMEImage.test_add_headers  s:   1<%5 	 	7
488)*2	4
488&;< >?	A
488j1FG	
488l3HI2Ndhh((0E ) GHO	Q 	dhh((7;WEdhh((w08 ) :;B	Dr=   )rv  ru  N)
rL  rM  rN  rO  rw  r\  rb  rf  rp  rP  rK  r=   r:   rs  rs  N  s    ,
N((>
Dr=   rs  c                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)TestMIMEApplicationi  c                 x    U R                   n[        S5      nU" UR                  5       S5        U" US   S5        g )N   r  rD   r\   )r3   r   rJ   r6   s      r:   test_headers TestMIMEApplication.test_headers  s<    9:
3!#=>
3*+X6r=   c                     U R                   nSn[        U5      nU" UR                  5       R                  5       S5        U" UR                  SS9U5        g )Nr  z+vv8/f7/Tr]   )r3   r   r_   strip)r7   r8   	bytesdatar9   s       r:   	test_bodyTestMIMEApplication.test_body  sK    /	i(
3??""$j1
3??$?'3r=   c                 P   Sn[        U[        R                  S9nU R                  UR	                  5       S[        U5      -  5        U R                  UR	                  SS9U5        U R                  US   S5        [        5       n[        U5      nUR                  U5        UR                  5       n[        R                  " U5      nU R                  UR	                  5       S[        U5      -  5        U R                  UR	                  SS9U5        U R                  US   S5        g )Nr  _encoder   �Tr]   rG   rf   )r   r   encode_7or8bitr3   r_   r[  r   r   r   r   r   r   r7   r  r9   r   r   wireformmsg2s          r:   $test_binary_body_with_encode_7or8bit8TestMIMEApplication.test_binary_body_with_encode_7or8bit  s    /	i(2I2IJ*Hs9~,EF5yA896BI1			#::<''1*Hs9~,EF)))6	B9:FCr=   c                    Sn[        U[        R                  S9nU R                  UR	                  5       S[        U5      -  5        U R                  UR	                  SS9U5        [        5       n[        U5      nUR                  U5        UR                  5       n[        R                  " U5      nU R                  UR	                  5       S[        U5      -  5        U R                  UR	                  SS9U5        g )Nr  r  r  Tr]   )r   r   encode_noopr3   r_   r[  r   r   r   r   r   r   r  s          r:   !test_binary_body_with_encode_noop5TestMIMEApplication.test_binary_body_with_encode_noop  s     0	i(2F2FG*Hs9~,EF5yAI1			#::<''1*Hs9~,EF)))6	Br=   c                 L   Sn[        U[        R                  S9nU R                  UR	                  SS9U5        [        5       n[        U5      nUR                  U5        UR                  5       n[        R                  " U5      nU R                  UR	                  SS9U5        g )Ns   r  Tr]   )r   r   r  r3   r_   r   r   r   r   r   r   r  s          r:   0test_binary_body_with_unicode_linend_encode_noopDTestMIMEApplication.test_binary_body_with_unicode_linend_encode_noop  s    3	i(2F2FG5yAI1			#::<''1)))6	Br=   c                     Sn[        U[        R                  S9nU R                  UR	                  5       S5        U R                  UR	                  SS9U5        U R                  US   S5        [        5       n[        U5      nUR                  U5        UR                  5       n[        R                  " U5      nU R                  UR	                  5       S5        U R                  UR	                  SS9U5        U R                  US   S5        g )Ns    r  z=FA=FB=FC=FD=FE=FF=20Tr]   rG   rE   )r   r   encode_quoprir3   r_   r   r   r   r   r   r   r  s          r:   #test_binary_body_with_encode_quopri7TestMIMEApplication.test_binary_body_with_encode_quopri  s    0	i(2H2HI*,CD5yA89;MNI1			#::<''1*,CD)))6	B9:<NOr=   c                    Sn[        U[        R                  S9nU R                  UR	                  5       S5        U R                  UR	                  SS9U5        [        5       n[        U5      nUR                  U5        UR                  5       n[        R                  " U5      nU R                  UR	                  5       S5        U R                  UR	                  SS9U5        g )Nr  r  z	+vv8/f7/
Tr]   )r   r   encode_base64r3   r_   r   r   r   r   r   r   r  s          r:   #test_binary_body_with_encode_base647TestMIMEApplication.test_binary_body_with_encode_base64  s    /	i(2H2HI*L95yAI1			#::<''1*L9)))6	Br=   rK  N)rL  rM  rN  rO  r  r  r  r  r  r  r  rP  rK  r=   r:   r  r    s*    74D"C"
CP Cr=   r  c                   n    \ rS rSrS rS rS rS rS rS r	S r
\R                  " S	5      S
 5       rSrg)TestMIMETexti  c                 $    [        S5      U l        g Nhello there)r   _msgr2  s    r:   r3  TestMIMEText.setUp  s    ]+	r=   c                 T   U R                   nU" U R                  R                  5       S5        U" U R                  R                  S5      S5        / nU R	                  U R                  R                  SU5      U5        U R	                  U R                  R                  SUSS9U5        g )NrA   rC   rQ   r  r7  )r3   r  rJ   rK   rm  rn  s      r:   
test_typesTestMIMEText.test_types  s    
499%%'6
499y):6dii))(G<gFdii)))WX)N	r=   c                     U R                  U R                  R                  5       S5        U R                  U R                  R	                  5       5        g r  )r3   r  r_   assertFalseis_multipartr2  s    r:   test_payloadTestMIMEText.test_payload  s:    ..0-@//12r=   c                 J   U R                   n[        SSS9nU" UR                  5       R                  S5        U" US   S5        [	        S5      nS Ul        [        SUS9nU" UR                  5       R                  S5        U" US   S5        U" UR                  5       S5        g )Nr  rQ   rg  rB   rR   r[   r  )r3   r   rH   rL   r
   rg   r_   rM   s       r:   test_charsetTestMIMEText.test_charset  s    }z:
3??**J7
3~ @A'" $}w7
3??**G4
3~ =>
3??m,r=   c                     U R                   n[        SSS9nU" UR                  5       R                  S5        U" US   S5        g )Nr  rQ   rg  rB   rR   )r3   r   rH   rL   r6   s      r:   test_7bit_inputTestMIMEText.test_7bit_input  s@    }z:
3??**J7
3~ @Ar=   c                     U R                   n[        S5      nU" UR                  5       S5        U" US   S5        U R                  SUR	                  5       5        g )Nr  rQ   rB   rR   )r3   r   rH   r   r   r6   s      r:   test_7bit_input_no_charset'TestMIMEText.test_7bit_input_no_charset	  sL    }%
3??j)
3~ @AmS]]_5r=   c                     SnU R                   n[        USS9nU" UR                  5       R                  S5        U" US   S5        U" UR	                  SS9UR                  S5      5        g )N   кирилицаr[   rg  rB   r  Tr]   )r3   r   rH   output_charsetr_   r   )r7   teststrr8   r9   s       r:   test_utf8_inputTestMIMEText.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                 >    SnU R                  [        [        U5        g )Nr  )r   UnicodeEncodeErrorr   )r7   r  s     r:   test_utf8_input_no_charset'TestMIMEText.test_utf8_input_no_charset  s     E,h@r=   )r  N)rL  rM  rN  rO  r3  r  r  r  r  r  r  unittestskipr  rP  rK  r=   r:   r  r    sK    ,3-B6B ]]  AAr=   r  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rSrg)TestMultiparti!  c                 h   [        SS5       nUR                  5       nS S S 5        [        SSSS9n[        WSS9nUR	                  S	S
SS9  [        S5      nUR                  U5        UR                  U5        SUS'   SUS'   SUS'   Sn[        R                  " U5      nUS   S:X  a  [        R                  nO[        R                  nUS:  a  Sn	OSn	SXS-  4-  n
[        R                  " S[        R                  " U5      5      U
-   US'   X0l        X@l        XPl        g ! , (       d  f       GN= f)NrT  rU  	multipartmixedr   rB  r   )rL  rw  rt  rv  z$Hi there,

This is the dingus fish.
zBarry <barry@digicool.com>r   z)Dingus Lovers <cravindogs@cravindogs.com>r   zHere is your dingus fishr<  g4FcpAr   -+z %s%04d$   z%a, %d %b %Y %H:%M:%SDate)r'   r   r   r   ry  r   rw   time	localtimetimezonealtzonestrftimer  rv  _txt)r7   r   ra   	containerrX  intronow	timetupletzsecssigntzoffsets              r:   r3  TestMultipart.setUp"  s6   lD)R779D *['JG	$%56."2 	 	4  
 	8	&E	$9	) NN3'	R=A]]F\\FA:DDrk22 MM#NN3!#+,	& 		C *)s   D""
D1c                    U R                   nU R                  nU R                  nU R                  UR	                  5       5        U" UR                  5       S5        U" [        UR                  5       5      S5        U" [        UR                  S5        UR                  S5      nUR                  S5      nU R                  X@R                  5        U R                  XPR                  5        U" UR                  5       XE/5        U R                  UR	                  5       5        U R                  UR	                  5       5        g )Nrt   r   r   r   )r3   r   r  
assertTruer  rJ   r[  r_   
IndexErrorrm  r  rv  r  )r7   r8   raisesr  m0m1s         r:   test_hierarchyTestMultipart.test_hierarchyF  s    ""II()
1!23
3q}}#z1==!,]]1]]1b))$b((#
1==?RH%*+*+r=   c                 x    Sn[        5       R                  U5      nU R                  XR                  5       5        g )NzContent-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain


--BOUNDARY


--BOUNDARY--
)r   r   rx  r   )r7   r   r9   s      r:   test_empty_multipart_idempotent-TestMultipart.test_empty_multipart_idempotentX  s1     h%dMMO4r=   c                     [        SS5      nSUS'   SUS'   SUS'   UR                  S	5        U R                  UR                  5       S
5        g )Nr  r  	A subjectr<  aperson@dom.ainr   bperson@dom.ainr   r   zContent-Type: multipart/mixed; boundary="BOUNDARY"
MIME-Version: 1.0
Subject: A subject
To: aperson@dom.ain
From: bperson@dom.ain

--BOUNDARY

--BOUNDARY--
)r   r   rx  r   r7   outers     r:   /test_no_parts_in_a_multipart_with_none_epilogue=TestMultipart.test_no_parts_in_a_multipart_with_none_epiloguei  sT    g.&i'd)f:&eoo/ 
2 
	r=   c                     [        SS5      nSUS'   SUS'   SUS'   S	Ul        S	Ul        UR                  S
5        U R	                  UR                  5       S5        g )Nr  r  r  r<  r   r   r  r   r+   r   zContent-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   rx  r   r  s     r:   0test_no_parts_in_a_multipart_with_empty_epilogue>TestMultipart.test_no_parts_in_a_multipart_with_empty_epilogue{  sb    g.&i'd)f:&eoo/ 2 	r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   UR                  S	5        [        S
5      nUR	                  U5        U" UR                  5       S5        g )Nr  r  r  r<  r   r   r  r   r   rf    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--
)rx  r   r   r   rw   r   r7   r8   r  r9   s       r:   test_one_part_in_a_multipart*TestMultipart.test_one_part_in_a_multipart  so    ""g.&i'd)f:&}%S
5??  	r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   S	Ul        [        S
5      nUR	                  U5        UR                  S5        U" UR                  5       S5        g )Nr  r  r  r<  r   r   r  r   r+   rf  r   a  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--
rx  r   r  r   rw   r   r   r  s       r:   1test_seq_parts_in_a_multipart_with_empty_preamble?TestMultipart.test_seq_parts_in_a_multipart_with_empty_preamble  sv    ""g.&i'd)f}%S:&
5??  	r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   S Ul        [        S	5      nUR	                  U5        UR                  S
5        U" UR                  5       S5        g Nr  r  r  r<  r   r   r  r   rf  r   r  r  r  s       r:   0test_seq_parts_in_a_multipart_with_none_preamble>TestMultipart.test_seq_parts_in_a_multipart_with_none_preamble  v    ""g.&i'd)f}%S:&
5??  	r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   S Ul        [        S	5      nUR	                  U5        UR                  S
5        U" UR                  5       S5        g r  rx  r   r  r   rw   r   r   r  s       r:   0test_seq_parts_in_a_multipart_with_none_epilogue>TestMultipart.test_seq_parts_in_a_multipart_with_none_epilogue  r  r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   S	Ul        [        S
5      nUR	                  U5        UR                  S5        U" UR                  5       S5        g )Nr  r  r  r<  r   r   r  r   r+   rf  r   r  r  r  s       r:   1test_seq_parts_in_a_multipart_with_empty_epilogue?TestMultipart.test_seq_parts_in_a_multipart_with_empty_epilogue  sv    ""g.&i'd)f}%S:&
5??  	r=   c                     U R                   n[        SS5      nSUS'   SUS'   SUS'   S	Ul        [        S
5      nUR	                  U5        UR                  S5        U" UR                  5       S5        g )Nr  r  r  r<  r   r   r  r   r*   rf  r   a  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  r  s       r:   .test_seq_parts_in_a_multipart_with_nl_epilogue<TestMultipart.test_seq_parts_in_a_multipart_with_nl_epilogue  sv    ""g.&i'd)f}%S:&
5??  	r=   c                    U R                   nU R                  S5      nU" [        UR                  5       5      S5        UR                  S5      nU" UR	                  5       S5        U" [        UR                  5       5      S5        UR                  5        Hb  nU" UR	                  5       S5        U" [        UR                  5       5      S5        UR                  S5      nU" UR	                  5       S5        Md     g )N
msg_36.txtr   r   zmultipart/alternativezmessage/external-bodyr   rA   )r3   r4   r[  r_   rJ   )r7   r8   r9   msg1r   
subsubparts         r:   test_message_external_body(TestMultipart.test_message_external_body1  s    ll<(
3s !1%q!
4  "$;<
3t!"A&'')Gw'')+BCs7&&()1- ,,Q/Jz**,l;	 *r=   c                 x    U R                  S5      nU R                  [        UR                  5       5      S5        g )Nz
msg_37.txtr   )r4   r3   r[  r_   rp   s     r:   test_double_boundary"TestMultipart.test_double_boundary>  s.     ll<(S__./3r=   c                     U R                   nU R                  S5      n[        5       n[        R                  " X#5        U" UR                  5       S5        g )Nz
msg_38.txtzmultipart/mixed
    multipart/mixed
        multipart/alternative
            text/plain
        text/plain
    text/plain
    text/plain
rx  r4   r   r!   
_structurer   r7   r8   r9   rz  s       r:   )test_nested_inner_contains_outer_boundary7TestMultipart.test_nested_inner_contains_outer_boundaryE  sG    ""
 ll<(jS&
3<<>  	r=   c                     U R                   nU R                  S5      n[        5       n[        R                  " X#5        U" UR                  5       S5        g )Nz
msg_39.txtzmultipart/mixed
    multipart/mixed
        multipart/alternative
        application/octet-stream
        application/octet-stream
    text/plain
r-  r/  s       r:   test_nested_with_same_boundary,TestMultipart.test_nested_with_same_boundaryX  sG    "" ll<(jS&
3<<>  	r=   c                 f    U R                  S5      nU R                  UR                  5       S5        g )Nz
msg_40.txtzMIME-Version: 1.0
Content-Type: text/html; boundary="--961284236552522269"

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

<html></html>

----961284236552522269--
)r4   r3   r   rp   s     r:   test_boundary_in_non_multipart,TestMultipart.test_boundary_in_non_multiparti  s+    ll<( + 	r=   c                     U R                   n[        R                  " S5      nU R                  UR	                  5       5        U" UR                  5       S5        U" [        UR                  5       5      S5        g )NzMIME-Version: 1.0
Content-Type: multipart/mixed; boundary="    XXXX"

--    XXXX
Content-Type: text/plain


--    XXXX
Content-Type: text/plain

--    XXXX--
z    XXXXr   )r3   r   r  r  r  r   r[  r_   r6   s      r:    test_boundary_with_leading_space.TestMultipart.test_boundary_with_leading_spacex  sb    '' )  	((*+
3z*
3s !1%r=   c                     [        5       R                  S5      nU R                  UR                  S5      R                  5       S5        g )NzContent-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==--r   zYXNkZg==)r   r   r3   r_   r>  s     r:   &test_boundary_without_trailing_newline4TestMultipart.test_boundary_without_trailing_newline  s=    H 
# 
$ 	q)557Dr=   c                     [        SS5      nU R                  UR                  [        R                  R                  5        g )Nr  r  )r   rm  r   r   compat32r>  s     r:   test_mimebase_default_policy*TestMultipart.test_mimebase_default_policy  s*    ['*ahh 5 56r=   c                     [        SS[        R                  R                  S9nU R	                  UR                  [        R                  R                  5        g )Nr  r  r   )r   r   r   rG  rm  r>  s     r:   test_mimebase_custom_policy)TestMultipart.test_mimebase_custom_policy  s6    ['%,,2F2FGahh 4 45r=   )rv  r  r  N)rL  rM  rN  rO  r3  r  r  r  r	  r  r  r  r  r  r!  r'  r*  r0  r3  r6  r9  r<  r@  rC  rP  rK  r=   r:   r  r  !  sh    "H,$5"$*286666<4&"&&E76r=   r  c                       \ rS rSrS rS rS r\R                  " S5      r	S r
S rS rS	 rS
 rS rS rS rS rS rS rS rS rSrg)TestNonConformanti  c                     U R                   nU R                  S5      nU" UR                  5       S5        U" UR                  5       S5        U" UR	                  5       S5        g )Nz
msg_14.txtrA   r   r  )r3   r4   rJ   r  r  r6   s      r:   test_parse_missing_minor_type/TestNonConformant.test_parse_missing_minor_type  sT    ll<(
3!<0
3##%v.
3""$g.r=   c                    U R                  S5      nUR                  S5      nU R                  US5        U R                  [	        UR
                  5      S5        U R                  UR
                  S   [        R                  5        g )N
msg_15.txtr   r  r   )	r4   r_   assertHasAttrr3   r[  r  r  r    StartBoundaryNotFoundDefect)r7   r9   inners      r:   test_same_boundary_inner_outer0TestNonConformant.test_same_boundary_inner_outer  sj    ll<("5),U]]+Q/emmA.$@@	Br=   c                 l   U R                  S5      nU R                  UR                  5       [        5        U R	                  [        UR                  5      S5        U R                  UR                  S   [        R                  5        U R                  UR                  S   [        R                  5        g )Nz
msg_25.txtr   r   r   )
r4   r  r_   r   r3   r[  r  r    NoBoundaryInMultipartDefect!MultipartInvariantViolationDefectrp   s     r:   test_multipart_no_boundary,TestNonConformant.test_multipart_no_boundary  s    ll<(coo/5S[[)1-ckk!n$@@	Bckk!n$FF	Hr=   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                     U R                  U R                  R                  S5      5      nU R                  [	        UR
                  5      S5        U R                  UR
                  S   [        R                  5        g )Nz"
Content-Transfer-Encoding: base64r   r   )	_str_msgmultipart_msgr)  r3   r[  r  r  r    -InvalidMultipartContentTransferEncodingDefectrp   s     r:   test_multipart_invalid_cte,TestNonConformant.test_multipart_invalid_cte  sa    mm%%&KLNS[[)1-ckk!n@@	Br=   c                     U R                  U R                  R                  S5      5      nU R                  [	        UR
                  5      S5        g )Nr+   r   rW  rX  r)  r3   r[  r  rp   s     r:   test_multipart_no_cte_no_defect1TestNonConformant.test_multipart_no_cte_no_defect  s:    mmD..55b9:S[[)1-r=   c                     S Ha  nU R                  U R                  R                  SR                  U5      5      5      nU R                  [	        UR
                  5      S5        Mc     g )N)rb  rf   BINaryz
Content-Transfer-Encoding: {}r   r]  r7   r   r9   s      r:   "test_multipart_valid_cte_no_defect4TestNonConformant.test_multipart_valid_cte_no_defect  sY    -C--""))5<<SACDC S-q1	 .r=   c                    U R                   nU R                  n[        5       nSUS'   U" UR                  5       S5        U" UR	                  5       S5        U" UR                  5       S5        US	 SUS'   U" UR                  5       S5        U" UR	                  5       S5        U" UR                  5       S5        [        5       n[        U5      nUR                  U5        U" UR                  5       S5        g )Nr   rF   r  rA   rB   r   zContent-Type: foo

)
r3   rx  r   r  r  rJ   r   r   r   r   )r7   r8   neqr9   r   r   s         r:   test_invalid_content_type+TestNonConformant.test_invalid_content_type  s    ##i$N
3##%v.
3""$g.
3!<0#N
3##%v.
3""$g.
3!<0JaL			#AJJL12r=   c                 l    U R                   nU R                  S5      nU" UR                  5       S5        g )N
msg_31.txtzm--BOUNDARY
Content-Type: text/plain

message 1

--BOUNDARY
Content-Type: text/plain

message 2

--BOUNDARY--
)rx  r4   r_   r6   s      r:   test_no_start_boundary(TestNonConformant.test_no_start_boundary	  s1    ""ll<(
3??  	r=   c                 l    U R                   nU R                  S5      nU" UR                  5       S5        g )Nz
msg_35.txtzFrom: aperson@dom.ain
To: bperson@dom.ain
Subject: here's something interesting

counter to RFC 2822, there's no separating newline here
)rx  r4   r   r6   s      r:   test_no_separating_blank_line/TestNonConformant.test_no_separating_blank_line	  s0    ""ll<(
3==?  	r=   c                 H   U R                  S5      nU R                  US5        U R                  [        UR                  5      S5        U R                  UR                  S   [        R                  5        U R                  UR                  S   [        R                  5        g )Nz
msg_41.txtr  r   r   r   )	r4   rL  r3   r[  r  r  r    rR  rS  rp   s     r:   test_lying_multipart&TestNonConformant.test_lying_multipart	  s}    ll<(3	*S[[)1-ckk!n$@@	Bckk!n$FF	Hr=   c                 
   U R                  S5      nUR                  S5      R                  S5      nU R                  [        UR                  5      S5        U R                  UR                  S   [        R                  5        g )Nz
msg_42.txtr   r   )r4   r_   r3   r[  r  r  r    rM  )r7   r  bads      r:   test_missing_start_boundary-TestNonConformant.test_missing_start_boundary(	  sh    \* "..q1S[[)1-ckk!n$@@	Br=   c                 x   U R                   nSn[        R                  " U5      nU" UR                  5       S/5        U" UR	                  5       S5        U" [        UR                  5      S5        U R                  UR                  [        R                  /5        U" UR                  S   R                  S5        g )Nz Line 1
Subject: test

bodyr<  bodyr   r   z Line 1
)r3   r   r  r  r_   r[  r  rH  r    #FirstHeaderLineIsContinuationDefectliner$  s       r:   &test_first_line_is_continuation_header8TestNonConformant.test_first_line_is_continuation_header8	  s    ,''*
388:	{#
3??f%
3s{{Q"("L"L!M	O
3;;q>,r=   c                     U R                  S5      nU R                  UR                  5       S/5        U R                  UR                  5       S5        U R	                  UR
                  [        R                  /5        g )Nz&Subject: test
not a header
To: abc

b
r<  znot a header
To: abc

b
)rW  r3   r  r_   rH  r  r     MissingHeaderBodySeparatorDefectrp   s     r:   "test_missing_header_body_separator4TestNonConformant.test_missing_header_body_separatorD	  sd    
 mmIJi[1*,JK!'!H!H I	Kr=   c                    Sn[         R                  " [        R                  " SU S35      [         R                  R
                  S9nU R                  UR                  SS9S5        U R                  US   R                  / 5        g )	Nbase64 #        Content-Transfer-Encoding: '

        SGVsbG8uIFRlc3Rpbmc=
        r   Tr]   rE  rD   rF  rb  s      r:   .test_string_payload_with_extra_space_after_cte@TestNonConformant.test_string_payload_with_extra_space_after_cteO	  s    '' =$$'5 )	9 ) \\))	+
 	57HI$? @ H H"Mr=   c                 8   [         R                  " [        R                  " S5      [         R                  R
                  S9nU R                  UR                  SS9S5        US   nU R                  UR                  [         R                  R                  /5        g )NzZ        Content-Transfer-Encoding: base64 some text

        SGVsbG8uIFRlc3Rpbmc=
        r   Tr]   rE  rD   )r   r  r   r   r   rG  r3   r_   rH  r  r    InvalidHeaderDefect)r7   r9   r   s      r:   -test_string_payload_with_extra_text_after_cte?TestNonConformant.test_string_payload_with_extra_text_after_cteZ	  s{    '' 9 ) \\))	+
 	57HI-.ell.N.N-OPr=   c                 4   Sn[         R                  " [        R                  " SU S35      [         R                  R
                  S9nUS   nU R                  X15        U R                  UR                  SS9S5        U R                  UR                  / 5        g )	Nr  r  r  r   rD   Tr]   rE  )
r   r  r   r   r   r?  r3   r_   rH  r  )r7   r   r9   
pasted_ctes       r:   7test_string_payload_with_extra_space_after_cte_compat32ITestNonConformant.test_string_payload_with_extra_space_after_cte_compat32d	  s    '' =$$'5 )	9 ) \\**	,
 45
)57HIR0r=   rK  N)rL  rM  rN  rO  rH  rO  rT  r   r   rX  rZ  r^  rc  rg  rk  rn  rq  ru  r{  r  r  r  r  rP  rK  r=   r:   rF  rF    so    /BH OO % M0B.
23*"	HB 	-	K	NQ
1r=   rF  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rSrg)TestRFC2047is	  c                     U R                   nSn[        U5      nU" U/ SQ5        [        U5      nU" [        U5      S5        U R	                  UR                  SS9S5        g )NzVRe: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz
 foo bar =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=))s   Re: Ns
   rksmrgszmac-iceland)s    baz foo bar Nr  u+   Re: räksmörgås baz foo bar räksmörgåsrV  r  ziRe: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar =?mac-iceland?q?r=8Aksm?=
 =?mac-iceland?q?=9Arg=8Cs?=)r3   r   r   r   rx  r   r7   r8   r   dhr   s        r:   test_rfc2047_multiline"TestRFC2047.test_rfc2047_multilinet	  sj    /1
2 5 	6
 R
3v;D	Ffmmrm: =  	!r=   c                     U R                   nSn[        U5      nU" USS/5        [        [        U5      5      nU" US5        g )Nz0=?ISO-8859-1?Q?Andr=E9?= Pirard <pirard@dom.ain>)s   Andrr?   )s    Pirard <pirard@dom.ain>Nu   André Pirard <pirard@dom.ain>r3   r   r   r   r  s        r:   test_whitespace_keeper_unicode*TestRFC2047.test_whitespace_keeper_unicode	  sJ    >1
2+35 	6[_%
656r=   c                     U R                   nSn[        U5      nU" U/ SQ5        [        [        U5      5      nU" US5        g )NzWThe =?iso-8859-1?b?cXVpY2sgYnJvd24gZm94?= jumped over the =?iso-8859-1?b?bGF6eSBkb2c=?=))s   The N)s   quick brown foxr?   )s    jumped over the N)s   lazy dogr?   z,The quick brown fox jumped over the lazy dogr  )r7   r8   r   r  hus        r:    test_whitespace_keeper_unicode_2,TestRFC2047.test_whitespace_keeper_unicode_2	  sF    e1
2 K 	LR!
2=>r=   c                 F    Sn[        U5      nU R                  U/ SQ5        g )Nz3Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord))s   SmN   r?   )s   rgN   r?   )s   sbordNr   r3   r7   r   r  s      r:   test_rfc2047_missing_whitespace+TestRFC2047.test_rfc2047_missing_whitespace	  s&    A1 0 	1r=   c                 F    Sn[        U5      nU R                  U/ SQ5        g )Nz7Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord))s   Sm Nr  )s    rg Nr  )s    sbordNr  r  s      r:   test_rfc2047_with_whitespace(TestRFC2047.test_rfc2047_with_whitespace	  s&    E1 1 	2r=   c                 h    Sn/ SQnU H&  u  p4[        X-  5      nU R                  XTS4/5        M(     g )Nz=?iso-8859-1?B?%s?=))zdm==   v)zdm=r  )dmr  )zdmk=   vi)dmkr  r?   r  )r7   r   ra   qar  s         r:   test_rfc2047_B_bad_padding&TestRFC2047.test_rfc2047_B_bad_padding	  s>    ! DAqu%BRl"3!45 r=   c                 @    SnU R                  [        U5      S/5        g )Nz=?iso-8859-1?Q?andr=e9=zz?=)s   andr=zzr?   r3   r   r7   r   s     r:   test_rfc2047_Q_invalid_digits)TestRFC2047.test_rfc2047_Q_invalid_digits	  s"    )q)78	:r=   c                 B    SnU R                  [        U5      / SQ5        g )Nz(=?ISO-8859-1?Q?a?=))   (N   ar?      )Nr  r  s     r:   test_rfc2047_rfc2047_1"TestRFC2047.test_rfc2047_rfc2047_1	  s     "q)>	@r=   c                 B    SnU R                  [        U5      / SQ5        g )Nz(=?ISO-8859-1?Q?a?= b))r  r  )s    b)Nr  r  s     r:   test_rfc2047_rfc2047_2"TestRFC2047.test_rfc2047_rfc2047_2	       $q)@	Br=   c                 B    SnU R                  [        U5      / SQ5        g )Nz'(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)r  )s   abr?   r  r  r  s     r:   test_rfc2047_rfc2047_3"TestRFC2047.test_rfc2047_rfc2047_3	  s     5q)?	Ar=   c                 B    SnU R                  [        U5      / SQ5        g )Nz((=?ISO-8859-1?Q?a?=  =?ISO-8859-1?Q?b?=)r  r  r  s     r:   test_rfc2047_rfc2047_4"TestRFC2047.test_rfc2047_rfc2047_4	  s     6q)?	Ar=   c                 B    SnU R                  [        U5      / SQ5        g )Nz,(=?ISO-8859-1?Q?a?=
    =?ISO-8859-1?Q?b?=)r  r  r  s     r:   test_rfc2047_rfc2047_5a#TestRFC2047.test_rfc2047_rfc2047_5a	  s     <q)?	Ar=   c                 B    SnU R                  [        U5      / SQ5        g )Nz+(=?ISO-8859-1?Q?a?=
    =?ISO-8859-1?Q?b?=)r  r  r  s     r:   test_rfc2047_rfc2047_5b#TestRFC2047.test_rfc2047_rfc2047_5b	  s     :q)?	Ar=   c                 B    SnU R                  [        U5      / SQ5        g )Nz(=?ISO-8859-1?Q?a_b?=))r  )s   a br?   r  r  r  s     r:   test_rfc2047_rfc2047_6"TestRFC2047.test_rfc2047_rfc2047_6	  r  r=   c           	         SnU R                  [        U5      / SQ5        U R                  [        [        U5      5      R                  5       UR	                  5       5        U R                  [        [        [        U5      5      5      S5        g )Nz((=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=))r  r  )s    br|   r  z(a b))r3   r   r   r   r   r   r  s     r:   test_rfc2047_rfc2047_7"TestRFC2047.test_rfc2047_rfc2047_7	  sk    6q)	 	]1%56==?K[q)9:;WEr=   c           	      :   SnU R                  [        U5      SS/5        U R                  [        [        U5      5      R                  5       SR	                  UR                  5       5      5        U R                  [        [        [        U5      5      5      S5        g )Nz9=?windows-1252?q?=22M=FCller_T=22?=
 <T.Mueller@xxx.com>)s
   "Mller T"zwindows-1252)s   <T.Mueller@xxx.com>Nr+   u   "Müller T" <T.Mueller@xxx.com>)r3   r   r   r   r   
splitlinesr   r  s     r:   test_multiline_header!TestRFC2047.test_multiline_header	  s    Iq)/+-	. 	]1%56==?0	2[q)9:;:	<r=   c                 @    SnU R                  [        U5      S/5        g )Nheader without encoded words)r  Nr  r  s     r:   test_unencoded_ascii TestRFC2047.test_unencoded_ascii	  s"    *q)34	6r=   c                 @    SnU R                  [        U5      S/5        g )N,   header with unexpected non ASCII caractères)r  Nr  r  s     r:   test_unencoded_utf8TestRFC2047.test_unencoded_utf8	  s#    <q)EF	Hr=   rK  N)rL  rM  rN  rO  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rP  rK  r=   r:   r  r  s	  se    !"7?126:@BAAAABF<6Hr=   r  c                   t    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rSrg)TestMIMEMessagei 
  c                 v    [        SSS9 nUR                  5       U l        S S S 5        g ! , (       d  f       g = f)N
msg_11.txtr[   r   )r'   r   _textr7   r   s     r:   r3  TestMIMEMessage.setUp
  s'    lW5DJ 655s   *
8c                 :    U R                  [        [        S5        g )Nza plain string)r   rv   r   r2  s    r:   test_type_errorTestMIMEMessage.test_type_error
  s    )[2BCr=   c                 4   U R                   nSn[        5       nX#S'   [        U5      nU" UR                  5       S5        UR	                  5       nU R                  U[        5        U" [        U5      S5        US   nU R                  Xc5        U" US   U5        g )NzA sub-messager<  r  r   r   subject)	r3   r   r   rJ   r_   r  listr[  rm  )r7   r8   r  r  rra  r   s          r:   test_valid_argument#TestMIMEMessage.test_valid_argument
  s    !I)N
1!12--/gt,
3w<!*g!
79w'r=   c                     [        5       nSUS'   [        5       nSUS'   [        U5      nU R                  [        R                  UR
                  U5        g )N	subpart 1r<  z	subpart 2)r   r   r   r    MultipartConversionErrorrw   )r7   r%  r  r  s       r:   test_bad_multipart"TestMIMEMessage.test_bad_multipart
  sH    y%Yy%Y&99188TJr=   c                     [        5       nSUS'   UR                  S5        [        U5      nSUS'   [        5       n[	        U5      nUR                  U5        U R                  UR                  5       S5        g )NAn enclosed messager<  !Here is the body of the message.
zThe enclosing messagezContent-Type: message/rfc822
MIME-Version: 1.0
Subject: The enclosing message

Subject: An enclosed message

Here is the body of the message.
)r   rV   r   r   r   r   r3   r   )r7   r  r  r   r   s        r:   test_generateTestMIMEMessage.test_generate
  sg    I,)	:;N.)JaL			! ( 	r=   c                 X   U R                   nU R                  S5      nU" UR                  5       S5        UR                  5       nU R	                  U[
        5        U" [        U5      S5        US   nU R	                  U[        5        U" US   S5        U" UR                  5       S5        g )Nr  r  r   r   r  r  r  )r3   r4   rJ   r_   r  r  r[  r   )r7   r8   r9   ra  submsgs        r:   test_parse_message_rfc822)TestMIMEMessage.test_parse_message_rfc8222
  s    ll<(
3!#34//#gt,
3w<fg.
6)34
6!EFr=   c                    U R                   nU R                  S5      nU" UR                  5       S5        U R                  UR	                  5       5        U" [        UR                  5       5      S5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR                  S5      nU" UR                  5       S5        U" [        UR                  5       5      S	5        UR                  S5      nU R                  U[        5        U" US
   S5        U" UR                  SSS9S5        U" UR                  SSS9S 5        UR                  S5      nU R                  U[        5        U" US   S5        U" UR                  SS9SS/5        U" UR                  SSS9S5        UR                  S	5      nU" UR                  5       S5        UR                  5       nU R                  U[        5        U" [        U5      S5        US   nU R                  U[        5        U" UR                  5       S5        U" US   S5        g )N
msg_16.txtri  r   r   rA   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   zmessage/delivery-statusr   zoriginal-envelope-idz"0GK500B4HD0888@cougar.noc.ucla.edudnszreporting-mtar7  r+   nsdactionfailedzoriginal-recipient)r  r+   )zjangel1@cougar.noc.ucla.edur+   r  zfinal-recipientr  
message-idz(<002001c144a6$8752e060$56104586@oxy.edu>)r3   r4   rJ   r  r  r[  r_   r  r   rK   r>  r  )r7   r8   r9   r   dsn1dsn2ra  r&  s           r:   test_dsnTestMIMEMessage.test_dsn>
  s"   ll<(
3!#56((*+
3s !1%//!$
7##%|4
7  # 	$ //!$
7##%'@A
3w""$%q) ""1%dG,
4&')MN
4>>%>8"=
4>>%>8$?""1%dG,
4>8$
4??"6?7?@	B
4>>(+<>=rB//!$
7##%'78%%'gt,
3w<QZ
j'2
:&&(,7
:l#5	7r=   c                    U R                   n[        SSS9 nUR                  5       nS S S 5        [        5       nSUS'   SUS'   SUS	'   S
Ul        SUl        [        S5      n[        S5      nUR                  SSSS9  UR                  U5        UR                  U5        [        5       n[        U5      nUR                  U5        U" UR                  5       W5        g ! , (       d  f       N= f)N
msg_21.txtr[   r   r   r   r  r   r  r<  MIME messagezEnd of MIME message
r  r  rF   rt   r   r  )rx  r'   r   r   r  r  r   ry  rw   r   r   r   r   )	r7   r8   r   r   r9   r%  r  rz  r   s	            r:   test_epilogueTestMIMEMessage.test_epiloguew
  s    ""lW5779D 6i'F%D	I%.~'8:N

4

4jcN			#
3<<>4 ! 65s   C
C,c                 *   U R                   n[        5       nSUS'   SUS'   SUS'   SUl        SUl        [	        S	5      n[	        S
5      nUR                  SSSS9  UR                  U5        UR                  U5        U" UR                  5       S5        g )Nr   r   r  r   r  r<  r  r+   r  r  rF   rt   r   r  ad  From: 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--
)rx  r   r  r  r   ry  rw   r   )r7   r8   r9   r%  r  s        r:   test_no_nl_preamble#TestMIMEMessage.test_no_nl_preamble
  s    ""i'F%D	I%~'8:N

4

4
3==?  	r=   c                    U R                   n[        SSS9 n[        R                  " U5      nS S S 5        WR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        g ! , (       d  f       GN= f)Nr  r[   r   r   r  r   rA   r3   r'   r   message_from_filer_   get_default_typerJ   r7   r8   r   r9   
container1
container2container1acontainer2as           r:   test_default_type!TestMIMEMessage.test_default_type
     lW5))"-C 6__Q'

:&&(*:;
:&&(*:;__Q'

:&&(*:;
:&&(*:; ,,Q/
;'')<8
;'')<8 ,,Q/
;'')<8
;'')<8 65   D33
Ec                    U R                   n[        SSS9 n[        R                  " U5      nS S S 5        WR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR	                  S5      nU" UR                  5       S5        U" UR                  5       S5        g ! , (       d  f       GN= f)Nr  r[   r   r   r  r   rA   r  r  s           r:   .test_default_type_with_explicit_container_type>TestMIMEMessage.test_default_type_with_explicit_container_type
  r!  r"  c                    U R                   nU R                  n[        SS5      nSUl        [	        S5      n[	        S5      n[        U5      n[        U5      nUR                  U5        UR                  U5        U" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S5        U" UR                  S5      S5        US		 US
	 US		 US
	 U" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S5        U" UR                  S5      S5        g )Ndigestr   r+   
message 1

message 2
r  r   a  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--
rB   r@   aB  Content-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--
)
r3   rx  r   r  r   r   rw   rJ   r  r   )r7   r8   rf  r  	subpart1a	subpart2asubpart1subpart2s           r:   test_default_type_non_parsed,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                     U R                   n[        S5      n[        S5      n[        X#4S9nU" [        UR	                  5       5      S5        U" UR	                  S5      U5        U" UR	                  S5      U5        g )Nr+   )	_subpartsr   r   r   )r3   r   r   r[  r_   )r7   r8   text1text2r9   s        r:   $test_mime_attachments_in_constructor4TestMIMEMessage.test_mime_attachments_in_constructor  sg    un5
3s !1%
3??1u%
3??1u%r=   c                 V    [        5       nU R                  UR                  5       5        g rn   )r   r  r  rp   s     r:   "test_default_multipart_constructor2TestMIMEMessage.test_default_multipart_constructor#  s    o((*+r=   c                 r    [        5       nSUS'   SUS'   U R                  UR                  S5      SS/5        g )Na@b.comr   c@d.comr   )r   r3   r5   rp   s     r:   test_multipart_default_policy-TestMIMEMessage.test_multipart_default_policy'  s9    oD	D	T*Y	,BCr=   c                    [        [        R                  R                  S9nSUS'   U R	                  [
        5       nSUS'   S S S 5        U R                  [        WR                  5      S5        g ! , (       d  f       N4= f)Nr   r:  r   r;  z.There may be at most 1 To headers in a message)	r   r   r   rG  r   r  r3   r   	exception)r7   r9   cms      r:   test_multipart_custom_policy,TestMIMEMessage.test_multipart_custom_policy-  sc    5<<#7#78D	z*b!CI +R\\*I	K +*s   A00
A>)r  N)rL  rM  rN  rO  r3  r  r  r  r  r  r  r  r  r  r$  r.  r4  r7  r<  rA  rP  rK  r=   r:   r  r   
  s[    #D(K(
G77r!(!F9"9"HT&,DKr=   r  c                        \ rS rSrS rS rSrg)TestNonMultiparti7  c                 Z    [        SS5      nU R                  UR                  5       5        g )Nr   r  )r   r  r  rp   s     r:   "test_nonmultipart_is_not_multipart3TestNonMultipart.test_nonmultipart_is_not_multipart8  s%    vw/))+,r=   c                     [        5       nSUS'   [        SS5      nU R                  [        R                  UR
                  U5        g )Nr  r<  r   r  )r   r   r   r    r  rw   )r7   r9   r  s      r:   test_attach_raises_exception-TestNonMultipart.test_attach_raises_exception<  s:    i$IVW-&99188SIr=   rK  N)rL  rM  rN  rO  rF  rI  rP  rK  r=   r:   rD  rD  7  s    -Jr=   rD  c                       \ rS rSrSrS rSS jrS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSrg)TestIdempotentiH  r*   c                     [        USS9 nUR                  5       nS S S 5        [        R                  " W5      nXC4$ ! , (       d  f       N'= fNr[   r   r'   r   r   r  r7   r!  r   ra   r9   s        r:   r4   TestIdempotent._msgobjL  s?    h1R779D 2''-y 21s	   =
Ac                     U R                   n[        5       n[        USS9nUR                  XS9  U" X%R	                  5       5        g )Nr   r  r   )rx  r   r   r   r   )r7   r9   r   r   r8   r   r   s          r:   _idempotentTestIdempotent._idempotentR  s<    ""Jaa(			#	)
4r=   c                    U R                   nU R                  S5      u  p#U" UR                  5       S5        U" UR                  5       S5        U" UR	                  5       S5        U" UR                  5       S   S5        U" UR                  S5      S5        U" UR                  S 5        U" UR                  S 5        U R                  X#5        g )	Nr   rA   r   r  r   )rC   rQ   rC   rQ   )
r3   r4   rJ   r  r  r>  rK   r  r  rS  r7   r8   r9   r   s       r:   test_parse_text_message&TestIdempotent.test_parse_text_messageY  s    LL.	
3!<0
3##%v.
3""$g.
3>>A 78
3==#Z0
3<<
3<<#r=   c                     U R                   nU R                  S5      u  p#U" UR                  5       S5        U" UR                  5       S 5        U" UR	                  S5      S 5        U R                  X#5        g )Nr   rA   rC   )r3   r4   rJ   r>  rK   rS  rV  s       r:   test_parse_untyped_message)TestIdempotent.test_parse_untyped_messagee  sb    LL.	
3!<0
3>>T"
3==#T*#r=   c                 L    U R                  S5      u  pU R                  X5        g )Nr   r4   rS  r7   r9   r   s      r:   test_simple_multipart$TestIdempotent.test_simple_multipartm       LL.	#r=   c                 L    U R                  S5      u  pU R                  X5        g )N
msg_02.txtr]  r^  s      r:   test_MIME_digestTestIdempotent.test_MIME_digestq  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nz
msg_27.txtr]  r^  s      r:   test_long_headerTestIdempotent.test_long_headeru  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nr  r]  r^  s      r:   "test_MIME_digest_with_part_headers1TestIdempotent.test_MIME_digest_with_part_headersy  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )N
msg_06.txtr]  r^  s      r:   test_mixed_with_image$TestIdempotent.test_mixed_with_image}  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nrg  r]  r^  s      r:   test_multipart_report$TestIdempotent.test_multipart_report  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nr  r]  r^  s      r:   r  TestIdempotent.test_dsn  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nr  r]  r^  s      r:   test_preamble_epilogue%TestIdempotent.test_preamble_epilogue  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nz
msg_23.txtr]  r^  s      r:   test_multipart_one_part&TestIdempotent.test_multipart_one_part  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nz
msg_24.txtr]  r^  s      r:   test_multipart_no_parts&TestIdempotent.test_multipart_no_parts  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nrj  r]  r^  s      r:   rk  %TestIdempotent.test_no_start_boundary  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )N
msg_32.txtr]  r^  s      r:   test_rfc2231_charset#TestIdempotent.test_rfc2231_charset  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nz
msg_33.txtr]  r^  s      r:   test_more_rfc2231_parameters+TestIdempotent.test_more_rfc2231_parameters  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nz
msg_34.txtr]  r^  s      r:   %test_text_plain_in_a_multipart_digest4TestIdempotent.test_text_plain_in_a_multipart_digest  ra  r=   c                 L    U R                  S5      u  pU R                  X5        g )Nzmsg_12a.txtr]  r^  s      r:   test_nested_multipart_mixeds+TestIdempotent.test_nested_multipart_mixeds  s     LL/	#r=   c                 L    U R                  S5      u  pU R                  X5        g )Nr$  r]  r^  s      r:   %test_message_external_body_idempotent4TestIdempotent.test_message_external_body_idempotent  ra  r=   c                 J    U R                  S5      u  pU R                  XSS9  g )N
msg_43.txtTr   r]  r^  s      r:   test_message_delivery_status+TestIdempotent.test_message_delivery_status  s%    LL.	T2r=   c                 L    U R                  S5      u  pU R                  X5        g N
msg_45.txtr]  r^  s      r:   test_message_signed_idempotent-TestIdempotent.test_message_signed_idempotent  ra  r=   c                 2   U R                   nU R                  S5      u  p#U" UR                  5       S5        0 nUR                  5        H	  u  pVXdU'   M     U" US   S5        U" US   S5        U" UR                  SU R
                  -   5        U" UR                  U R
                  5        U" [        UR                  5       5      S5        UR                  S	5      nU" UR                  5       S
5        U" UR                  5       SU R
                  -   5        UR                  S5      nU" UR                  5       S
5        U" UR                  5       SU R
                  -   5        UR                  S5      n	U" U	R                  5       S5        U R                  U	[        5        U	R                  5       n
U R                  U
[        5        U" [        U
5      S5        U
S	   nU R                  U[        5        U" UR                  5       SU R
                  -   5        g )Nrg  ri  rj  rk  rB  rm  z$This is a MIME-encapsulated message.r   r   rA   zYadda yadda yaddar   r   r  )r3   r4   rJ   r>  r  r   r  r[  r_   r  r   r  )r7   r8   r9   r   paramspkpvr%  r  msg3ra  msg4s               r:   test_content_type TestIdempotent.test_content_type  s   LL.	
3!#56nn&FB2J '
6- "34
6*FG
3<<?$,,NO
3<<&
3s !1%q!
4  "L1
42T\\ABq!
4  "L1
42T\\ABq!
4  "$45dG,""$gt,
3w<qzdG,
42T\\ABr=   c                    U R                   nU R                  S5      u  p#U" UR                  5       S5        UR                  5       nU R	                  U[
        5        U" [        U5      S5        US   nU R	                  U[        5        U" UR                  5       S5        U R	                  UR                  5       [        5        U" UR                  5       U R                  5        g )Nrm  r  r   r   rA   )
r3   r4   rJ   r_   r  r  r[  r   r   r   )r7   r8   r9   r   ra  r%  s         r:   test_parserTestIdempotent.test_parser  s    LL.	
3!#34 //#gt,
3w<qzdG,
4  "L1d..0#6
4t||,r=   rK  NF)rL  rM  rN  rO  r   r4   rS  rW  rZ  r_  rd  rg  rj  rn  rq  r  rv  ry  r|  rk  r  r  r  r  r  r  r  r  r  rP  rK  r=   r:   rL  rL  H  s    G
$$$$$$$$$$$$$$$$$$3$C>-r=   rL  c                      \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,S+ r-S, r.\/R`                  " 5       \1Rd                  " S-5      S. 5       5       r3S/ r4S0 r5S1 r6S2 r7S3 r8S4 r9S5 r:S6 r;S7 r<S8 r=S9 r>S: r?S; r@S< rAS= rBS>rCg?)@TestMiscellaneousi  c                     [        SSS9 nUR                  5       nS S S 5        [        R                  " W5      n[	        5       n[        USS9nUR                  U5        U R                  X$R                  5       5        g ! , (       d  f       Ni= fNr   r[   r   r   r  	r'   r   r   r  r   r   r   r3   r   r7   r   r   r9   r   r   s         r:   test_message_from_string*TestMiscellaneous.test_message_from_string  sk    lW5779D 6''-J aa(			#zz|, 65s   A??
Bc                 B   [        SSS9 nUR                  5       nUR                  S5        [        R                  " U5      n[        5       n[        USS9nUR                  U5        U R                  X$R                  5       5        S S S 5        g ! , (       d  f       g = fr  )
r'   r   seekr   r  r   r   r   r3   r   r  s         r:   test_message_from_file(TestMiscellaneous.test_message_from_file  st    lW5779DGGAJ))"-C
A !!,AIIcNT::<0 655s   A<B
Bc                    [        SSS9 nUR                  5       nS S S 5         " S S[        5      n[        R                  " WU5      nU R                  XC5        [        SSS9 nUR                  5       nS S S 5        [        R                  " X#5      nUR                  5        H  nU R                  XS5        M     g ! , (       d  f       N= f! , (       d  f       N^= f)Nr   r[   r   c                       \ rS rSrSrg)HTestMiscellaneous.test_message_from_string_with_class.<locals>.MyMessagei  rK  NrL  rM  rN  rO  rP  rK  r=   r:   	MyMessager        r=   r  rc  )r'   r   r   r   r  r  walk)r7   r   r   r  r9   r   s         r:   #test_message_from_string_with_class5TestMiscellaneous.test_message_from_string_with_class  s    lW5779D 6	 	 ''i8c-lW5779D 6''8xxzG!!'5 " 65 65s   B=%C=
C
Cc                 ~    " S S[         5      n[        SSS9 n[        R                  " X!5      nS S S 5        U R	                  WU5        [        SSS9 n[        R                  " X!5      nS S S 5        UR                  5        H  nU R	                  XA5        M     g ! , (       d  f       Nr= f! , (       d  f       NH= f)Nc                       \ rS rSrSrg)FTestMiscellaneous.test_message_from_file_with_class.<locals>.MyMessagei  rK  Nr  rK  r=   r:   r  r    r  r=   r  r   r[   r   rc  )r   r'   r   r  r  r  )r7   r  r   r9   r   s        r:   !test_message_from_file_with_class3TestMiscellaneous.test_message_from_file_with_class  s    	 	 lW5))"8C 6c9-lW5))"8C 6xxzG!!'5 " 65 65s   BB.
B+.
B<c                 h     " S S[         5      nU R                  SU5      nU R                  X!5        g )Nc                   (   ^  \ rS rSrU 4S jrSrU =r$ )STestMiscellaneous.test_custom_message_does_not_require_arguments.<locals>.MyMessagei  c                 "   > [         TU ]  5         g rn   )super__init__)r7   	__class__s    r:   r  \TestMiscellaneous.test_custom_message_does_not_require_arguments.<locals>.MyMessage.__init__   s     "r=   rK  )rL  rM  rN  rO  r  rP  __classcell__)r  s   @r:   r  r    s    # #r=   r  zSubject: test

test)r   rW  r  )r7   r  r9   s      r:   .test_custom_message_does_not_require_arguments@TestMiscellaneous.test_custom_message_does_not_require_arguments  s/    	# 	# mm3Y?c-r=   c                 h    [        S5      nU R                  [        UR                  5      / SQ5        g )Nr   )r   rC   r   r    
feedparserr   r   r!   r  message_from_binary_filer   r  r  rW  r   r"   r#   )
__import__r3   sorted__all__)r7   modules     r:   test__all__TestMiscellaneous.test__all__%  s*    G$/ 2 	r=   c                     [         R                   " 5       nU R                  [        R                  " [        R                  " U5      5      S S [         R
                  " U5      S S 5        g )N   )r  r3   r#   	parsedate
formatdategmtimer7   r  s     r:   test_formatdate!TestMiscellaneous.test_formatdate/  sK    iik)9)9#)>?CS)"1-	/r=   c           	          [         R                   " 5       nU R                  [        R                  " [        R                  " USS95      S S [         R
                  " U5      S S 5        g )NTr  r  )r  r3   r#   r  r  r  r  s     r:   test_formatdate_localtime+TestMiscellaneous.test_formatdate_localtime4  sN    iikOOE,,SDAB2AFNN3#	%r=   c           	      h   [         R                   " 5       nU R                  [        R                  " USS9[         R                  " S[         R
                  " U5      5      5        U R                  [        R                  " USSS9[         R                  " S[         R
                  " U5      5      5        g )NFr  z%a, %d %b %Y %H:%M:%S -0000T)r  usegmtz%a, %d %b %Y %H:%M:%S GMT)r  r3   r#   r  r  r  r  s     r:   test_formatdate_usegmt(TestMiscellaneous.test_formatdate_usegmt:  s    iikSE2MM7S9IJ	L 	SE$?MM5t{{37GH	Jr=   c                    / SQnU He  nU R                  US9   U R                  [        R                  " U5      5        U R                  [        R                  " U5      5        S S S 5        Mg     U R                  [        R                  " S 5      5        U R                  [        R                  " S 5      5        g ! , (       d  f       M  = f)N)	r+   r,   0zA Complete Waste of Timez Wed, 3 Apr 2002 12.34.56.78+0800z17 June , 2022zFriday, -Nov-82 16:14:55 ESTzFriday, Nov--82 16:14:55 ESTzFriday, 19-Nov- 16:14:55 EST)dtstr)subTestr  r#   r  parsedate_tz)r7   invalid_datesr  s      r:   /test_parsedate_returns_None_for_invalid_stringsATestMiscellaneous.test_parsedate_returns_None_for_invalid_stringsD  s    

 #EE*!!%//%"89!!%"4"4U";< +* #
 	%//$/0%,,T23 +*s   AB;;
C
	c                     U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        g )NzWed, 3 Apr 2002 14:58:26 +0800
  r   r      :      r   r   r  p  zWed,3 Apr 2002 14:58:26 +0800zWed 3 Apr 2002 14:58:26 +0800r3   r#   r  r2  s    r:   test_parsedate_compact(TestMiscellaneous.test_parsedate_compactZ  sf    ++,LMB	D 	++,KLB	D 	++,KLB	Dr=   c                     U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        g )N5 Feb 2003 13:47:26 -0800
  r         /   r  r   r   r  透zFebruary 5, 2003 13:47:26 -0800r  r7   r8   s     r:   test_parsedate_no_dayofweek-TestMiscellaneous.test_parsedate_no_dayofweekd  s?    
59:5	7
5?@5	7r=   c                 P    U R                  [        R                  " S5      S5        g )NzWed, 3 Apr 2002 14:58:26+0800r  r  r2  s    r:   .test_parsedate_no_space_before_positive_offset@TestMiscellaneous.test_parsedate_no_space_before_positive_offsetk  s!    ++,KL4	6r=   c                 P    U R                  [        R                  " S5      S5        g )NzWed, 3 Apr 2002 14:58:26-0800)
r  r   r   r  r  r  r   r   r  r  r  r2  s    r:   .test_parsedate_no_space_before_negative_offset@TestMiscellaneous.test_parsedate_no_space_before_negative_offseto  s!    ++,KL5	7r=   c                     U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        g )Nz5 Feb 2003 13.47.26 -0800r  z5 Feb 2003 13.47 -0800)
r  r   r  r  r  r   r   r   r  r  r  r  s     r:   %test_parsedate_accepts_time_with_dots7TestMiscellaneous.test_parsedate_accepts_time_with_dotst  s?    
59:5	7
5674	6r=   c                 P    U R                  [        R                  " S5      S5        g )NzFriday, 19-Nov-82 16:14:55 EST)
i           r  7   r   r   r  ir  r2  s    r:   test_parsedate_rfc_850(TestMiscellaneous.test_parsedate_rfc_850{  s!    ++,LM7	9r=   c                 P    U R                  [        R                  " S5      S5        g )NzWed, 3 Apr 2002 14:58 +0800
r  r   r   r  r  r   r   r   r  r  r  r2  s    r:   test_parsedate_no_seconds+TestMiscellaneous.test_parsedate_no_seconds  s"    ++,IJA	Cr=   c                     U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        g )NzWed, 3 Apr 2002 14.58.26 +0800r  zWed, 3 Apr 2002 14.58 +0800r  r  r2  s    r:   !test_parsedate_dot_time_delimiter3TestMiscellaneous.test_parsedate_dot_time_delimiter  sB    ++,LMB	D++,IJA	Cr=   c           
      $   U R                   n[        R                  " S5      n[        [        R
                  " U5      5      nU" [        R                  " U5      S S US S 5        U" [        [        R                  " SU5      5      S5        [        R                  " S5      n[        [        R
                  " US S 5      5      nU" [        R                  " U5      S S US S 5        U" [        [        R                  " SUS S 5      5      S5        g )Nr  r  z%Yr  	   )	r3   r#   r  intr  mktimer  r  r  )r7   r8   timetupr   s       r:   +test_parsedate_acceptable_to_time_functions=TestMiscellaneous.test_parsedate_acceptable_to_time_functions  s    //"=>G$%
4>>!Ra '"1+.
3t}}T7+,d3$$%@AGBQK()
4>>!Ra '"1+.
3t}}T72A;/0$7r=   c                     U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        g )N)
  r   r   r   r   r   r  r  r  r   r   )
r  r   r   r   r   r   r  r  r  i  i.)r3   r#   	mktime_tzr2  s    r:   test_mktime_tz TestMiscellaneous.test_mktime_tz  sE     *9 :;<	> *< =>C	Er=   c                     U R                  [        R                  " S5      [        R                  " S5      5        U R                  [        R                  " S5      [        R                  " S5      5        g)zTest 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.

z25 Feb 03 13:47:26 -0800z25 Feb 2003 13:47:26 -0800z25 Feb 71 13:47:26 -0800z25 Feb 1971 13:47:26 -0800Nr  r2  s    r:   test_parsedate_y2k$TestMiscellaneous.test_parsedate_y2k  s\     	++,FG++,HI	K++,FG++,HI	Kr=   c                     U R                  [        R                  " S5      S5        U R                  [        R                  " [        R                  " S5      5      S5        g )Nz<>r+   r+   r+   r3   r#   	parseaddr
formataddrr2  s    r:   test_parseaddr_empty&TestMiscellaneous.test_parseaddr_empty  s?    .9))%//$*?@"Er=   c                     U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        g )Nza@b@cr'  za@b.c@cza@172.17.0.1@cr3   r#   r)  r2  s    r:   test_parseaddr_multiple_domains1TestMiscellaneous.test_parseaddr_multiple_domains  s^    OOG$	
 	OOI&	
 	OO,-	
r=   c                 P    U R                  [        R                  " S5      S5        g )N)zA Silly Personperson@dom.ainzA Silly Person <person@dom.ain>r3   r#   r*  r2  s    r:   test_noquote_dump#TestMiscellaneous.test_noquote_dump  s"    AB-	/r=   c                    U R                  [        R                  " S5      S5        U R                  [        R                  " S5      S5        SnSnU R                  [        R                  " [        R                  " X45      5      X45        g )N)zA (Very) Silly Personr2  z("A (Very) Silly Person" <person@dom.ain>z*"A \(Very\) Silly Person" <person@dom.ain>zA \(Special\) Personr2  r3   r#   r*  r)  r7   r  rD  s      r:   test_escape_dump"TestMiscellaneous.test_escape_dump  sv    HI7	9 	OOIJ7	9 $)9)91&)ABQFKr=   c                     U R                  [        R                  " S5      S5        SnSnU R                  [        R                  " [        R                  " X45      5      X45        g )N)Arthur \Backslash\ Foobarr2  z."Arthur \\Backslash\\ Foobar" <person@dom.ain>r<  r2  r7  r8  s      r:   test_escape_backslashes)TestMiscellaneous.test_escape_backslashes  sV    MN=	? ))9)91&)ABQFKr=   c                     SnSnSnSnU R                  [        R                  " X45      U5        U R                  [        R                  " X4S5      U5        g )N   Häns Würstr2  -=?utf-8?b?SMOkbnMgV8O8cnN0?= <person@dom.ain>z0=?iso-8859-1?q?H=E4ns_W=FCrst?= <person@dom.ain>r?   r3  )r7   rL  addrutf8_base64latin1_quopris        r:   test_quotes_unicode_names+TestMiscellaneous.test_quotes_unicode_names  sU    %EJ))4,7E))4,E	r=   c                   ^ SnSnSnSm " U4S jS5      nU" 5       nT< SU< S3nU R                  [        R                  " X4U5      U5        U R                  [        R                  " X4[        S	5      5      U5        g )
Nr@  r2  rA  FOOBARc                   "   > \ rS rSrU 4S jrSrg)KTestMiscellaneous.test_accepts_any_charset_like_object.<locals>.CharsetMocki  c                    > T$ rn   rK  )r7   stringr  s     r:   header_encodeYTestMiscellaneous.test_accepts_any_charset_like_object.<locals>.CharsetMock.header_encode  s    r=   rK  N)rL  rM  rN  rO  rM  rP  )r  s   r:   CharsetMockrJ    s     r=   rO  z <>r[   )r3   r#   r*  r
   )r7   rL  rB  rC  rO  mockmock_expectedr  s          @r:   $test_accepts_any_charset_like_object6TestMiscellaneous.test_accepts_any_charset_like_object  sz    %E	 	 }%+T2))4,=}M))4,8HI	r=   c                 n    SnSn[        5       nU R                  [        [        R                  X4U5        g )Nr@  r2  )objectr   AttributeErrorr#   r*  )r7   rL  rB  bad_charsets       r:   -test_invalid_charset_like_object_raises_error?TestMiscellaneous.test_invalid_charset_like_object_raises_error  s2    %h.%*:*:TL	r=   c                     SnU R                  [        [        R                  S U45        U R                  [        [        R                  SU45        g )Nu   persön@dom.inName)r   UnicodeErrorr#   r*  r7   rB  s     r:   !test_unicode_address_raises_error3TestMiscellaneous.test_unicode_address_raises_error  s?    #,(8(84,G,(8(864.Ir=   c                     SnSnSu  p4U R                  [        R                  " U5      X445        U R                  [        R                  " U5      X445        U R                  [        R                  " X445      U5        g )NzJohn X. Doe <jxd@example.com>z"John X. Doe" <jxd@example.com>)zJohn X. Doezjxd@example.comr(  )r7   r   yr  rD  s        r:   test_name_with_dot$TestMiscellaneous.test_name_with_dot  sf    +-1+aV4+aV4))1&115r=   c                     U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        U" [        R                  " S5      S5        g )N""example" example"@example.com)r+   rf  !"\"example\" example"@example.com)r+   rg  #"\\"example\\" example"@example.com)r+   rh  r.  r  s     r:   2test_parseaddr_preserves_quoted_pairs_in_addressesDTestMiscellaneous.test_parseaddr_preserves_quoted_pairs_in_addresses  sT     
5??<=
1	3
5??@A
5	7
5??DE
9	;r=   c                    U R                  S[        R                  " S5      5        U R                  S[        R                  " S5      5        U R                  S[        R                  " S5      5        U R                  S[        R                  " S5      5        U R                  S[        R                  " S	5      5        g )
N)r+   merwok wok@xample.comrl  )r+   merwok  wok@xample.comrm  z merwok  wok  @xample.com)r+   merwok"wok"  wok@xample.comrn  )r+   zmerwok.wok.wok@xample.comzmerwok. wok .  wok@xample.comr.  r2  s    r:   -test_parseaddr_preserves_spaces_in_local_part?TestMiscellaneous.test_parseaddr_preserves_spaces_in_local_part  s     	6OO34	67OO45	77OO78	:<OO9:	<:OO;<	>r=   c                     SnSnU R                  [        R                  " U5      U5        U R                  [        R                  " U5      U5        g )N)z#'foo@example.com' (foo@example.com)foo@example.comz7"'foo@example.com' (foo@example.com)" <foo@example.com>r(  )r7   rB  addrstrs      r:   6test_formataddr_does_not_quote_parens_in_quoted_stringHTestMiscellaneous.test_formataddr_does_not_quote_parens_in_quoted_string&  sE    #C148))$/9r=   c                 T    SnU R                  [        R                  " U5      S5        g )NzFoo
	Bar <foo@example.com>)zFoo Barrr  r.  )r7   r   s     r:   test_multiline_from_comment-TestMiscellaneous.test_multiline_from_comment/  s%     	+-KLr=   c                 P    U R                  [        R                  " S5      S5        g )N)zA Silly; Personr2  z""A Silly; Person" <person@dom.ain>r3  r2  s    r:   test_quote_dump!TestMiscellaneous.test_quote_dump5  s"    BC1	3r=   c                 T   U R                   nU R                  n[        5       n[        5       nU" US5        U" US5        U" US5        U" SU5        U" SU5        U" SU5        U" US5        U" US5        U" US5        U" SU5        U" SU5        U" SU5        U" X45        U" XC5        g )NrQ   US-ASCIIzUs-AsCiIusasciiUSASCIIUsAsCiI)r3   assertNotEqualr
   )r7   r8   necset1cset2s        r:   test_charset_richcomparisons.TestMiscellaneous.test_charset_richcomparisons:  s      		
5*
5*
5*
:u
:u
:u
5)
5)
5)
9e
9e
9e
5
5r=   c                 ^    U R                   nU" [        R                  " SS/5      SS/5        g )Naperson@dom.ain (Al Person)zBud Person <bperson@dom.ain>z	Al Personr   )z
Bud Personr  r3   r#   getaddressesr  s     r:   test_getaddresses#TestMiscellaneous.test_getaddressesN  s9    
5<=? @,-/	0r=   c                 X    U R                  [        R                  " / SQ5      / SQ5        g)zGH-106669 regression test.)z"Bud, Person" <bperson@dom.ain>r  z#"Mariusz Felisiak" <to@example.com>))zBud, Personr  r  )zMariusz Felisiakto@example.comNr  r2  s    r:   test_getaddresses_comma_in_name1TestMiscellaneous.test_getaddresses_comma_in_nameU  s(    	
r=   c                 p	   SnSnSnSSU S3U4/4SSU4USU4/4SSU4USU4U/4SSU4USU4/4S	SU S
U S34/4SSU4USU4/4SX3SU4/4SSU4USU4/4SSU4SU4/4SSUS-   4SU4/4SSU4SSU S34/44 H  u  pEU U SU S3nU R                  US9   U R                  [        R                  " U/5      U/5        U R                  [        R                  " U/SS9U5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        SSS5        M     U SU S3nU R                  [        R                  " U/5      SU4SU4/5        U R                  [        R                  " U/SS9SU4SU4/5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        SnSnU R                  [        R                  " U/5      U/5        U R                  [        R                  " U/SS9U/5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        SnSnU R                  [        R                  " U/5      U/5        U R                  [        R                  " U/SS9U/5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        SnU R                  [        R                  " U/5      U/5        U R                  [        R                  " U/SS9/ SQ5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        SnU R                  [        R                  " U/5      SS/5        U R                  [        R                  " U/SS9SS/5        U R                  [        R                  " U/5      U5        U R                  [        R                  " U/SS9SU45        U R                  [
        R                  R                  S 5        g! , (       d  f       GM:  = f)!z>Test for parsing errors from CVE-2023-27043 and CVE-2019-16056alice@example.orgbob@example.comr'  (<rP  )r+   [z[<z>]]@;:.")addressFstrictNz,<z,"Alice, alice@example.org" <bob@example.com>)zAlice, alice@example.orgr  zalice@example.org (Alice))Alicer  zalice@example.org )Alice())r+   r  r'  )r+   r  <"Jane Doe" <jane@example.net>, "John Doe" <john@example.net>)zJane Doezjane@example.net)zJohn Doezjohn@example.netT)r  r3   r#   r  r)  r   supports_strict_parsing)r7   alicebobemptyinvalid_separatorexpected_non_strictr  expected_stricts           r:   test_parsing_errors%TestMiscellaneous.test_parsing_errorsf  s   # auAJ&'(B;Cy12B;Cy%89B;Cy12B5'C5+,-.B;Cy125"c+,B;Cy12B;S	*+B$r3i01B;qQZ 0127
2  12!C5:Gg.  !3!3WI!>"'*  !3!3WIe!L!46   '!;!&(  '5!I"$g0 /.7
6 G2cU!$++WI6u+Cy1	3++WIeDu+Cy1	3'3	 '5Ag	( AI++WI68IJ++WIeDFWX'3_E'5Ag	( .8++WI68IJ++WIeDFWX'3_E'5Ag	( .++WI6@++WIeDM	O'3U;'5Ag	( Q++WI6::<	= 	++WIeD::<	= 	'3U;'5Ag	( 	<<dC /.s   BR%%
R5	c                    S/S/4S/S/4SS/SS/4S/S/4S	/S/4S
// SQ4S/S/4S/S/4S/S/4S/SS/44
 Hh  u  pU R                  US9   U R                  [        R                  " U5      U5        U R                  [        R                  " USS9U5        S S S 5        Mj     S/nU R                  [        R                  " U5      S/5        U R                  [        R                  " USS9/ SQ5        g ! , (       d  f       M  = f)Nu&   "Sürname, Firstname" <to@example.com>)u   Sürname, Firstnamer  zfoo: ;r'  z#"Jason R. Mastaler" <jason@dom.ain>)zJason 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)zpete@silly.testz<(Empty list)(start)Undisclosed recipients  :(nobody(I know))z=Mary <@machine.tld:mary@example.net>, , jdoe@test   . example))Maryzmary@example.netr'  )r+   zjdoe@test.examplez*John Doe <jdoe@machine(comment).  example>)zJohn Doe (comment)zjdoe@machine.examplez3"Mary Smith: Personal Account" <smith@home.example>)zMary Smith: Personal Accountzsmith@home.examplezUndisclosed recipients:;z7<boss@nil.test>, "Giant; \"Big\" Box" <bob@example.net>)r+   zboss@nil.test)zGiant; "Big" Boxzbob@example.net)	addressesFr  z	[]*-- =~$)r'  r'  )r+   z*--)r  r3   r#   r  )r7   r  r  s      r:   test_getaddresses_nasty)TestMiscellaneous.test_getaddresses_nasty  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> 	2  !3!3I!>!)+  !3!3Ie!L!)+ 32?$
J !M	++I6"	%++IeD:	< 32s   AC77
D	c                 h    U R                   n[        R                  " S/5      nU" US   S   S5        g)z(Test proper handling of a nested commentz%User ((nested comment)) <foo@bar.com>r   r   foo@bar.comNr  )r7   r8   addrss      r:   "test_getaddresses_embedded_comment4TestMiscellaneous.test_getaddresses_embedded_comment  s3    ""$K#LM
58A;&r=   c                 t    [         R                  " [        S5      /5      nU R                  US   S   S5        g)z%Test the handling of a Header object.zAl Person <aperson@dom.ain>r   r   r   N)r#   r  r   r3   )r7   r  s     r:   test_getaddresses_header_obj.TestMiscellaneous.test_getaddresses_header_obj  s4    ""F+H$I#JKq!&78r=   cpuc                 |    " S S[         5      n[        S5       Vs/ s H	  o!" 5       PM     nn[        R                  " U5          S S S 5        [	        U Vs/ s H  oDR
                  PM     sn/ 5      nU R                  [        [        U5      5      [        U5      5        g s  snf ! , (       d  f       Ng= fs  snf )Nc                       \ rS rSrS rSrg)BTestMiscellaneous.test_make_msgid_collisions.<locals>.MsgidsThreadi  c                     / U l         U R                   R                  n[        R                  n[        R
                  nU" 5       S-   nU" 5       U:  a  U" U" SS95        U" 5       U:  a  M  g g )Ng      @testdomain-stringdomain)msgidsr  r#   
make_msgidr  	monotonic)r7   r  r  clocktfins        r:   runFTestMiscellaneous.test_make_msgid_collisions.<locals>.MsgidsThread.run  sY     ++"--
w}gn:-@AB gnr=   )r  N)rL  rM  rN  rO  r  rP  rK  r=   r:   MsgidsThreadr    s    Cr=   r  r  )	r   r  r%   start_threadssumr  r3   r[  set)r7   r  r  threadsr   all_idss         r:   test_make_msgid_collisions,TestMiscellaneous.test_make_msgid_collisions  s    		C6 		C ,1848a<>84++G4 51Axx126S\*CL9	 5441s   B#B(B9(
B6c                     U R                   n[        5       nUR                  SSSS9  U" UR                  5       S5        g )Nrw  rt  zfoo\wacky"namerv  )r3   r   ry  r   r6   s      r:   test_utils_quote_unquote*TestMiscellaneous.test_utils_quote_unquote
  sA    i,l 1 	 	3
301r=   c                 Z    [        S5      nU R                  UR                  5       S5        g )Nznot a charsetr\   r
   r3   get_body_encodingr7   rC   s     r:   )test_get_body_encoding_with_bogus_charset;TestMiscellaneous.test_get_body_encoding_with_bogus_charset  s%    /*224h?r=   c                    U R                   n[        5       nSUS'   U" US   S5        UR                  5       nU" [        U5      S5        U" US   S5        [	        US   5      nU" UR                  5       S5        UR                  SUS	9  U" UR                  5       S
5        U" UR                  SS9S5        U" US   S5        [        5       nSUS'   UR                  5       nU" [        U5      S5        U" US   S5        [	        US   5      nU" UR                  5       [        R                  5        UR                  SUS	9  U" UR                  5       S5        U" US   S5        g )Nztext/plain; charset=UTF-8rF   rB   r   r   r[   r\   r   r  aGVsbG8gd29ybGQ=
Tr]   rD   ztext/plain; charset="US-ASCII"rQ   rf  rb  )
r3   r   r   r[  r
   r  rV   r_   r   r  )r7   r8   r9   r   rC   s        r:   -test_get_body_encoding_with_uppercase_charset?TestMiscellaneous.test_get_body_encoding_with_uppercase_charset  sS   i9N
3~ ;<##%
3x=!
8A; (1+&
7$$&18
3??23
3??$?'8
3*+X6i>N##%
3x=!
8A;
#(1+&
7$$&(?(?@w7
3??m,
3*+V4r=   c                     [        S5      n[        S5      nU R                  UR                  5       UR                  5       5        g )NrQ   r}  r  )r7   lcucs      r:   test_charsets_case_insensitive0TestMiscellaneous.test_charsets_case_insensitive/  s8    Z Z --/1E1E1GHr=   c                     U R                   nU R                  S5      n[        5       n[        R                  " X#5        U" UR                  5       S5        g )Nr  aB  multipart/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
r-  r/  s       r:   1test_partial_falls_inside_message_delivery_statusCTestMiscellaneous.test_partial_falls_inside_message_delivery_status4  sG    ""
 ll<(jS&
3<<>  	r=   c                 d    U R                  [        R                  R                  SS9SS  S5        g )Nr  r  iz@testdomain-string>r3   r   r#   r  r2  s    r:   test_make_msgid_domain(TestMiscellaneous.test_make_msgid_domain^  s0    KK""*=">stD!	#r=   c                 f    U R                  [        R                  R                  SSS9SS  S5        g )Nztest-idstringr  )idstringr  iz!.test-idstring@testdomain-string>r  r2  s    r:   test_make_msgid_idstring*TestMiscellaneous.test_make_msgid_idstringc  s9    KK""O* # ,,/D2/	1r=   c                     [        S5       nS=Ul        nU R                  [        R                  R                  5       SU-   S-   5        S S S 5        g ! , (       d  f       g = f)Nzsocket.getfqdnzpythontest.example.comr  rP  )r	   return_valueassertEndsWithr   r#   r  )r7   mock_getfqdnr  s      r:   test_make_msgid_default_domain0TestMiscellaneous.test_make_msgid_default_domaini  sL    #$1IIL% 6 6 8#,:LM %$$s   >A
A!c                 r   [        SSSS9 nUR                  5       nS S S 5        WR                  SS5      n[        R                  " U5      n[        5       n[        R                  R                  U5      nUR                  U5        U R                  UR                  5       U5        g ! , (       d  f       N= f)N
msg_26.txtr[   r*   r   newliner   )r'   r   r  r   r  r   r   r   r   r3   r   r7   fmsgtxt	msgtxt_nlr9   r   r   s          r:   test_Generator_linend'TestMiscellaneous.test_Generator_linendn  s    lWdCqVVXF DNN640	''/JOO%%a(			#y1 DCs   B((
B6c                    [        SSSS9 nUR                  5       nS S S 5        WR                  SS5      n[        R                  " U5      n[        5       n[        R                  R                  U5      nUR                  USS9  U R                  UR                  5       R                  S5      U5        g ! , (       d  f       N= f)Nr  r[   r*   r  r   r   r   )r'   r   r  r   r  r   r   r   r   r3   r   r^   r  s          r:   test_BytesGenerator_linend,TestMiscellaneous.test_BytesGenerator_linendy  s    lWdCqVVXF DNN640	''	2IOO**1-			#v	&,,W5v> DCs   B66
Cc                    [        SS5       nUR                  5       nS S S 5        WR                  SS5      nUR                  SS5      n[        R                  " U5      n[        5       n[        R                  R                  U5      nUR                  USS9  U R                  UR                  5       U5        g ! , (       d  f       N= f)	Nr  rU  s   with attachments   fo   
r  r   r   )r'   r   r  r   r   r   r   r   r   r3   r   r  s          r:   )test_BytesGenerator_linend_with_non_ascii;TestMiscellaneous.test_BytesGenerator_linend_with_non_ascii  s    lD)QVVXF * 2I>NN7E2	&&y1IOO**1-			#v	&v. *)s   B::
Cc                 R   [        SS5       nUR                  5       nS S S 5        [        SS5       nUR                  5       nS S S 5        [        S4[        W44[        W44[
        [        5       44[        S4[        S4/nU H  u  pVU R                  UR                  SS9   U" U6 nU R                  UR                  [        R                  R                  5        S S S 5        U R                  UR                  SS9   U" US	[        R                  R                  06nU R                  UR                  [        R                  R                  5        S S S 5        M     g ! , (       d  f       GNJ= f! , (       d  f       GN7= f! , (       d  f       N= f! , (       d  f       GM"  = f)
Nri  rU  rT  )r+   )r  r  r?  )clsr   rG  r   )r'   r   r   r   r   r   r   r   r   r  rL  rm  r   r   r?  rG  )r7   r   	audiodatar\  classesr  constructorr  s           r:   !test_mime_classes_policy_argument3TestMiscellaneous.test_mime_classes_policy_argument  sC   k4(B	I )lD)RggiG * e$%
#79,'56u
 !(C#,,zB%ahh(=(=> C #,,yABU\\-A-ABahh(<(<= BA	 !( )()) CB BAs/   E!E3#:F?AF!
E03
F
F	
F&	c                     U R                  [        [        R                  " S5      5      / SQ5        U R                  [        [        R                  " S5      5      SS/5        g )Nza\\b\"c\\"d)r   r  )r   \\)r   rD  )r  z\")r  c)   r  )r  r  )r  dza\r  )r   \)r3   r  r#   _iter_escaped_charsr2  s    r:   test_iter_escaped_chars)TestMiscellaneous.test_iter_escaped_chars  sQ    e77GH%	& 	e77>?"I.	0r=   c                    ^  U 4S jnU" SS5        U" SS5        U" SS5        U" SS	5        U" S
S5        U" SS5        U" SS5        U" SS5        S H)  nT R                  [        R                  " U5      U5        M+     g )Nc                 R   > TR                  [        R                  " U 5      U5        g rn   r3   r#   _strip_quoted_realnames)rB  r  r7   s     r:   check<TestMiscellaneous.test_strip_quoted_realnames.<locals>.check  s    U::4@(Kr=   r  z( <jane@example.net>,  <john@example.net>z""Jane \"Doe\"." <jane@example.net>z <jane@example.net>zbefore"name"afterbeforeafterzbefore"name"beforezb"name"rD  z"name"afterafterz"name"ar  z"name"r+   )z8Jane Doe <jane@example.net>, John Doe <john@example.net>zlone " quoter  )r7   r  rB  s   `  r:   test_strip_quoted_realnames-TestMiscellaneous.test_strip_quoted_realnames  s    	L 	L8	:3#	% 	"M2ox(j#ng&j#i
D U::4@$G	
r=   c                    SnU R                  [        R                  " U S35      5        U R                  [        R                  " U S35      5        U R                  [        R                  " U S35      5        U R                  [        R                  " U S35      5        U R                  [        R                  " SU 35      5        g )Nzalice@example.netz (Alice)z )Alice(z	 (Alice))z	 ((Alice)z")Alice((" )r  r#   _check_parenthesisr  r^  s     r:   test_check_parenthesis(TestMiscellaneous.test_check_parenthesis  s    "00D61BCD11TF(2CDE11TF)2DEF11TF)2DEF 	00;tf1EFGr=   rK  N)DrL  rM  rN  rO  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r$  r+  r/  r4  r9  r=  rE  rS  rY  r_  rc  ri  ro  rt  rw  rz  r  r  r  r  r  r  r  r%   requires_working_threadingr$   requires_resourcer  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r#  rP  rK  r=   r:   r  r    si   	-
16"6./
%J4,D767
69CC	8EKF
/
	LLJ6;$>$:M3
(0
"VDp*<X'9
 002u%: & 3:&2@54I
(T#
1N
	2	?
/>*0H2Hr=   r  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestIteratorsi  c                 4   U R                   nU R                  nU R                  S5      n[        R                  " U5      n[        U5      nU" [        U5      S5        U" [        R                  U5      UR                  5       5        U R                  S5      n[        R                  " U5      n[        U5      nU" [        U5      S5        [        SSS9 nU" [        R                  U5      UR                  5       5        S S S 5        g ! , (       d  f       g = f)Nr   r  rc  +   z
msg_19.txtr[   r   )r3   rx  r4   r!   body_line_iteratorr  r[  EMPTYSTRINGr   r_   r'   r   )r7   r8   rf  r9   itr   r   s          r:   test_body_line_iterator%TestIterators.test_body_line_iterator  s    ##ll<())#.R
3u:qKU#S__%67ll<())#.R
3u:rlW5  '3 655s   +D		
Dc                    U R                   nU R                  S5      n[        R                  " US5      n/ nSnU H'  nUS-  nUR	                  UR                  5       5        M)     U" US5        U" [        R                  U5      S5        g )Nr   r   r   r   r   z`a simple kind of mirror
to reflect upon our own
a simple kind of mirror
to reflect upon our own
r3   r4   r!   typed_subpart_iteratorr  r_   r,  r   r7   r8   r9   r-  r   subpartsr   s          r:   test_typed_subpart_iterator)TestIterators.test_typed_subpart_iterator  s    ll<(--c6:GMHLL,,./  	8Q
;E" % 	r=   c                    U R                   nU R                  S5      n[        R                  " USS5      n/ nSnU H'  nUS-  nUR	                  UR                  5       5        M)     U" US5        U" [        R                  U5      S5        g )Nr   r   r  r   r   z%
Hi,

Do you like this message?

-Me
r1  r3  s          r:   (test_typed_subpart_iterator_default_type6TestIterators.test_typed_subpart_iterator_default_type  s    ll<(--c67CGMHLL,,./  	8Q
;E" % 	r=   c           
         / SQnSSK JnJn  U" 5       n/ nSnU H`  u  pxUR                  U5        Xh-  nSn	[	        UR
                  U5       H  n
UR                  U
5        U	S-  n	M     U R                  X5        Mb     U R                  [        U5      U5        U R                  SR                  U VVs/ s H  u  pxUPM	     snn5      SR                  U5      5        gs  snnf )zFeedParser 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.
))za 
r   )rD  r   )zc
r   )r+   r   )zd
r   )zer   )z
fr   )r   r   r   BufferedSubFileNeedMoreDatar   r+   N)
email.feedparserr<  r=  pushiterreadliner  r3   r[  r   )r7   imtr<  r=  bsfomntilnn1ols              r:   test_pushCR_LFTestIterators.test_pushCR_LF  s    
	 	CEBHHRLGBB3<<6		"a 7 Q#  	R"%#!6#"#!67E!6s   4Cc                 x  ^ SSK JnJn  SnSnSmSR                  U4S j[	        U5       5       5      S-   nUR                  S	5      nU" 5       n/ n[	        S[        U5      U5       H?  n	XYX-    n
UR                  U
5        UR                  [        UR                  U5      5        MA     U R                  X5        g )
Nr   r;  i'  r  zabcd 	
r+   c              3   :   >#    U  H  n[        T5      v   M     g 7frn   r   )r  r  charss     r:   r  1TestIterators.test_push_random.<locals>.<genexpr>2  s     48aF5MM8s   r*   T)r>  r<  r=  r   r  r  r[  r?  extendr@  rA  r3   )r7   r<  r=  rG  	chunksizer   targetrC  r   r  chunkrN  s              @r:   test_push_randomTestIterators.test_push_random+  s    B	GG45844t;d#q#a&),A$EHHUOLLcllL9: - 	'r=   rK  N)
rL  rM  rN  rO  r.  r5  r8  rJ  rT  rP  rK  r=   r:   r(  r(    s    4""&F<(r=   r(  c                   ,    \ rS rSrS rS rS rS rSrg)TestFeedParsersi>  c                 j    [        5       nU H  nUR                  U5        M     UR                  5       $ rn   )r)   feedclose)r7   chunksr  rS  s       r:   parseTestFeedParsers.parse@  s.    \
EOOE" !!r=   c                 z    U R                  S5      nU R                  US   S5        U R                  US   S5        g )NzFirst: val
: bad
Second: valr  valr  )r\  r3   rp   s     r:   test_empty_header_name_handled.TestFeedParsers.test_empty_header_name_handledF  s9    jj9:Wu-X.r=   c                    U R                  S/5      nU R                  UR                  5       / SQ5        U R                  S/5      nU R                  UR                  5       / SQ5        U R                  SS/5      nU R                  UR                  5       SS/5        U R                  SS	/5      nU R                  UR                  5       SS
/5        U R                  SS/5      nU R                  UR                  5       SS
/5        U R                  S/5      nU R                  UR                  5       S/5        U R                  / SQ5      nU R                  UR                  5       SS/5        g )Nza:
b:c:
d:
)r  rD  r  r  za:
b:c:
d:za:bc:
r  bca:zb:
rD  z
b:
u   a:b: c:
)r  u	   b: c:)re  u   b:rc  r  r+   )rD  u   c:)r\  r3   r  r   r>  s     r:   test_newlinesTestFeedParsers.test_newlinesL  s3   JJ,-.#78JJ*+,#78JJ()C;/JJ'(C:.JJ)*C:. JJ,-.%<$=>JJ12Y$@Ar=   c                    Su  pU R                  S/SU-  /U-  -   5      nU R                  UR                  5       S/5        U R                  UR                  5       SU-  U-  5        U R                  S/SU-  /U-  -   5      nU R                  UR                  5       S/5        U R                  UR                  5       SU-  U-  5        U R                  S/SU-  S-   /U-  -   5      nU R                  UR                  5       S/5        U R                  UR                  5       SU-  S-   U-  5        U R                  SS/SU-  /U-  -   5      nU R                  UR                  5       S	S
SU-  U-  4/5        g )N)i  i N  za:b

r   )r  rD  za:b   re  zb: rf  rD  )r\  r3   r   r_   )r7   MNr  s       r:   test_long_linesTestFeedParsers.test_long_lines^  sZ   JJ	{c!eWq[01ZL1#a%'2JJ	{c!eWq[01ZL1#a%'2JJ	{c!eFl^a%778ZL13q5<*:;JJ#a%145Yc!eAg$?@r=   rK  N)	rL  rM  rN  rO  r\  r`  rg  rm  rP  rK  r=   r:   rW  rW  >  s    "/B$Ar=   rW  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rSrS rS rS rS rS rS rS rSrg)TestParsersin  c                 z   U R                   n[        SSS9 n[        5       R                  U5      nS S S 5        U" WS   S5        U" US   S5        U" UR	                  5       S5        U R                  UR                  5       5        U R                  UR                  5       [        5        g ! , (       d  f       N= f)	Nrc  r[   r   r   ppp-request@zzz.orgr   ppp@zzz.orgrt   )
r3   r'   r   r\  rJ   r  r  r  r_   r   r7   r8   r   r9   s       r:   test_header_parserTestParsers.test_header_parserp  s    lW5.&&r*C 6
3v;-.
3t9m$
3!#45))+,coo/5 65s   B,,
B:c                    U R                   n[        SS5       n[        R                  R	                  5       R                  U5      nS S S 5        U" WS   S5        U" US   S5        U" UR                  5       S5        U R                  UR                  5       5        U R                  UR                  5       [        5        U R                  UR                  SS	9[        5        g ! , (       d  f       N= f)
Nrc  rU  r   rr  r   rs  rt   Tr]   )r3   r'   r   r   r   r\  rJ   r  r  r  r_   r   r  rt  s       r:   test_bytes_header_parser$TestParsers.test_bytes_header_parser{  s    lD)R,,00288<C *
3v;-.
3t9m$
3!#45))+,coo/5cooTo:EB *)s   .C%%
C3c                 .   [        SSS9 nUR                  5       nS S S 5        [        R                  R	                  [        R
                  R                  S9nUR                  WSS9nU R                  UR                  / 5        g ! , (       d  f       Np= f)Nz
msg_47.txtr[   r   r   T)headersonly)
r'   r   r   r   r   r   rG  r   r3   r  )r7   r   r   r   
parsed_msgs        r:   %test_header_parser_multipart_is_valid1TestParsers.test_header_parser_multipart_is_valid  sr    lW5ggiG 6 $$ELL,@,@$A__W$_?
++R0 65s   B
Bc                     [        SS5       n[        R                  R                  5       R	                  U5        U R                  UR                  5        S S S 5        g ! , (       d  f       g = f)Nrc  rU  )r'   r   r   BytesParserr\  r  closedr  s     r:   %test_bytes_parser_does_not_close_file1TestParsers.test_bytes_parser_does_not_close_file  sG    lD)RLL$$&,,R0RYY' *))s   A	A
A-c                 \   [        SS5       n[        R                  R                  nU R	                  [        R
                  R                  U" [        R                  R                  S9R                  U5        U R                  UR                  5        S S S 5        g ! , (       d  f       g = f)NrK  rU  r   )r'   r   r   r  r   r    rM  r   r  r\  r  r  )r7   r   bytesParsers      r:   2test_bytes_parser_on_exception_does_not_close_file>TestParsers.test_bytes_parser_on_exception_does_not_close_file  sr    lD)R,,22KellFF)1D1DEKK " RYY' *))s   BB
B+c                     [        SSS9 n[        R                  R                  5       R	                  U5        U R                  UR                  5        S S S 5        g ! , (       d  f       g = f)Nrc  r[   r   )r'   r   r   r   r\  r  r  r  s     r:   test_parser_does_not_close_file+TestParsers.test_parser_does_not_close_file  sG    lW5LL!''+RYY' 655s   A	A
A+c                 X   [        SSS9 n[        R                  R                  nU R	                  [        R
                  R                  U" [        R                  R                  S9R                  U5        U R                  UR                  5        S S S 5        g ! , (       d  f       g = f)NrK  r[   r   r   )r'   r   r   r   r   r    rM  r   r  r\  r  r  )r7   r   r   s      r:   ,test_parser_on_exception_does_not_close_file8TestParsers.test_parser_on_exception_does_not_close_file  sp    lW5\\((FellFF$ELL,?,?@FFLRYY'	 655s   BB
B)c                     U R                   n[        R                  " S5      nU" US   S5        U" US   S5        U" UR                  5       S5        g )NzFrom: 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
r3   r   r  r_   r6   s      r:   test_whitespace_continuation(TestParsers.test_whitespace_continuation  V     '' 	) 	 	3y>?@
3|f%
3??9:r=   c                     U R                   n[        R                  " S5      nU" US   S5        U" US   S5        U" UR                  5       S5        g )NzFrom: 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  r  r	  r  r  r  r6   s      r:   (test_whitespace_continuation_last_header4TestParsers.test_whitespace_continuation_last_header  r  r=   c                    U R                   n[        SSSS9 n[        5       R                  U5      nS S S 5        U" [	        WR                  5       5      S5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        UR                  S	5      nU" UR                  5       S
5        g ! , (       d  f       N= f)Nr  r[   r*   r  r   r   rA   z!Simple email with attachment.

r   zapplication/riscos)r3   r'   r   r\  r[  r_   rJ   )r7   r8   r   r9   part1part2s         r:   test_crlf_separation TestParsers.test_crlf_separation  s    lWdCr(..$C D
3s !1%"
5!!#\2
5 GH"
5!!#%9: DCs   C
Cc                 $   [        SSSS9 nUR                  5       nS S S 5        [        R                  " W5      n[	        5       n[        U5      nUR                  USS9  U R                  UR                  5       U5        g ! , (       d  f       Nj= f)Nr  r[   r*   r  r   r   r  r  s         r:   test_crlf_flattenTestParsers.test_crlf_flatten  sq    lWdCr779D D''-JaL			#v	&t, DCs   B
BNc                    U R                   nU R                  n[        SSS9 n[        R                  " U5      nS S S 5        U" WR                  5       S5        U" [        UR                  5       5      S5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        U" [        UR                  5       5      S5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S	5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        U" [        UR                  5       5      S5        UR                  S5      nU" UR                  5       S5        U" UR                  5       S5        U" UR                  5       S
5        g ! , (       d  f       GN= f)Nr  r[   r   r   r   r   r  rA   r(  r)  )	r3   rx  r'   r   r  r  r[  r_   rJ   )	r7   r8   rf  r   r9   r  part1ar  part2as	            r:   -test_multipart_digest_with_extra_mime_headers9TestParsers.test_multipart_digest_with_extra_mime_headers  s   ##lW5))"-C 6 	3q!
3s !1%"
5!!#%56
5#
3u  "#Q'""1%
6 !$
6""$l3F -0"
5!!#%56
5#
3u  "#Q'""1%
6 !$
6""$l3F -05 65s   G$$
G3c                     / SQn[         R                  " [        R                  U5      5      nU R	                  US   S5        g )N)z$From: Andrew Person <aperson@dom.ainzSubject: Testz%Date: Tue, 20 Aug 2002 16:43:45 +1000datezTue, 20 Aug 2002 16:43:45 +1000)r   r  r   r   r3   )r7   r   r9   s      r:   test_three_linesTestParsers.test_three_lines  s8    : ''7V&GHr=   c                     U R                   nSnSnSU< SU< S3n[        R                  " U5      nU" UR                  S5      U5        U" UR                  S5      U5        g )Nr   z	more textzHeader: z
Next-Header: z

Body

r   zNext-Header)r3   r   r  get)r7   r8   value1value2r  r9   s         r:   3test_strip_line_feed_and_carriage_return_in_headers?TestParsers.test_strip_line_feed_and_carriage_return_in_headers  sY    F''*
3778f%
377=!6*r=   c                     U R                   nSn[        R                  " U5      nU" [        U5      S5        U" [	        S U 5       5      / SQ5        U" UR                  5       S5        g )Nz(>From: foo
From: bar
!"#QUX;~: zoo

bodyr   c              3   $   #    U  H  ov   M     g 7frn   rK  )r  fields     r:   r  9TestParsers.test_rfc2822_header_syntax.<locals>.<genexpr>  s     )SE%S   )z!"#QUX;~z>Fromr   rx  )r3   r   r  r[  r  r_   r$  s       r:   test_rfc2822_header_syntax&TestParsers.test_rfc2822_header_syntax  sV    :''*
3s8Q
6)S))+HI
3??f%r=   c                     U R                   nSn[        R                  " U5      nU" [        UR	                  5       5      S5        g )Nz<>From foo@example.com 11:25:53
From: bar
!"#QUX;~: zoo

bodyr   )r3   r   r  r[  r  r$  s       r:   (test_rfc2822_space_not_allowed_in_header4TestParsers.test_rfc2822_space_not_allowed_in_header  s6    N''*
3sxxz?Ar=   c                     U R                   nSn[        R                  " U5      nUR                  5       nUR	                  5         U" U/ SQ5        U" UR                  5       S5        g )Nz7A: first header
B: second header
CC: third header

body)ABCCrx  )r3   r   r  r  sortr_   )r7   r8   r  r9   headerss        r:   !test_rfc2822_one_character_header-TestParsers.test_rfc2822_one_character_header%  sR    I''*((*
7$%
3??f%r=   c                     Sn[         R                  " U5      nU R                  UR                  S5      R                  5       S5        g )NzFrom: 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--
r   r   )r   r  r  r_   r7   r  r9   s      r:   test_CRLFLF_at_end_of_part&TestParsers.test_CRLFLF_at_end_of_part.  s@    
 	
 ''*COOA.::<fEr=   rK  )rL  rM  rN  rO  ru  rx  r}  r  r  r  r  r  r  r  r  r.  r  r  r  r  r  r  r  rP  rK  r=   r:   rp  rp  n  sf    	6
C1(
((
(;$;$	;- G1>I	+&&Fr=   rp  c            	          \ rS rSr\R
                  " S5      rS rS rS r	S r
S rS rS	 rS
rSR                  \ V VVs/ s H  u  pUPM	     snnn 5      S-   R!                  S5      rS rS rS rS rS rS rS rS rS rS rS r\R
                  " S5      R!                  S5      rS rS r\R
                  " S5      r S r!S r"S r#\ RI                  S5      r%S /\%S!S"& SR                  \%5      r%S# r&\R
                  " S$5      R!                  S%5      r'\R
                  " S&5      r(S' r)S( r*S) r+S* r,S+ r-S, r.S- r/S.r0S/r1g.s  snnn f )0Test8BitBytesHandlingiB  z        From: foo@bar.com
        To: baz
        Mime-Version: 1.0
        Content-Type: text/plain; charset={charset}
        Content-Transfer-Encoding: {cte}

        {bodyline}
        c                     U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  5       S5        U R                  UR                  SS9SR                  S5      5        g )Nr[   rf      pöstalrC   r   bodyline   pöstal
Tr]   bodytest_msgr)  r   r   r   r3   r_   r  s      r:   test_known_8bit_CTE)Test8BitBytesHandling.test_known_8bit_CTEU  s    $$W)/.7 % 99? 	
 &&q)*K85$++G4	6r=   c                     U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  5       S5        U R                  UR                  SS9S	R                  S5      5        g )
Nnotavalidcharsetrf   r  r  r[   u   p��stal
Tr]   r  r  r  s      r:   test_unknown_8bit_CTE+Test8BitBytesHandling.test_unknown_8bit_CTE^  s    $$-?)/.7 % 99? 	
 &&q)*,AB5$++G4	6r=   c                     U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  5       S5        U R                  UR                  SS9SR                  S5      5        g )	Nr[   rE      p=C3=B6stálr  u   p=C3=B6stál
Tr]   	   pöstál
r  r  s      r:   test_8bit_in_quopri_body.Test8BitBytesHandling.test_8bit_in_quopri_bodyg  s     $$W);.< % >>DfWo 	
 &&q)*,<=5%,,W5	7r=   c                     U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  5       S5        U R                  UR                  SS9S	R                  S5      5        g )
Nr   rE   r  r  r[   u   p=C3=B6st��l
Tr]   r  r  r  s      r:   .test_invalid_8bit_in_non_8bit_cte_uses_replaceDTest8BitBytesHandling.test_invalid_8bit_in_non_8bit_cte_uses_replacey  s     $$W);.< % >>DfWo 	
 &&q)*,FG5$++G4	6r=   c                 :   U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  SS9SR                  S5      5        U R                  UR                  S   [        R                  5        g )	Nr[   r\   u   cMO2c3RhbAá=r  Tr]   r  r   )r  r)  r   r   r   r3   r_   r  r  r    r  r  s      r:   test_8bit_in_base64_body.Test8BitBytesHandling.test_8bit_in_base64_body  s     $$W)1.= % ??Evg 	
 &&q)5"))'2	4ckk!n$BB	Dr=   c                     U R                   R                  SSSS9R                  S5      n[        R                  " U5      nU R                  UR                  SS9SR                  S5      5        g )Nr[   r   u   <,.V<W1A; á r  Tr]   u   <,.V<W1A; á 
r  r  s      r:   test_8bit_in_uuencode_body0Test8BitBytesHandling.test_8bit_in_uuencode_body  sn     $$W)3.= % ??Evg 	
 &&q)5*11':	<r=   c                    [         R                  " S5      R                  S5      n[        R                  " U5      nU R                  UR                  5       S5        U R                  UR                  SS9SR                  S5      5        g )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
        r[   r  Tr]   )r   r   r   r   r   r3   r_   r  s      r:   test_rfc2231_charset_8bit_CTE3Test8BitBytesHandling.test_rfc2231_charset_8bit_CTE  su    OO   VG_ 	
 &&q)*K85$++G4	6r=   ))zFrom: foo@bar.comr   r  )u   To: báz)r   z=?unknown-8bit?q?b=C3=A1z?=)uV   Subject: 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?=)u   From: göst)r   z=?unknown-8bit?b?Z8O2c3Q=?=r*   z
Yes, they are flying.
r[   c                     [         R                  " U R                  5      nU R                  [	        UR                  S5      5      S5        U R                  [	        US   5      S5        g )Nr      b��z)r   r   headertest_msgr3   r   r  rp   s     r:   test_get_8bit_header*Test8BitBytesHandling.test_get_8bit_header  sO    &&t':':;SWWT]+-=>SY)9:r=   c                    [         R                  " U R                  5      nU R                  [	        U5      [
        R                  " S5      R                  " U R                   VVs/ s H
  u  p#US   PM     snn6 5        g s  snnf )Nz                            From: {}
                            To: {}
                            Subject: {}
                            From: {}

                            Yes, they are flying.
                            r   )	r   r   r  r3   r   r   r   r)  headertest_headers)r7   r9   _r  s       r:   test_print_8bit_headers-Test8BitBytesHandling.test_print_8bit_headers  s    &&t':':;S! *  ! "(( )-(?(?*A(? ;H1(1+(?*AB		C*As   %B c                     [         R                  " U R                  5      nU R                  UR	                  5        Vs/ s H  n[        U5      PM     sn/ SQ5        g s  snf )N)r  r  ]   Maintenant je vous pr��sente mon coll��gue, le pouf c��l��bre
	Jean de Baddie	   g��st)r   r   r  assertListEqualr  r   r7   r9   r   s      r:   test_values_with_8bit_headers3Test8BitBytesHandling.test_values_with_8bit_headers  sI    &&t':':;cjjl;lc!fl;2	3;s   Ac           
          [         R                  " U R                  5      nU R                  UR	                  5        VVs/ s H  u  p#[        U5      [        U5      4PM     snn/ SQ5        g s  snnf )N)r  )r   r  )r<  r  )r   r  )r   r   r  r  r   r   )r7   r9   r   rb  s       r:   test_items_with_8bit_headers2Test8BitBytesHandling.test_items_with_8bit_headers  sT    &&t':':;SYY[I[6As1vs1v.[I<	=Is   "A-
c                     [         R                  " U R                  5      nU R                  UR	                  S5       Vs/ s H  n[        U5      PM     snSS/5        g s  snf )Nr   r  r  )r   r   r  r  r5   r   r  s      r:   test_get_all_with_8bit_headers4Test8BitBytesHandling.test_get_all_with_8bit_headers  sT    &&t':':;ckk&.AB.Ac!f.AB,02	3Bs   Ac                 6   [         R                  " [        R                  " S5      R	                  S5      5      nU R                  UR                  5       S5        U R                  UR                  5       S5        U R                  UR                  5       S5        g )NuA               Content-Type: text/pl§in; charset=utf-8
            r  u   text/pl�inr   u   pl�in)	r   r   r   r   r   r3   rJ   r  r  rp   s     r:   test_get_content_type_with_8bit5Test8BitBytesHandling.test_get_content_type_with_8bit  sz    &&x 8 (	"$ 	--/1BC113V<002LAr=   c                    [         R                  " SR                  S5      5      nU R                  UR	                  SS9/ SQ5        U R                  UR                  SSS9S5        U R                  UR                  SSS9S 5        g )	Nu(   X-Header: foo=§ne; b§r=two; baz=three
r  r6  r7  ))r      �ne)u   b�rr:  r;  Foor  u   b§r)r   r   r   r3   r>  rK   rp   s     r:   test_get_params_with_8bit/Test8BitBytesHandling.test_get_params_with_8bit  sz    &&;BB9MOz:G	IuZ@*Mx
CTJr=   c                     [         R                  " [        R                  " S5      R	                  S5      5      nU R                  UR                  S5      S5        g )Nn               Content-Type: text/plain; charset=us-ascii;
             title*=us-ascii'en'This%20is%20not%20f§nr  title)rQ   enu   This is not f�n)r   r   r   r   r   r3   rK   rp   s     r:   !test_get_rfc2231_params_with_8bit7Test8BitBytesHandling.test_get_rfc2231_params_with_8bit  sL    &&x 8< ( vi " 	w/6	8r=   c                     [         R                  " [        R                  " S5      R	                  S5      5      nUR                  SS5        U R                  UR                  S5      S5        g )Nr  r  r  test)r   r   r   r   r   rc  r3   rK   rp   s     r:   !test_set_rfc2231_params_with_8bit7Test8BitBytesHandling.test_set_rfc2231_params_with_8bit  sW    &&x 8< ( vi " 	gv&w/8r=   c                    [         R                  " [        R                  " S5      R	                  S5      5      nUR                  S5        U R                  UR                  S5      S 5        U R                  UR                  5       S5        g )Nr  r  r  r   )	r   r   r   r   r   rn  r3   rK   r  rp   s     r:   !test_del_rfc2231_params_with_8bit7Test8BitBytesHandling.test_del_rfc2231_params_with_8bit  sn    &&x 8< ( vi " 	gw/6113V<r=   c                     [         R                  " [        R                  " S5      R	                  S5      5      nU R                  UR                  5       S5        U R                  UR                  SS9S5        g )Nu               Content-Transfer-Encoding: b§se64
            Content-Type: text/plain; charset=latin-1

            payload
            r  zpayload
Tr]   s   payload
)r   r   r   r   r   r3   r_   rp   s     r:   %test_get_payload_with_8bit_cte_header;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                    [         R                  " U R                  5      n[        5       n[         R                  R                  U5      R                  U5        U R                  UR                  5       U R                  5        g rn   )	r   r   non_latin_bin_msgr   r   r   r   r3   r   r7   r9   r   s      r:   test_bytes_generator*Test8BitBytesHandling.test_bytes_generator.  sX    &&t'='=>i&&s+33C8)?)?@r=   c                     [         R                  R                  5       n[        5       n[         R                  R                  U5      R                  U5        U R                  UR                  5       S5        g )Nr  )	r   r  r   r   r   r   r   r3   r   r  s      r:   &test_bytes_generator_handles_None_body<Test8BitBytesHandling.test_bytes_generator_handles_None_body4  sN    mm##%i&&s+33C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                    [         R                  " U R                  5      n[        5       n[         R                  R                  U5      R                  U5        U R                  UR                  5       U R                  5        g rn   )
r   r   r  r   r   r   r   r3   r    non_latin_bin_msg_as7bit_wrappedr  s      r:   test_generator_handles_8bit1Test8BitBytesHandling.test_generator_handles_8bitH  sX    &&t'='=>j!!#&..s3)N)NOr=   c                 x   [         R                  " U R                  5      n[        5       n[	        U5      R                  U5        UR                  5       n[        [        5       5      R                  U5        [        5       n[	        U5      R                  U5        U R                  UR                  5       U5        g rn   )
r   r   r  r   r   r   r   r   r   r3   )r7   r9   r   
orig_values       r:   ;test_str_generator_should_not_mutate_msg_when_handling_8bitQTest8BitBytesHandling.test_str_generator_should_not_mutate_msg_when_handling_8bitN  s    &&t'='=>is##C(\\^
(*%%c*is##C(4r=   c                    [         R                  " U R                  5      n[        5       n[         R                  R                  U5      R                  USS9  UR                  5       R                  S5      nU R                  US   R                  5       S   S5        U R                  SR                  USS  5      U R                  5        g )NTr   r  r   s   Fromr   )r   r   r  r   r   r   r   r   r   r3   r   )r7   r9   r   r   s       r:   #test_bytes_generator_with_unix_from9Test8BitBytesHandling.test_bytes_generator_with_unix_fromX  s     &&t'='=>i&&s+33C$3G$$U+q)!,g6E!"I.0F0F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                    SnU R                  [        U5        [        US5       nUR                  U R                  5        S S S 5        [        US5       n[
        R                  R                  5       R                  U5      nS S S 5        U R                  [        W5      U R                  5        g ! , (       d  f       Nv= f! , (       d  f       NE= f)Nztest.msgwbrU  )
addCleanupr&   openwriter  r   r   r  r\  r3   r   non_latin_bin_msg_as7bit)r7   r  testfiler  s       r:   test_message_from_binary_file3Test8BitBytesHandling.test_message_from_binary_filei  s    #"d^xNN4112 "d^x((*00:A Q!>!>?	 ^^s   B1.C1
B?
Cu          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                     [         R                  " U R                  5      nU R                  [	        U5      U R
                  5        g rn   )r   r   latin_bin_msgr3   r   latin_bin_msg_as7bitr>  s     r:   :test_string_generator_reencodes_to_quopri_when_appropriatePTest8BitBytesHandling.test_string_generator_reencodes_to_quopri_when_appropriate  s2    $$T%7%78Q!:!:;r=   c                 ,   [         R                  " U R                  5      n[        5       n[         R                  R                  U5      R                  U5        U R                  UR                  5       U R                  R                  S5      S-   5        g )Nr  r*   )
r   r   r3  r   r   r   r   r3   r   r^   )r7   r  r   s      r:   )test_decoded_generator_emits_unicode_body?Test8BitBytesHandling.test_decoded_generator_emits_unicode_body  sm    $$T%7%78j((-55a8 	%%i05	7r=   c                 8   [         R                  R                  5       n[        S[	        U R
                  5      S5       H#  nUR                  U R
                  X"S-    5        M%     UR                  5       nU R                  [        U5      U R                  5        g )Nr   r  )r   r  BytesFeedParserr  r[  r3  rY  rZ  r3   r   r4  )r7   bfpr  r  s       r:   test_bytes_feedparser+Test8BitBytesHandling.test_bytes_feedparser  st    ..0q#d00126AHHT''B$/0 7IIKQ!:!:;r=   c                 N   [        SS5       nUR                  5       nS S S 5        [        R                  " W5      n[	        5       n[        R
                  R                  U5      nUR                  USS9  U R                  UR                  5       U5        g ! , (       d  f       N~= f)Nr  rU  r   r   )
r'   r   r   r   r   r   r   r   r3   r   r  s         r:   r  'Test8BitBytesHandling.test_crlf_flatten  sx    lD)R779D *&&t,IOO**1-			#v	&t, *)s   B
B$c                 .   [         R                  " S5      R                  S5      n[        R                  " U5      n[        5       n[        R                  R                  U5      nUR                  U5        U R                  UR                  5       U5        g )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--

            r[   )r   r   r   r   r   r   r   r   r   r3   r   )r7   r  r9   r   r   s        r:   test_8bit_multipart)Test8BitBytesHandling.test_8bit_multipart  st     %" %J K 	L &&v.IOO**1-			#v.r=   c                     [        5       n[        S5      US'   [        5       n[        R                  R                  U5      nUR                  USS9  U R                  UR                  5       S5        g )N   žluťoučký kůňr<  r   r   s5   Subject: =?utf-8?b?xb5sdcWlb3XEjWvDvSBrxa/FiA==?=

)	r   r   r   r   r   r   r   r3   r   r7   r  r   r   s       r:   'test_bytes_generator_b_encoding_linesep=Test8BitBytesHandling.test_bytes_generator_b_encoding_linesep  s^    I34)IOO**1-			!V	$JJLH	Jr=   c                     [        5       n[        S5      US'   [        5       n[        R                  R                  U5      nUR                  USS9  U R                  UR                  5       S5        g )NrE  r<  r   r   z5Subject: =?utf-8?b?xb5sdcWlb3XEjWvDvSBrxa/FiA==?=

)	r   r   r   r   r   r   r   r3   r   rF  s       r:   !test_generator_b_encoding_linesep7Test8BitBytesHandling.test_generator_b_encoding_linesep  s^    I34)JOO%%a(			!V	$JJLG	Ir=   NrK  )2rL  rM  rN  rO  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   r$  r'  r   r.  r0  r3  r4  r5  r8  r=  r  rB  rG  rJ  r.  rP  )r  srcr  s   000r:   r  r  B  s    ?? $ L667$6 D<6 	
 ii5G H5G#5G HI#$%+VG_ ;
C	3
=3BK89=E ! 
) 
 VG_ A0 (0 8 ($P5	H  @EEdK	8%9Qq!  $yy)AB@ OO 	% 	 VI  $?? 	, 	<7<-,/\
J
I Ge	 !Is   Er  c                   (    \ rS rSrSrS rSS jrSrg) BaseTestBytesGeneratorIdempotenti  Nc                     [        US5       nUR                  5       nS S S 5        U R                  R                  U R                  W5      n[
        R                  " U5      nXC4$ ! , (       d  f       NM= f)NrU  )r'   r   normalize_linesep_regexsubblinesepr   r   rP  s        r:   r4   (BaseTestBytesGeneratorIdempotent._msgobj  s[    h%779D &++//tD&&t,y	 &%s   A%%
A3c                     [        5       n[        R                  R                  USS9nUR	                  XU R
                  S9  U R                  X$R                  5       5        g )Nr   r  )r   r   )r   r   r   r   r   r   r3   r   )r7   r9   ra   r   rD  r   s         r:   rS  ,BaseTestBytesGeneratorIdempotent._idempotent  sJ    IOO**11*=			#$,,	?zz|,r=   rK  r  )rL  rM  rN  rO  r.  r4   rS  rP  rK  r=   r:   rN  rN    s    G-r=   rN  c                   @    \ rS rSrSrSr\R                  " S5      rSr	g)TestBytesGeneratorIdempotentNLi  r*   r  s   \r\nrK  N
rL  rM  rN  rO  r   rR  recompilerP  rP  rK  r=   r:   rW  rW    s    GH jj2r=   rW  c                   @    \ rS rSrSrSr\R                  " S5      rSr	g) TestBytesGeneratorIdempotentCRLFi  r   r  s	   (?<!\r)\nrK  NrX  rK  r=   r:   r\  r\    s    GH jj7r=   r\  c                   ,    \ rS rSrS rS rS rS rSrg)
TestBase64i  c           
      P   U R                   nU" [        R                  " S5      [        [        R                  " SSS95      5        [        S5       HR  nUS:X  a  SnO&US::  a  SnOUS	::  a  S
nOUS::  a  SnOUS::  a  SnOSnU" [        R                  " SU-  5      U5        MT     g )Nhello   hellor+   eol   r   r   r   r  r  r     r     r   )r3   r   header_lengthr[  body_encoder  )r7   r8   sizebsizes       r:   test_lenTestBase64.test_len  s    
:##G,z%%hB78	:"IDQUQUQURURU%'Uz''d
3U; r=   c                     U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        g )Nr+   r=   zaGVsbG8=ra  )r3   r   r^   r  s     r:   test_decodeTestBase64.test_decode  s7    
:R #&
:Z((3r=   c                 <   U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        U" [        R                  " S5      S5        U" [        R                  " SSS	9S
5        U" [        R                  " SSSS9S5        g )Nr=   r+   ra  z	aGVsbG8=
s   hello
z	aGVsbG8K
sd   xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx (   r  zeHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IA==
r   r  rc  zeHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
eHh4eCB4eHh4IA==
)r3   r   rh  r  s     r:   test_encodeTestBase64.test_encode"  s    
:!!#&+
:!!(+\:
:!!*-|<
:!!-B? B 	 	:!!-BFK	r=   c                     U R                   n[        R                  nU" U" S5      S5        U" U" S5      S5        U" U" S5      S5        U" U" SSS9S	5        U" U" S5      S5        g )
Nr`  z=?iso-8859-1?b?aGVsbG8=?=hello
worldz!=?iso-8859-1?b?aGVsbG8NCndvcmxk?=hello
worldz!=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=r|   r  z=?iso-8859-2?b?aGVsbG8=?=)r3   r   rM  )r7   r8   hes      r:   test_header_encodeTestBase64.test_header_encode8  sj    %%
2g;34
2!DE
2nBC
2g|,.IJ
2nBCr=   rK  N)	rL  rM  rN  rO  rk  rn  rs  ry  rP  rK  r=   r:   r^  r^    s    <4
,Dr=   r^  c                      \ rS rSrS rS rS rS rS rS r	SGS	 jr
S
 rS rS rS rS rS rS rS rS rS rS rSGS jrS rS rS rS rS rS rS rS rS rS r S  r!S! r"S" r#S# r$S$ r%S% r&S& r'S' r(S( r)S) r*S* r+S+ r,S, r-SHS- jr.S. r/S/ r0S0 r1S1 r2S2 r3S3 r4S4 r5S5 r6S6 r7S7 r8S8 r9S9 r:S: r;S; r<S< r=S= r>S> r?S? r@S@ rASA rBSB rCSC rDSD rESE rFSFrGg)I
TestQuopriiC  c                    [        [        [        [        S5      [        S5      S-   5      [        [        S5      [        S5      S-   5      [        [        S5      [        S5      S-   5      S S	 5       5      5      U l        [        S
5       Vs/ s H  oU R                  ;  d  M  UPM     snU l        [        U R                  5      [        U R
                  5      -   S
:X  d   e[        [        [        S5      [        S5      S-   5      5      U l        U R                  R                  [        S5      5        U R                  R                  [        S5      5        [        S
5       Vs/ s H  oU R                  ;  d  M  UPM     snU l
        [        U R                  5      [        U R                  5      -   S
:X  d   eg s  snf s  snf )Nr  zr   r  Zr  9c              3   $   #    U  H  ov   M     g 7frn   rK  )r  r  s     r:   r  #TestQuopri.setUp.<locals>.<genexpr>K  s     !1Qr  s   !*+-/   r,   ~r~  =)r  r   r  ordhlithnonr[  blitr  removebnonr7   r  s     r:   r3  TestQuopri.setUpD  sJ    #c(CHqL)#c(CHqL)#c(CHqL)!!	# $	 !&c
A
1tyy.@Q
A	499~DII.#555 s3xSA67			T#		S" !&c
A
1tyy.@Q
A	499~DII.#555 B Bs   F?%F?(G?Gc                    U R                    H5  nU R                  [        R                  " U5      S[	        U5      -  5        M7     U R
                   H5  nU R                  [        R                  " U5      S[	        U5      -  5        M7     g )Nz'Should not be header quopri encoded: %sz#Should be header quopri encoded: %s)r  r  r"   header_checkchrr  r  r  s     r:   test_quopri_header_check#TestQuopri.test_quopri_header_checkZ  sn    AZ44Q7ACFJL  AOOJ33A6ACFJL r=   c                    U R                    H5  nU R                  [        R                  " U5      S[	        U5      -  5        M7     U R
                   H5  nU R                  [        R                  " U5      S[	        U5      -  5        M7     g )Nz%Should not be body quopri encoded: %sz!Should be body quopri encoded: %s)r  r  r"   
body_checkr  r  r  r  s     r:   test_quopri_body_check!TestQuopri.test_quopri_body_checkb  sn    AZ2215?#a&HJ  AOOJ11!4?#a&HJ r=   c           	         U R                   nU" [        R                  " S5      S5        U" [        [        R                  " SSS95      [        R                  " S5      S-   5        U" [        R                  " S5      S5        U" [        [        R                  " SSS95      [        R                  " S5      S-   5        U R
                   H7  nU" [        R                  " [        U/5      5      SS	[        U5      -  5        M9     U R                   HH  nU[        S
5      :X  a  M  U" [        R                  " [        U/5      5      SS[        U5      -  5        MJ     U" [        R                  " S5      S5        g )Nra  r  xxxr  r  s
   h@e@l@l@o@rf  r   zexpected length 1 for %rr,   r   zexpected length 3 for %r    )
r3   r"   rg  r[  rM  r  r  r  r  r  r7   r8   r  s      r:   test_header_quopri_len!TestQuopri.test_header_quopri_lenj  s4   
:##H-q1
3z''%@A##H-	 	:##M2B7
3z''uEF##M2	 Az''qc
3Q)CF24  ACH}z''qc
3Q)CF24	  	:##D)1-r=   c                    U R                   nU R                   H*  nU" [        R                  " [	        U/5      5      S5        M,     U R
                   H*  nU" [        R                  " [	        U/5      5      S5        M,     g )Nr   r   )r3   r  r"   body_lengthr  r  r  s      r:   test_body_quopri_lenTestQuopri.test_body_quopri_len  s_    Az%%eQCj115 Az%%eQCj115 r=   c                     [        S5       HH  n[        U5      nU R                  [        R                  " [        R
                  " U5      5      U5        MJ     g )Nr  )r  r  r3   r"   rQ  quote)r7   r   r  s      r:   test_quote_unquote_idempotent(TestQuopri.test_quote_unquote_idempotent  s?    sAAAZ//
0@0@0CDaH r=   Nc                     Uc  [         R                  " U5      nO[         R                  " X5      nU R                  XB5        g rn   )r"   rM  r3   )r7   r   expected_encoded_headerrC   encoded_headers        r:   _test_header_encodeTestQuopri._test_header_encode  s5    ?'55f=N'55fFNAr=   c                 (    U R                  SS5        g )Nr=   r+   r  r2  s    r:   test_header_encode_null"TestQuopri.test_header_encode_null  s      b)r=   c                 (    U R                  SS5        g )Nra  z=?iso-8859-1?q?hello?=r  r2  s    r:   test_header_encode_one_word&TestQuopri.test_header_encode_one_word  s      +CDr=   c                 (    U R                  SS5        g )Ns   hello
worldz=?iso-8859-1?q?hello=0Aworld?=r  r2  s    r:   test_header_encode_two_lines'TestQuopri.test_header_encode_two_lines  s       @	Br=   c                 (    U R                  SS5        g )Ns   hellotherez=?iso-8859-1?q?hello=C7there?=r  r2  s    r:   test_header_encode_non_ascii'TestQuopri.test_header_encode_non_ascii  s      !2 @	Br=   c                 &    U R                  SSSS9  g )Nra  z=?iso-8859-2?q?hello?=r|   r  r  r2  s    r:   test_header_encode_alt_charset)TestQuopri.test_header_encode_alt_charset  s      +C$ 	! 	&r=   c                 R    [         R                  " U5      nU R                  X25        g rn   )r"   header_decoder3   )r7   r  expected_decoded_headerdecoded_headers       r:   _test_header_decodeTestQuopri._test_header_decode  s     #11.AAr=   c                 (    U R                  SS5        g Nr+   r  r2  s    r:   test_header_decode_null"TestQuopri.test_header_decode_null  s      R(r=   c                 (    U R                  SS5        g Nr`  r  r2  s    r:   test_header_decode_one_word&TestQuopri.test_header_decode_one_word  s      '2r=   c                 (    U R                  SS5        g )Nzhello=0Aworldrw  r  r2  s    r:   test_header_decode_two_lines'TestQuopri.test_header_decode_two_lines  s      .Ar=   c                 (    U R                  SS5        g )Nzhello=C7thereu   helloÇtherer  r2  s    r:   test_header_decode_non_ascii'TestQuopri.test_header_decode_non_ascii  s      2BCr=   c                 P    U R                  [        R                  " S5      S5        g )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)r3   r"   r  r2  s    r:   test_header_decode_re_bug_18380*TestQuopri.test_header_decode_re_bug_18380  s    11+>	Jr=   c                     Uc  [         R                  " U5      nO[         R                  " XS9nU R                  XB5        g )Nrb  )r"   r^   r3   )r7   encodedexpected_decodedrc  decodeds        r:   _test_decodeTestQuopri._test_decode  s5    ; ''0G ''9G3r=   c                 (    U R                  SS5        g r  r  r2  s    r:   test_decode_null_word TestQuopri.test_decode_null_word      "b!r=   c                 (    U R                  SS5        g )Nr   r*   r  r2  s    r:   test_decode_null_line_null_word*TestQuopri.test_decode_null_line_null_word  s    &$'r=   c                 (    U R                  SS5        g r  r  r2  s    r:   test_decode_one_wordTestQuopri.test_decode_one_word  s    '7+r=   c                 &    U R                  SSSS9  g )Nr`  Xrb  r  r2  s    r:   test_decode_one_word_eol#TestQuopri.test_decode_one_word_eol  s    '74r=   c                 (    U R                  SS5        g Nhello
hello
r  r2  s    r:   test_decode_one_lineTestQuopri.test_decode_one_line      +y1r=   c                 (    U R                  SS5        g Nr  r  r2  s    r:   test_decode_one_line_lf"TestQuopri.test_decode_one_line_lf      )Y/r=   c                 (    U R                  SS5        g )Nzhellor  r  r2  s    r:   test_decode_one_line_cr"TestQuopri.test_decode_one_line_cr  r  r=   c                 &    U R                  SSSS9  g )Nr  helloXr  rb  r  r2  s    r:   test_decode_one_line_nl"TestQuopri.test_decode_one_line_nl  s    )X37r=   c                 &    U R                  SSSS9  g )Nr  r  r  rb  r  r2  s    r:   test_decode_one_line_crnl$TestQuopri.test_decode_one_line_crnl  s    +xS9r=   c                 (    U R                  SS5        g )Nrv  rw  r  r2  s    r:   test_decode_one_line_one_word(TestQuopri.test_decode_one_line_one_word  s    *N;r=   c                 &    U R                  SSSS9  g )Nrv  helloXworldr  rb  r  r2  s    r:   !test_decode_one_line_one_word_eol,TestQuopri.test_decode_one_line_one_word_eol  s    *MsCr=   c                 (    U R                  SS5        g )Nhello
world
hello
world
r  r2  s    r:   test_decode_two_lines TestQuopri.test_decode_two_lines  s    .0@Ar=   c                 &    U R                  SSSS9  g )Nr	  helloXworldXr  rb  r  r2  s    r:   test_decode_two_lines_eol$TestQuopri.test_decode_two_lines_eol  s    .CHr=   c                 (    U R                  SS5        g )N  SpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamSpamr  r2  s    r:   test_decode_one_long_line$TestQuopri.test_decode_one_long_line  s    ,5r=   c                 (    U R                  SS5        g )Nr,   r+   r  r2  s    r:   test_decode_one_space TestQuopri.test_decode_one_space  s    #r"r=   c                 (    U R                  SS5        g )Nz     r+   r  r2  s    r:   test_decode_multiple_spaces&TestQuopri.test_decode_multiple_spaces  s    '2&r=   c                 (    U R                  SS5        g )Nzhello    
r  r  r2  s    r:   $test_decode_one_line_trailing_spaces/TestQuopri.test_decode_one_line_trailing_spaces  s    /95r=   c                 (    U R                  SS5        g )Nzhello    
world   
r	  r  r2  s    r:   %test_decode_two_lines_trailing_spaces0TestQuopri.test_decode_two_lines_trailing_spaces  s    57GHr=   c                 (    U R                  SS5        g )Nz=22quoted=20words=22z"quoted words"r  r2  s    r:   test_decode_quoted_word"TestQuopri.test_decode_quoted_word  s    02BCr=   c                 (    U R                  SS5        g )Nzab=CD=EF   abÍïr  r2  s    r:   test_decode_uppercase_quoting(TestQuopri.test_decode_uppercase_quoting      *l3r=   c                 (    U R                  SS5        g )Nzab=cd=efr"	  r  r2  s    r:   test_decode_lowercase_quoting(TestQuopri.test_decode_lowercase_quoting  r%	  r=   c                 (    U R                  SS5        g )Nzsoft line=
breakzsoft linebreakr  r2  s    r:   test_decode_soft_line_break&TestQuopri.test_decode_soft_line_break  s    /1ABr=   c                 (    U R                  SS5        g )NzA=1,B=A ==> A+B==2r  r2  s    r:   test_decode_false_quoting$TestQuopri.test_decode_false_quoting  s    .0DEr=   c                     0 nUc  SnOX5S'   Uc  SnOXES'   [         R                  " U40 UD6nU R                  Xb5        US:X  d  US:X  a3  UR                  5        H  nU R	                  [        U5      U5        M      g g )NrV  r  r*   rc  r   )r"   rh  r3   r  rY  r[  )r7   rx  expected_encoded_bodyr  rc  kwargsencoded_bodyrz  s           r:   _test_encodeTestQuopri._test_encode  s    J#-< ;C5M!--d=f==$;#- %//1$$SY
; 2 (r=   c                 (    U R                  SS5        g r  r3	  r2  s    r:   test_encode_nullTestQuopri.test_encode_null  r  r=   c                 (    U R                  SS5        g )Nz

r6	  r2  s    r:   test_encode_null_lines!TestQuopri.test_encode_null_lines  s    &&)r=   c                 (    U R                  SS5        g r  r6	  r2  s    r:   test_encode_one_lineTestQuopri.test_encode_one_line"  r  r=   c                 (    U R                  SS5        g r  r6	  r2  s    r:   test_encode_one_line_crlf$TestQuopri.test_encode_one_line_crlf%  r  r=   c                 &    U R                  SSSS9  g )Nr  r  r   rb  r6	  r2  s    r:   test_encode_one_line_eol#TestQuopri.test_encode_one_line_eol(  s    )[f=r=   c                 b    U R                  SR                  S5      R                  S5      SSS9  g )Nu   helloυ
r[   latin1zhello=CF=85
r   rb  )r3	  r   r^   r2  s    r:   (test_encode_one_line_eol_after_non_ascii3TestQuopri.test_encode_one_line_eol_after_non_ascii+  s2    /009@@J+ 	 	9r=   c                 (    U R                  SS5        g )Nr,   z=20r6	  r2  s    r:   test_encode_one_space TestQuopri.test_encode_one_space0  s    #u%r=   c                 (    U R                  SS5        g )Nz 
z=20
r6	  r2  s    r:   test_encode_one_line_one_space)TestQuopri.test_encode_one_line_one_space3  s    %)r=   c                 (    U R                  SS5        g )Nz 
 
z=20
=20
r6	  r2  s    r:   test_encode_two_lines_one_space*TestQuopri.test_encode_two_lines_one_space;  s    (L1r=   c                 (    U R                  SS5        g )Nzhello   z
hello  =20r6	  r2  s    r:   $test_encode_one_word_trailing_spaces/TestQuopri.test_encode_one_word_trailing_spaces>  r%	  r=   c                 (    U R                  SS5        g )Nz	hello   
zhello  =20
r6	  r2  s    r:   $test_encode_one_line_trailing_spaces/TestQuopri.test_encode_one_line_trailing_spacesA  s    ,7r=   c                 (    U R                  SS5        g )Nzhello  	z
hello  =09r6	  r2  s    r:   !test_encode_one_word_trailing_tab,TestQuopri.test_encode_one_word_trailing_tabD  s    +|4r=   c                 (    U R                  SS5        g )Nz	hello  	
zhello  =09
r6	  r2  s    r:   !test_encode_one_line_trailing_tab,TestQuopri.test_encode_one_line_trailing_tabG  s    -8r=   c                 &    U R                  SSSS9  g )N
abcd 
1234zabcd =

1234r  r  r6	  r2  s    r:   ,test_encode_trailing_space_before_maxlinelen7TestQuopri.test_encode_trailing_space_before_maxlinelenJ  s    -)9aHr=   c                 &    U R                  SSSS9  g )Nr_	  zabcd=
=20
1234r  r  r6	  r2  s    r:   (test_encode_trailing_space_at_maxlinelen3TestQuopri.test_encode_trailing_space_at_maxlinelenM      -);Jr=   c                 &    U R                  SSSS9  g )Nr_	  zabc=
d=20
1234r   r  r6	  r2  s    r:   ,test_encode_trailing_space_beyond_maxlinelen7TestQuopri.test_encode_trailing_space_beyond_maxlinelenP  re	  r=   c                 (    U R                  SS5        g )Nz
 
 
 
 
 
z=20
=20
=20
=20
=20
r6	  r2  s    r:   test_encode_whitespace_lines'TestQuopri.test_encode_whitespace_linesS  s    )[1r=   c                 (    U R                  SS5        g )Nza = bza =3D br6	  r2  s    r:   test_encode_quoted_equals$TestQuopri.test_encode_quoted_equalsV  s    '9-r=   c                 (    U R                  SS5        g )Ndxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxr6	  r2  s    r:   test_encode_one_long_string&TestQuopri.test_encode_one_long_stringY  s    )%@Ar=   c                 (    U R                  SS5        g )Nzexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zgxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxx
r6	  r2  s    r:   test_encode_one_long_line$TestQuopri.test_encode_one_long_line\  s    *,NOr=   c                 (    U R                  SS5        g )Nzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
r6	  r2  s    r:   test_encode_one_very_long_line)TestQuopri.test_encode_one_very_long_line_  s    *8	:r=   c                 &    U R                  SSSS9  g )Nz=====z=3D=
=3D=
=3D=
=3D=
=3Dr   r  r6	  r2  s    r:   test_encode_shortest_maxlinelen*TestQuopri.test_encode_shortest_maxlinelenc  s    '#7AFr=   c                 F    U R                  [        U R                  SSSS9  g )Nr+   r   r  )r   r  r3	  r2  s    r:    test_encode_maxlinelen_too_small+TestQuopri.test_encode_maxlinelen_too_smallf  s!    *d&7&7RANr=   c                 v   U R                   nU" [        R                  " S5      S5        U" [        R                  " S5      S5        U" [        R                  " S5      S5        U" [        R                  " SSS9S5        U" [        R                  " SSS	S
9S5        U" [        R                  " S5      S5        g )Nr+   r`  rv  rw  dxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx rq  r  zjxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=
 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=
x xxxx xxxx xxxx xxxx=20r   rr  zlxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=
 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=
x xxxx xxxx xxxx xxxx=20zone line

two line)r3   r"   rh  r  s     r:   rs  TestQuopri.test_encodei  s    
:!!"%r*
:!!'*G4
:!!"23^D
:!!,2> A 	
 	:!!,26J	
 	:!! # 	r=   )r  r  r  r  rn   )NN)HrL  rM  rN  rO  r3  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	  r	  r	  r	  r	  r	  r	  r	  r#	  r'	  r*	  r-	  r3	  r7	  r:	  r=	  r@	  rC	  rG	  rJ	  rM	  rP	  rS	  rV	  rY	  r\	  r`	  rc	  rg	  rj	  rm	  rq	  rt	  rw	  rz	  r}	  rs  rP  rK  r=   r:   r|  r|  C  sj   6,LJ.26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                   ,    \ rS rSrS rS rS rS rSrg)TestCharseti  c                 L    SSK Jn   UR                  S	 g ! [         a     g f = f)Nr   r  fake)r   rC   CHARSETSr  )r7   CharsetModules     r:   tearDownTestCharset.tearDown  s*    2	&&v. 		s    
##c                     U R                   n[        S5      nU" UR                  S5      S5        SnU R                  [        UR                  U5        [        S5      nU" UR                  U5      S5        g )NrQ   Hello World!u   ¤¢¤¤¤¦¤¨¤ªr[   z(=?utf-8?b?wqTCosKkwqTCpMKmwqTCqMKkwqo=?=)r3   r
   rM  r   r]  )r7   r8   r  r   s       r:   test_codec_encodeable!TestCharset.test_codec_encodeable  sc    J
1??>*N;6,;G
1??1IJr=   c                    U R                   n[        S5      nU" SUR                  S5      5        [        S5      nU" SUR                  S5      5        [        S5      nU" SUR                  S5      5        [        S	5      nS
SKJn  UR                  SUR                  S S5        [        S5      nU" SUR                  S5      5        g )Nr?   zhello w=F6rldu   hello wörldr[   r  r   rQ   rf  rl  r   r  r	  )r3   r
   rh  r   rC   add_charsetQP)r7   r8   r  r	  s       r:   test_body_encodeTestCharset.test_body_encode  s    L!
?AMM*:;<G
~!>?J
=!--67H 	3!!&-*:*:D'JFO
=!--67r=   c                     [        S5      nU R                  [        U5      S5        U R                  [        R
                  [         S5        g )NrQ   u   ascÿii)r
   r3   r   r   r    CharsetErrorr  s     r:   test_unicode_charset_name%TestCharset.test_unicode_charset_name  s8    *%Wz2&--wDr=   rK  N)	rL  rM  rN  rO  r	  r	  r	  r	  rP  rK  r=   r:   r	  r	    s    	K8>Er=   r	  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSrg)
TestHeaderi  c                     U R                   n[        S5      nU" UR                  5       S5        UR                  S5        U" UR                  5       S5        g )Nr	  z Goodbye World!zHello World!  Goodbye World!rx  r   r   r  r  s      r:   test_simpleTestHeader.test_simple  sE    "">"
188:~&	"#
188:56r=   c                     U R                   n[        S5      nU" UR                  5       S5        UR                  S5        U" UR                  5       S5        g )Nr	  zGoodbye World!zHello World! Goodbye World!r	  r  s      r:   test_simple_surpriseTestHeader.test_simple_surprise  sE    "">"
188:~&	!"
188:45r=   c                 D    SnU R                  [        U5      US 4/5        g )Nzno decoding neededr  r  s     r:   test_header_needs_no_decoding(TestHeader.test_header_needs_no_decoding  s"     q)QI;7r=   c                     [        SSS9nUR                  SS9R                  S5       H  nU R                  [	        U5      S5        M      g )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.rV  r  r,   )
splitcharsz
 )r   r   r   rY  r[  )r7   r  ls      r:   	test_longTestHeader.test_long  sI      L "S)//6A  Q, 7r=   c                    U R                   n[        S5      n[        S5      n[        S5      nSnSnSn[        XR5      nUR                  Xc5        UR                  Xt5        UR	                  SS9n	U" U	S	5        [        U	5      n
U" [        U
5      S
5        U" U
S   US45        U" U
S   US45        U" U
S   UR	                  S5      S45        [        U5      nU" USR                  S5      5        [        [        U	5      5      nU" X5        g )Nr?   r|   r[   r  r  r  rV  r  a  =?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   r   r   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.」と言っています。)
rx  r
   r   r  r   r   r[  r   r^   r   )r7   r8   r   r  r  r  r  r  r  encr  ustrnewhs                r:   test_multilingualTestHeader.test_multilingual  s   ""L!\"wB$0	 6		!hh"h%
3 ) 	*  $
3w<
71:-.
71:./
71:	((17;<1v
4D  fWo#	& =-.
4r=   c                 X    [        5       nU R                  UR                  5       S5        g r  r  r  s     r:   test_empty_header_encode#TestHeader.test_empty_header_encode  s    HR(r=   c                     U R                   n[        5       nU" US5        UR                  S[        S5      5        U" US5        g )Nr+   r   r?   )rx  r   r  r
   r  s      r:   test_header_ctor_default_args(TestHeader.test_header_ctor_default_args  s9    ""H
1b		-.
1er=   c                 V   U R                   nSn[        U5      nU" UR                  5       S5        U" [        U5      U5        [        USS9nU" UR                  5       S5        U" [        U5      U5        [        USSS9nU" UR                  5       U5        U" [        U5      U5        g )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<  r  z}A very long line that must get split to something other than at the
 76th character boundary to test the non-default behaviori   )r  r  )rx  r   r   r   r  s       r:   test_explicit_maxlinelen#TestHeader.test_explicit_maxlinelen"  s    "" 4L
188: 8 	9 	3q644Y/
188: = 	> 	3q644Di@
188:t
3q64r=   c           
         U R                   n[        SSS9nSnUR                  U5        UR                  5       nU" US5        U" U[	        [        [        U5      5      5      5        [        SSS9nUR                  S5        UR                  5       nU" US5        U" U[	        [        [        U5      5      5      5        g )Nr?   rf  rC   r  r	  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?_?=rq  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_?=rx  r   r  r   r   r   r   r7   r8   r  r   r   s        r:   test_quopri_splittable!TestHeader.test_quopri_splittable5  s    ""<B7	HHJ
1 2 2	f 	1c+mA./01<B7	HHJ
1 ! 	" 	1c+mA./01r=   c           
         U R                   n[        SSS9nSnUR                  U5        UR                  5       nU" US5        U" U[	        [        [        U5      5      5      5        [        SSS9nUR                  U5        UR                  5       nU" US5        U" U[	        [        [        U5      5      5      5        g )Nr}   rf  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==?=rq  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        r:   test_base64_splittable!TestHeader.test_base64_splittablez  s    ""83	HHJ
1 " "	F 	1c+mA./0183	HHJ
1 " 	# 	1c+mA./01r=   c                     U R                   nSn[        U5      nU" US/5        [        U5      nU" X$R                  5       5        g )Nr`  )r`  Nr3   r   r   r   )r7   r8   r   r   r  s        r:   test_us_ascii_headerTestHeader.test_us_ascii_header  s@    !
1 N
1hhjr=   c                 f    U R                   n[        5       nUR                  SS5        U" US5        g )Nr`  r?   )r3   r   r  r  s      r:   test_string_charsetTestHeader.test_string_charset  s+    H	,'
1gr=   c                     U R                   n[        SS5      nU" UR                  5       S5        [        SS5      nU" UR                  5       S5        g )Nr  r[   z=?utf-8?q?p=C3=B6stal?=u   菊地時夫z=?utf-8?b?6I+K5Zyw5pmC5aSr?=r3   r   r   r  s      r:   test_utf8_shortestTestHeader.test_utf8_shortest  sH    ;(
188:01-w7
188:56r=   c           	      <   U R                   nU R                  nSnU" [        [        U5        [        5       nU" [        UR                  U5        UR                  SS5      nU" [        [        USS95      U5        UR	                  USS9  U" [        U5      U5        g )N0   Ynwp4dUEbay Auction Semiar- No Charge  Earn Bigr[   r  r   )r   r3   r]  r   r  r^   r   )r7   r  r8   r   r  es         r:   test_bad_8bit_headerTestHeader.test_bad_8bit_header  s    ""B|VQ'H|QXXq)HHWi(
3va	*+Q/	9%
3q61r=   c                 
   SnUR                  SS5      n[        U[        R                  R                  S9nU R                  [        U5      S5        U R                  [        R                  R                  U5      US4/5        g )Nr	  r   surrogateescaper  2   Ynwp4dUEbay Auction Semiar- No Charge � Earn Bigunknown-8bit)	r^   r   r   rC   UNKNOWN8BITr3   r   r   r   )r7   r   r	  r  s       r:   test_escaped_8bit_header#TestHeader.test_escaped_8bit_header  sm    BHHW/01emm778QO	Q33A6!^9L8MNr=   c                     Sn[        U[        R                  R                  S9nU R	                  [        U5      S5        U R	                  [        R                  R                  U5      US4/5        g Nr	  r  r	  r	  )r   r   rC   r	  r3   r   r   r   )r7   r   r  s      r:   &test_header_handles_binary_unknown8bit1TestHeader.test_header_handles_binary_unknown8bit  s\    B1emm778QO	Q33A6!^9L8MNr=   c                 ^   Sn[        U[        R                  R                  S9n[        R                  R                  [        R                  R                  U5      5      nU R                  [        U5      S5        U R                  [        R                  R                  U5      US4/5        g r	  )	r   r   rC   r	  r   r   r   r3   r   )r7   r   r  h2s       r:   +test_make_header_handles_binary_unknown8bit6TestHeader.test_make_header_handles_binary_unknown8bit  s    B1emm778\\%%ell&@&@&CDRO	Q33B71n:M9NOr=   c                     [        S5      n[        R                  R                  U5      nUR	                  S5        U R                  [        U5      S5        g )Nr  )r   test2)r   r   r   r   r  r3   r   )r7   r  r[  s      r:   0test_modify_returned_list_does_not_change_header;TestHeader.test_modify_returned_list_does_not_change_header  s@    6N++A.()Q(r=   c                     U R                   n[        5       nUR                  SS5        UR                  S5        UR                  5       nU" US5        [	        [        U5      5      nU" UR                  5       U5        g )Nr`  r?   worldz=?iso-8859-1?q?hello?= world)r3   r   r  r   r   r   )r7   r8   r  r   s       r:    test_encoded_adjacent_nonencoded+TestHeader.test_encoded_adjacent_nonencoded  sc    H	,'	HHJ
1,-a()
188:qr=   c                     U R                   nSn[        U5      nU" U/ SQ5        [        U5      nU" UR                  5       S5        g )NzGSubject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.))s	   Subject: N)s     r}   )s    zz.Nz6Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.r	  )r7   r8   r   partshdrs        r:   test_whitespace_keeper!TestHeader.test_whitespace_keeper  sK    Ua 
5  Y  	Z% 
3::<C	Er=   c                 X    U R                   nSnU" [        R                  [        U5        g )NzXSubject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3I ?=)r   r    r   r   )r7   r  r   s      r:   test_broken_base64_header$TestHeader.test_broken_base64_header
  s$    ""fv&&q9r=   c                 X    [        SSS9nU R                  UR                  5       S5        g )Nr  	shift_jisr  r  r  r  s     r:   test_shift_jis_charset!TestHeader.test_shift_jis_charset  s%    5+.%EFr=   c                 f    [         R                  " S5      nU R                  [        U5      S5        g )NzEmptyHeader:zEmptyHeader: 

)r   r  r3   r   rp   s     r:   !test_flatten_header_with_no_value,TestHeader.test_flatten_header_with_no_value  s)     ''7S#67r=   c                 X    [        5       nSUS'   U R                  [        U5      S5        g )Nz   value with leading ws
SomeHeaderz&SomeHeader:    value with leading ws

)r   r3   r   rp   s     r:   )test_encode_preserves_leading_ws_on_value4TestHeader.test_encode_preserves_leading_ws_on_value  s(    i6LS#MNr=   c                 V    U R                  [        S5      R                  5       S5        g )Nr,   r	  r2  s    r:   test_whitespace_header!TestHeader.test_whitespace_header  s    ++-s3r=   rK  N)rL  rM  rN  rO  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	  rP  rK  r=   r:   r	  r	    s    768-=~)&C2J42l7
OOP)E:
G8O
4r=   r	  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"g!)"TestRFC2231i%  c                     U R                   nU R                  S5      nU" UR                  S5      S5        U" UR                  SSS9S5        g )Nz
msg_29.txtr  rQ   r	  %This is even more ***fun*** isn't it!FrP  )rQ   r	  z'"This is even more ***fun*** isn't it!")r3   r4   rK   r6   s      r:   rI  TestRFC2231.test_get_param)  sM    ll<(
3==!G	I
3==%=0I	Kr=   c                 H   U R                   n[        5       nUR                  SSSS9  U" UR                  S5      S5        UR                  SSSSS9  U" UR                  S5      S5        U R	                  S	5      nUR                  SSSSS9  U" UR                  S
S9S5        g )Nr  r
  rQ   r  )rQ   r+   r
  r	  rC   languager 
  r   r  r  a"  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
)rx  r   rc  rK   r4   r   r6   s      r:   rd  TestRFC2231.test_set_param1  s    ""igG( 	 	*
3==!E	GgG(4 	 	9
3==!G	Ill<(gG(4 	 	9
3==b=) , 	r=   c                     [        5       nUR                  SS5        U R                  US   S5        UR                  SSSS9  U R                  US   S5        UR                  SS	SS9  U R                  US   S
5        g )Nr  r   rB   ztext/plain; title="foo"r9  F)requoteztext/plain; title=barz	(bar)bellztext/plain; title="(bar)bell")r   rc  r3   rp   s     r:   test_set_param_requote"TestRFC2231.test_set_param_requoteV  s}    igu%^,.GHgue4^,.EFg{E:^,.MNr=   c                     U R                   nU R                  S5      nUR                  SSSSS9  UR                  SSSSS9  UR                  SS	S
9  U" UR	                  SS9S5        g )Nr   r   r9  rQ   r	  r
  r  r
  rF   r7  r  r  a$  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
)rx  r4   rc  rn  r   r6   s      r:   rp  TestRFC2231.test_del_param`  st    ""ll<(eUJFgG 	 	/eN3
3==b=) , 	r=   c                 l    U R                   nU R                  S5      nU" UR                  5       S5        g )Nr  rQ   )r3   r4   get_content_charsetr6   s      r:    test_rfc2231_get_content_charset,TestRFC2231.test_rfc2231_get_content_charset  s.    ll<(
3""$j1r=   c                     [         R                  " S5      n[        R                  " U5      nU R	                  UR                  5       S5        U R	                  XR                  5       5        g )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  r3   r   r   r  s      r:   test_rfc2231_parse_rfc_quoting*TestRFC2231.test_rfc2231_parse_rfc_quoting  X    OO   ''*))+D	FMMO,r=   c                     [         R                  " S5      n[        R                  " U5      nU R	                  UR                  5       S5        U R	                  XR                  5       5        g )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"

            r
  r
  r  s      r:    test_rfc2231_parse_extra_quoting,TestRFC2231.test_rfc2231_parse_extra_quoting  r
  r=   c                     Sn[         R                  " U5      nUR                  S5      nU R                  U[        5        U R                  US5        g )Na  Content-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  rK   assertNotIsInstancetupler3   r7   r  r9   params       r:   #test_rfc2231_no_language_or_charset/TestRFC2231.test_rfc2231_no_language_or_charset  sN     ''*f%  .[	]r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g NzContent-Disposition: inline;
	filename*0*="''This%20is%20even%20more%20";
	filename*1*="%2A%2A%2Afun%2A%2A%2A%20";
	filename*2="is it not.pdf"

r
  r)  r  s      r:   /test_rfc2231_no_language_or_charset_in_filename;TestRFC2231.test_rfc2231_no_language_or_charset_in_filename  8     ''*))+D	Fr=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g r$
  r)  r  s      r:   7test_rfc2231_no_language_or_charset_in_filename_encodedCTestRFC2231.test_rfc2231_no_language_or_charset_in_filename_encoded  r'
  r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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.pdfr)  r  s      r:   test_rfc2231_partly_encoded'TestRFC2231.test_rfc2231_partly_encoded  s9     ''*?	Ar=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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.pdfr)  r  s      r:   test_rfc2231_partly_nonencoded*TestRFC2231.test_rfc2231_partly_nonencoded  s9     ''*M	Or=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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"

r
  r1  r  s      r:   /test_rfc2231_no_language_or_charset_in_boundary;TestRFC2231.test_rfc2231_no_language_or_charset_in_boundary  r'
  r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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  r3   r
  r  s      r:   .test_rfc2231_no_language_or_charset_in_charset:TestRFC2231.test_rfc2231_no_language_or_charset_in_charset  s8     ''*002D	Fr=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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"

r
  r)  r  s      r:   %test_rfc2231_bad_encoding_in_filename1TestRFC2231.test_rfc2231_bad_encoding_in_filename  r'
  r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S 5        g )Nz:Content-Type: text/plain; charset*=bogus''utf-8%E2%80%9D

r5
  r  s      r:   $test_rfc2231_bad_encoding_in_charset0TestRFC2231.test_rfc2231_bad_encoding_in_charset  6     ''* 	002D9r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S 5        g )Nz:Content-Type: text/plain; charset*=ascii''utf-8%E2%80%9D

r5
  r  s      r:   %test_rfc2231_bad_character_in_charset1TestRFC2231.test_rfc2231_bad_character_in_charset  r>
  r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzContent-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�r)  r  s      r:   &test_rfc2231_bad_character_in_filename2TestRFC2231.test_rfc2231_bad_character_in_filename#  s8     ''*))+J	Lr=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )Nz^Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename*=X-UNKNOWN''myfile.txt


myfile.txtr)  r  s      r:   test_rfc2231_unknown_encoding)TestRFC2231.test_rfc2231_unknown_encoding/  4    
 ''*))+\:r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )Nuc   Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename*=utf-8''myfile.txt

rF
  r)  r  s      r:   &test_rfc2231_bad_character_in_encoding2TestRFC2231.test_rfc2231_bad_character_in_encoding8  rI
  r=   c                     U R                   nSn[        R                  " U5      nUR                  S5      u  pEnU" US 5        U" US 5        U" US5        g )NzJContent-Type: application/x-foo;
	name*0*="Frank's"; name*1*=" Document"

rL  Frank's DocumentrH  r7   r8   r  r9   rC   r
  r   s          r:   -test_rfc2231_single_tick_in_filename_extended9TestRFC2231.test_rfc2231_single_tick_in_filename_extendedA  sX    
 ''*"}}V41
7D
8T
1 !r=   c                     Sn[         R                  " U5      nUR                  S5      nU R                  U[        5        U R                  US5        g )NzGContent-Type: application/x-foo; name*0="Frank's"; name*1=" Document"

rL  rN
  r
  r
  s       r:   $test_rfc2231_single_tick_in_filename0TestRFC2231.test_rfc2231_single_tick_in_filenameO  sJ     ''*f%  . 23r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzAContent-Disposition: inline;
	filename*0*="'This%20is%20broken";
z'This is brokenr)  r  s      r:   test_rfc2231_missing_tick%TestRFC2231.test_rfc2231_missing_tickY  s8     ''*	r=   c                 t    Sn[         R                  " U5      nU R                  UR                  5       S5        g )NzAContent-Disposition: inline;
	filename*0*="'This%20is%E2broken";
u   'This is�brokenr)  r  s      r:   0test_rfc2231_missing_tick_with_encoded_non_ascii<TestRFC2231.test_rfc2231_missing_tick_with_encoded_non_asciic  s8     ''*"	$r=   c                     U R                   nSn[        R                  " U5      nUR                  S5      u  pEnU" US5        U" US5        U" US5        g )NzYContent-Type: application/x-foo;
	name*0*="us-ascii'en-us'Frank's"; name*1*=" Document"

rL  rQ   en-usrN
  rH  rO
  s          r:   !test_rfc2231_tick_attack_extended-TestRFC2231.test_rfc2231_tick_attack_extendedn  sX    
 ''*"}}V41
7J
8W
1 !r=   c                     Sn[         R                  " U5      nUR                  S5      nU R                  U[        5        U R                  US5        g )NzWContent-Type: application/x-foo;
	name*0="us-ascii'en-us'Frank's"; name*1=" Document"

rL  zus-ascii'en-us'Frank's Documentr
  r
  s       r:   test_rfc2231_tick_attack$TestRFC2231.test_rfc2231_tick_attack|  sJ    
 ''*f%  . ABr=   c                 |    U R                   nSn[        R                  " U5      nU" UR                  S5      S5        g )Nz:Content-Type: application/x-foo; name="Frank's Document"

rL  rN
  rH  r$  s       r:   test_rfc2231_no_extended_values+TestRFC2231.test_rfc2231_no_extended_values  s:     ''*
3== "45r=   c                     U R                   nSn[        R                  " U5      nUR                  S5      u  pEnU" US5        U" US5        U" US5        g )NziContent-Type: application/x-foo;
	name*0*="us-ascii'en-us'My";
	name*1=" Document";
	name*2*=" For You"

rL  rQ   r\
  My Document For YourH  rO
  s          r:   ,test_rfc2231_encoded_then_unencoded_segments8TestRFC2231.test_rfc2231_encoded_then_unencoded_segments  X     ''*"}}V41
7J
8W
1#$r=   c                     U R                   nSn[        R                  " U5      nUR                  S5      u  pEnU" US5        U" US5        U" US5        g )NziContent-Type: application/x-foo;
	name*0="us-ascii'en-us'My";
	name*1*=" Document";
	name*2*=" For You"

rL  rQ   r\
  rf
  rH  rO
  s          r:   ,test_rfc2231_unencoded_then_encoded_segments8TestRFC2231.test_rfc2231_unencoded_then_encoded_segments  ri
  r=   c                     SS/nU H1  nU R                  US9   [        R                  " U5      nS S S 5        M3     g ! , (       d  f       ME  = f)NzFrom: 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  )r7   messagesr  r9   s       r:   +test_should_not_hang_on_invalid_ew_messages7TestRFC2231.test_should_not_hang_on_invalid_ew_messages  sL    " A"//2 #" ""s	   =
A	rK  N)#rL  rM  rN  rO  rI  rd  r	
  rp  r
  r
  r
  r!
  r%
  r)
  r,
  r/
  r2
  r6
  r9
  r<
  r@
  rC
  rG
  rK
  rP
  rS
  rV
  rY
  r]
  r`
  rc
  rg
  rk
  ro
  rP  rK  r=   r:   r	  r	  %  s    K#JOB2-- ]
F
FAO
FF
F::
L;;"4$"	C6%"%3r=   r	  c                   2    \ rS rSrS rS rS rS rS rSr	g)	
TestSignedi  c                     [        USS9 nUR                  5       n[        R                  " U5      nS S S 5        X44$ ! , (       d  f       WW4$ = frN  rO  )r7   r!  r   originalr9   s        r:   _msg_and_objTestSigned._msg_and_obj  sM    h1RwwyH++H5C 2 } 21 }s	   '=
Ac                    SS K nUR                  " SUR                  UR                  -  5      nUR	                  U5      R                  S5      nUR	                  U5      R                  S5      nU R                  Xe5        g )Nr   z^--([^\n]+)\n(.*?)\n--\1$r   )rY  rZ  Srk  searchgroupr3   )r7   rt
  resultrY  repartinpartoutparts          r:   _signed_parts_eqTestSigned._signed_parts_eq  sb    8"$$+Fx(..q1--'--a0)r=   c                 l    U R                  S5      u  pUR                  5       nU R                  X5        g r  ru
  r   r
  r7   rt
  r9   r{
  s       r:   test_long_headers_as_string&TestSigned.test_long_headers_as_string  s-    )),7h/r=   c                 j    U R                  S5      u  pUR                  SS9nU R                  X5        g )Nr  <   r  r
  r
  s       r:   (test_long_headers_as_string_maxheaderlen3TestSigned.test_long_headers_as_string_maxheaderlen  s2    )),7B/h/r=   c                     U R                  S5      u  p[        5       n[        U5      R                  U5        UR	                  5       nU R                  X5        g r  )ru
  r   r   r   r   r
  )r7   rt
  r9   r   r{
  s        r:   test_long_headers_flatten$TestSigned.test_long_headers_flatten  sF    )),7Z"c"h/r=   rK  N)
rL  rM  rN  rO  ru
  r
  r
  r
  r
  rP  rK  r=   r:   rr
  rr
    s    *0
0
0r=   rr
  c                       \ rS rSrS rSrg)TestHeaderRegistryi  c                     [        5       nU" SS5      nU R                  UR                  S   [        R                  5        g )Nrs  zattachment; 0*00="foo"r   )r   r  r  r    r  )r7   regr  s      r:   test_HeaderRegistry&TestHeaderRegistry.test_HeaderRegistry  s6    %'?@aiilF,F,FGr=   rK  N)rL  rM  rN  rO  r
  rP  rK  r=   r:   r
  r
    s    Hr=   r
  __main__)grY  r  r\   r  r   ior   r   	itertoolsr   randomr   	threadingr   unittest.mockr	   r   email.policyemail.utilsemail.charsetr
   email.generatorr   r   r   email.headerr   r   r   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.parserr   r   r   r   r    r!   r"   r#   r  r$   test.supportr%   test.support.os_helperr&   test.test_emailr'   r(   r)   r   r,  r  r.   TestCaserR  rv  r0  rK  rs  r  r  r  rF  r  r  rD  rL  r  r(  rW  rp  r  rN  rW  r\  r^  r|  r	  r	  r	  rr
  r
  rL  mainrK  r=   r:   <module>r
     s  
 
              ! G G ; ; / ! 2 & $ & * . 4 $ -        ) ) 3 $	MN] MNd?8$$ ?Fx>m x>zK/x(( K/^/DH%% /Dh7DH%% 7DvXC(++ XCx7A8$$ 7Ax~6M ~6BL1 L1bIH- IHZsKm sKn		J} 	J"Z-] Z-~lH lH`d(M d(N-Am -A`QF- QFhjM jZ- -$3%E$238'G'581D"" 1Dh}"" }D
5E(## 5Eta4 a4La3- a3N0 0BH H zMMO r=   