+
    Bi                    
   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHtHt ^ RIHt ]! 4       t ! R	 R
]	4      t ! R R]	4      t ! R R]4      t]
 ! R R]4      4       t]
 ! R R]4      4       t]
 ! R R]4      4       t]
 ! R R]4      4       t]
 ! R R]4      4       t]
 ! R R]4      4       t]
 ! R R]4      4       t ! R R]	4      t ! R R ]4      t]R!8X  d   ]P@                  ! 4        R# R# )"    N)errorspolicy)Message)TestEmailBaseparameterize)headerregistry)AddressGroup)	ALWAYS_EQc                   r   a  ] tR t^t o R tR t ! R R4      tR t ! R R4      tR t	R	 t
R
 tR tRtV tR# )TestHeaderRegistryc                    \         P                  ! 4       pV! R R4      pV P                  V\         P                  4       V P                  V\         P                  4       R# foobartestNr	   HeaderRegistryassertIsInstance
BaseHeaderUnstructuredHeaderselffactoryhs   &  :/usr/lib/python3.14/test/test_email/test_headerregistry.py test_arbitrary_name_unstructured3TestHeaderRegistry.test_arbitrary_name_unstructured   sH     //1Hf%a!:!:;a!B!BC    c                    \         P                  ! 4       pV P                  R VP                  4       V! R R4      pV P	                  V\         P
                  4       V P	                  V\         P                  4       R# )Subjectr   N)r	   r   assertNotInregistryr   r   UniqueUnstructuredHeaderr   s   &  r   test_name_case_ignored)TestHeaderRegistry.test_name_case_ignored   s^     //1G$4$45Iv&a!:!:;a!H!HIr   c                   &   a  ] tR t^ t o R tRtV tR# )TestHeaderRegistry.FooBasec                    R # N )r   argskws   &*,r   __init__#TestHeaderRegistry.FooBase.__init__!   s    r   r+   N)__name__
__module____qualname____firstlineno__r.   __static_attributes____classdictcell____classdict__s   @r   FooBaser(       s     	 	r   r8   c                    \         P                  ! V P                  R 7      pV! RR4      pV P                  W P                  4       V P                  V\         P                  4       R# ))
base_classr   r   N)r	   r   r8   r   r   r   s   &  r    test_override_default_base_class3TestHeaderRegistry.test_override_default_base_class$   sJ     //4<<HHf%a.a!B!BCr   c                   B    ] tR t^*t]P
                  P                  tRtR# )TestHeaderRegistry.FooDefaultr+   N)r0   r1   r2   r3   r	   r   parser4   r+   r   r   
FooDefaultr>   *   s    1177r   r@   c                    \         P                  ! V P                  R 7      pV! RR4      pV P                  V\         P                  4       V P                  W P                  4       R# )default_classr   r   N)r	   r   r@   r   r   r   s   &  r   test_override_default_class.TestHeaderRegistry.test_override_default_class-   sJ     //dooNHf%a!:!:;a1r   c                    \         P                  ! V P                  R 7      pV! RR4      pV P                  V\         P                  4       V P                  V\         P
                  4       R# )rB   subjectr   N)r	   r   r@   r   r   r$   r   s   &  r   2test_override_default_class_only_overrides_defaultETestHeaderRegistry.test_override_default_class_only_overrides_default3   sN     //dooNIv&a!:!:;a!H!HIr   c                    \         P                  ! R R7      pV! RR4      pV P                  V\         P                  4       V P                  V\         P                  4       R# )F)use_default_maprG   r   Nr   r   s   &  r   test_dont_use_default_map,TestHeaderRegistry.test_dont_use_default_map9   sJ     //FIv&a!:!:;a!B!BCr   c                   \         P                  ! 4       pV! R R4      pVP                  R \         P                  4       V! R R4      pV P	                  V\         P
                  4       V P	                  V\         P                  4       V P	                  V\         P
                  4       V P	                  V\         P                  4       R# r   )r	   r   map_to_typer$   r   r   r   )r   r   h1h2s   &   r   test_map_to_type#TestHeaderRegistry.test_map_to_type?   s     //1Xv&Hn&M&MNXv&b.";";<b."C"CDb.";";<b."I"IJr   r+   N)r0   r1   r2   r3   r   r%   r8   r;   r@   rD   rH   rL   rR   r4   r5   r6   s   @r   r   r      sH     DJ D8 82JDK Kr   r   c                   H   a  ] tR t^Jt o ]P
                  ! 4       tR tRtV t	R# )TestHeaderBasec                $    V P                  W4      # r*   )r   )r   namevalues   &&&r   make_headerTestHeaderBase.make_headerN   s    ||D((r   r+   N)
r0   r1   r2   r3   r	   r   r   rY   r4   r5   r6   s   @r   rU   rU   J   s     ++-G) )r   rU   c                   J   a  ] tR t^Rt o R tR tR tR tR tR t	R t
RtV tR	# )
TestBaseHeaderFeaturesc                    V P                  R R4      pV P                  V\        4       V P                  VR4       V P                  \        V4      R4       R# rG   this is a testN)rY   r   strassertEqualr   r   s   & r   test_strTestBaseHeaderFeatures.test_strT   sK    Y(89a%,-Q!12r   c                \    V P                  R R4      pV P                  VR,          R4       R# )rG   r_   :      NisN)rY   ra   rb   s   & r   test_substr"TestBaseHeaderFeatures.test_substrZ   s)    Y(893&r   c                b    V P                  R R4      pV P                  VP                  R 4       R# r^   )rY   ra   rW   rb   s   & r   test_has_name$TestBaseHeaderFeatures.test_has_name^   s)    Y(89+r   c                    V P                  R R4      pV P                  \        4      ;_uu_ 4        \        W!R4       RRR4       R#   + '       g   i     R# ; i)rG   r_   fooN)rY   assertRaisesAttributeErrorsetattr)r   attrr   s   && r   _test_attr_ro$TestBaseHeaderFeatures._test_attr_rob   s?    Y(89~..AU# /...s   AA	c                (    V P                  R 4       R# )rW   Nrt   r   s   &r   test_name_read_only*TestBaseHeaderFeatures.test_name_read_onlyg   s    6"r   c                (    V P                  R 4       R# )defectsNrw   rx   s   &r   test_defects_read_only-TestBaseHeaderFeatures.test_defects_read_onlyj   s    9%r   c                b   V P                  R R4      pV P                  \        VP                  4      ^ 4       V P	                  VP                  \
        4       V P                  RR4      pV P                  \        VP                  4      ^4       V P	                  VP                  \
        4       R# )rG   r_   date N)rY   ra   lenr|   r   tuplerb   s   & r   test_defects_is_tuple,TestBaseHeaderFeatures.test_defects_is_tuplem   s    Y(89QYY+aii/VR(QYY+aii/r   r+   N)r0   r1   r2   r3   rc   ri   rl   rt   ry   r}   r   r4   r5   r6   s   @r   r\   r\   R   s-     3',$
#&0 0r   r\   c                   J   a  ] tR t^t o R tRRR. R3RRR. R3R	RR
R/tRtV tR# )TestUnstructuredHeaderc                   \        V4      pV^ 8  d
   V^ ,          M. pRV'       d   RMR,           pYd^8  d
   V^,          MT,           R,           pV P                  RV4      pV P                  W4       V P                  VP                  V4       V P                  VP                  \        P                  R7      V4       R# )r   zSubject: r   
r!   r   N)r   rY   ra   assertDefectsEqualr|   foldr   default)	r   sourcedecodedr,   lr|   headerfoldedr   s	   &&&*     r   string_as_value&TestUnstructuredHeader.string_as_value   s     IqS$q'bfs"5c47v6=Y/$		73v~~6?r   rfc2047_simple_quopriz=?utf-8?q?this_is_a_test?=r_   rfc2047_gb2312_base64z!=?gb2312?b?1eLKx9bQzsSy4srUo6E=?=u   这是中文测试！z(=?utf-8?b?6L+Z5piv5Lit5paH5rWL6K+V77yB?=rfc2047_simple_nonascii_quopri rfc2047_quopri_with_regular_textr+   N)z=?utf-8?q?=C3=89ric?=   Éric)z$The =?utf-8?q?=C3=89ric=2C?= Himself   The Éric, Himself)r0   r1   r2   r3   r   string_paramsr4   r5   r6   s   @r   r   r      sR     @ 	 (	" 	 /86	"8 	) + 	+ -"%Mr   r   c            
          a  ] tR t^t o Rt]P                  ! RR7      t]P                  ! ]4      t	]P
                  ! R^	^^^
^7]	R7      t
R tR tR tR tR	 tR
 tR tR tR tRtV tR# )TestDateHeaderzSun, 23 Sep 2001 20:10:55 -0700)hoursi  )tzinfoc                `   V P                  R V P                  4      pV P                  WP                  4       V P                  VP                  V P                  4       V P                  VP                  P                  4       V P
                  4       V P                  VP                  R4       R# r   Nr+   )rY   
datestringra   datetimedt	utcoffsetr|   rb   s   & r   test_parse_dateTestDateHeader.test_parse_date   sw    VT__5OO,TWW---/@B'r   c                    V P                  R V P                  4      pV P                  WP                  4       V P                  VP                  V P                  4       V P                  VP
                  R4       R# r   )rY   r   ra   r   r   r|   rb   s   & r   test_set_from_datetime%TestDateHeader.test_set_from_datetime   sV    VTWW-OO,TWW-B'r   c                    V P                  R V P                  4      pV P                  V\        P                  4       V P                  VP                  ^4       V P                  VP                  R4       R# r   )rY   r   r   r	   UniqueDateHeaderra   	max_countr|   rb   s   & r   test_date_header_properties*TestDateHeader.test_date_header_properties   sV    VT__5a!@!@Aa(B'r   c                    V P                  R V P                  4      pV P                  V\        P                  4       V P                  VP                  R4       V P                  VP                  R4       R# )zresent-dateNr+   )rY   r   r   r	   
DateHeaderra   r   r|   rb   s   & r   "test_resent_date_header_properties1TestDateHeader.test_resent_date_header_properties   sV    ]DOO<a!:!:;d+B'r   c                    V P                  R R4      pV P                  \        VP                  4      ^4       V P	                  VP                  ^ ,          \
        P                  4       R# )r   r   N)rY   ra   r   r|   r   r   HeaderMissingRequiredValuerb   s   & r   test_no_value_is_defect&TestDateHeader.test_no_value_is_defect   sJ    VR(QYY+aiilF,M,MNr   c                2   R pV P                  RV4      pV P                  W!4       V P                  VP                  4       V P                  \	        VP
                  4      ^4       V P                  VP
                  ^ ,          \        P                  4       R# )zNot a date headerr   N	rY   ra   assertIsNoner   r   r|   r   r   InvalidDateDefectr   sr   s   &  r   test_invalid_date_format'TestDateHeader.test_invalid_date_format   so    VQ'!**%QYY+aiilF,D,DEr   c                2   R pV P                  RV4      pV P                  W!4       V P                  VP                  4       V P                  \	        VP
                  4      ^4       V P                  VP
                  ^ ,          \        P                  4       R# )zTue, 06 Jun 2017 27:39:33 +0600r   Nr   r   s   &  r   test_invalid_date_value&TestDateHeader.test_invalid_date_value   so    -VQ'!**%QYY+aiilF,D,DEr   c                    V P                  R V P                  4      pV P                  \        4      ;_uu_ 4        RVn        RRR4       R#   + '       g   i     R# ; i)r   ro   N)rY   r   rp   rq   r   rb   s   & r   test_datetime_read_only&TestDateHeader.test_datetime_read_only   s?    VT__5~..AJ /...s   AA	c                    \        \        P                  R 7      pV P                  VR&   V P	                  VR,          V P
                  4       V P	                  VR,          P                  V P                  4       R# )r   DateN)r   r   r   r   ra   r   r   )r   ms   & r   "test_set_date_header_from_datetime1TestDateHeader.test_set_date_header_from_datetime   sS    6>>*GG&	6DOO46++TWW5r   r+   Ni)r0   r1   r2   r3   r   r   	timedeltar   timezonetzr   r   r   r   r   r   r   r   r   r   r4   r5   r6   s   @r   r   r      s}      3J"",I			9	%B			4BB2	>B((((O
FF
6 6r   r   c            "         a  ] tR t^t o R t/ RRRRRRR/. R	3bR
RRRRRR/. R	3bRR	RRRRR/3bRRRRR/ ]P                  .3bRRRRR/ ]P                  .3bRRRRR/ ]P                  .3bRRRRR/ ]P                  .3bRRbRRbRRbRRbRRRRRRR/3bRR RRRRR!/3bR"R#RRRRR$/3bR%R&RRRRR/. R'3bR(R)RRRR*R/. R+3bR,R-RRRR*R./3b/ R/R0RRRR*R1/3bR2R3RRRR4R5R6R5/]P                  .^,          3bR7R8R9R:R;R<R=/. R>3bR?R@RRRRARBRCRDRERF/. RGRH3bRIRJRRRRARBRCRDRERFRKRL/. RJRM3bRNRORRRRARP/3bRQRRRRRRARS/3bRTRURRRRARV/. RU3bRWRXP                  RY4      P                  RRZ4      R[R\R]R^R_R4R`/]P                  .^,          RaRb3bRcRdRRRRARe/. Rf3bRgRhRRRR]Ri/. Rj3bRkRlP                  RY4      P                  RRZ4      RRRRRR*Rm/]P                  .RnRo3bRpRqRRRRR/. R	3bRrRsRRRRARt/. Ru3bRvRwRRRRARx/]P                  .^,          Ry3bRzR{RRRRRR*R|/]P                  .^,          R}R~3bRRRRRRAR/]P                  .^,          R3bCRRRRRRAR/. R3RRRRRRAR/]P                  .R3RRRRRRAR/]P                  .^,          R3RRRRRRAR/]P                  .^,          R3RRRRRRAR/]P                  .RR3RRRRRRAR/. R3RRRRRRR/]P                  .RR3RRRRRRR/]P                  .RR3RRRRRRR/. RR3RRRRRRAR/]P                  .R3RRRRRRAR/]P                  .^,          R3RRRRRRAR/]P                  .^,          R3RRRRRRAR/. RR3/Ct
RtV tR# )TestContentTypeHeaderc                N   \        V4      pV^ 8  d
   V^ ,          M/ pV^8  d
   V^,          M. pV^8  d   V^,          \        Jd
   V^,          MTp	V'       d   RMRp
V^8  d
   V^,          MW,           R,           pV P                  RV4      pV P                  VP                  V4       V P                  VP
                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  \        4      ;_uu_ 4        RVP                  R&   RRR4       V P                  VP                  V4       V P                  W4       V P                  VP                  \        P                  R7      V4       R#   + '       g   i     Lo; i)	r   r   r   zContent-TypexyzabcNr   zContent-Type: )r   DITTOrY   ra   content_typemaintypesubtypeparamsrp   	TypeErrorr   r|   r   r   r   )r   r   r   r   r   r,   r   parmdictr|   r   r   r   r   s   &&&&&*       r   content_type_as_value+TestContentTypeHeader.content_type_as_value   s=    Ic47rc47rcd1gU&:47*0&baCaV%5%<^V46X.G,8,y))#AHHUO *		73$v~~6?	 *)s   FF$	
RFC_2045_1z)text/plain; charset=us-ascii (Plain text)
text/plaintextplaincharsetzus-asciiztext/plain; charset="us-ascii"
RFC_2045_2ztext/plain; charset=us-ascii
RFC_2045_3no_subtype_in_content_typeztext/no_slash_in_content_typero   junk_text_in_content_typez<crazy "stuff"> too_many_slashes_in_content_typezimage/jpeg/foounknown_content_typemixed_case_content_type
image/jpegimagejpegspaces_in_content_typecfws_in_content_typecharset_paramztext/plain; charset="utf-8"zutf-8capitalized_charsetztext/plain; charset="US-ASCII"zUS-ASCIIunknown_charsetztext/plain; charset="fOo"fOo*capitalized_charset_param_name_and_commentz*text/plain; (interjection) Charset="utf-8"ztext/plain; Charset="utf-8"unquoted_param_valueztext/plain; title=footitleztext/plain; title="foo"param_value_with_tspecialsz!text/plain; title="(bar)foo blue"z(bar)foo blue"param_with_extra_quoted_whitespacez0text/plain; title="  a     loong  way 	 home   "z  a     loong  way 	 home   
bad_paramszblarg; baz; boobazr   boospaces_around_param_equalsz0Multipart/mixed; boundary = "CPIMSSMTPC06p5f3tG"zmultipart/mixed	multipartmixedboundaryCPIMSSMTPC06p5f3tGz.Multipart/mixed; boundary="CPIMSSMTPC06p5f3tG"spaces_around_semiszPimage/jpeg; name="wibble.JPG" ; x-mac-type="4A504547" ; x-mac-creator="474B4F4E"rW   z
wibble.JPGz
x-mac-type4A504547zx-mac-creator474B4F4EzNimage/jpeg; name="wibble.JPG"; x-mac-type="4A504547"; x-mac-creator="474B4F4E"z^Content-Type: image/jpeg; name="wibble.JPG"; x-mac-type="4A504547";
 x-mac-creator="474B4F4E"
lots_of_mime_paramszmimage/jpeg; name="wibble.JPG"; x-mac-type="4A504547"; x-mac-creator="474B4F4E"; x-extrastuff="make it longer"zx-extrastuffzmake it longerz}Content-Type: image/jpeg; name="wibble.JPG"; x-mac-type="4A504547";
 x-mac-creator="474B4F4E"; x-extrastuff="make it longer"
semis_inside_quotesz$image/jpeg; name="Jim&amp;&amp;Jill"zJim&amp;&amp;Jillsingle_quotes_inside_quotesz!image/jpeg; name="Jim 'Bob' Jill"zJim 'Bob' Jilldouble_quotes_inside_quotesz#image/jpeg; name="Jim \"Bob\" Jill"zJim "Bob" Jillnon_ascii_in_paramsu   foo§/bar; b§r=two; baz=thr§ezlatin-1surrogateescapeu
   foo�/baru   foo�baru   b�rtwou   thr�eu&   foo�/bar; b�r="two"; baz="thr�e"uV   Content-Type: =?unknown-8bit?q?foo=A7?=/bar; br="two";
 baz*=unknown-8bit''thr%A7e
rfc2231_segmented_normal_valuesz(image/jpeg; name*0="abc"; name*1=".html"zabc.htmlzimage/jpeg; name="abc.html"quotes_inside_rfc2231_valuez.image/jpeg; bar*0="baz\"foobar"; bar*1="\"baz"zbaz"foobar"bazz"image/jpeg; bar="baz\"foobar\"baz"non_ascii_rfc2231_valueuG   text/plain; charset=us-ascii; title*=us-ascii'en'This%20is%20not%20f§nu   This is not f�nu9   text/plain; charset="us-ascii"; title="This is not f�n"z\Content-Type: text/plain; charset="us-ascii";
 title*=unknown-8bit''This%20is%20not%20f%A7n
rfc2231_encoded_charsetz-text/plain; charset*=ansi-x3.4-1968''us-ascii rfc2231_encoded_no_double_quotesz\text/plain;	name*0*=''This%20is%20;	name*1*=%2A%2A%2Afun%2A%2A%2A%20;	name*2="is it not.pdf"zThis is ***fun*** is it not.pdfz2text/plain; name="This is ***fun*** is it not.pdf""rfc2231_encoded_with_double_quoteszvtext/plain;	name*0*="us-ascii''This%20is%20even%20more%20";	name*1*="%2A%2A%2Afun%2A%2A%2A%20";	name*2="is it not.pdf"z)This is even more ***fun*** is it not.pdfz<text/plain; name="This is even more ***fun*** is it not.pdf")rfc2231_single_quote_inside_double_quotesztext/plain; charset=us-ascii;	title*0*="us-ascii'en'This%20is%20really%20";	title*1*="%2A%2A%2Afun%2A%2A%2A%20";	title*2="isn't it!"z"This is really ***fun*** isn't it!zJtext/plain; charset="us-ascii"; title="This is really ***fun*** isn't it!"zZContent-Type: text/plain; charset="us-ascii";
 title="This is really ***fun*** isn't it!"
3rfc2231_single_quote_in_value_with_charset_and_langzHapplication/x-foo;	name*0*="us-ascii'en-us'Frank's"; name*1*=" Document"zapplication/x-fooapplicationzx-foozFrank's Documentz*application/x-foo; name="Frank's Document")rfc2231_single_quote_in_non_encoded_valuezFapplication/x-foo;	name*0="us-ascii'en-us'Frank's"; name*1=" Document"zus-ascii'en-us'Frank's Documentz9application/x-foo; name="us-ascii'en-us'Frank's Document"rfc2231_no_language_or_charsetz/text/plain; NAME*0*=english_is_the_default.htmlzenglish_is_the_default.htmlz.text/plain; NAME="english_is_the_default.html"rfc2231_encoded_no_charsetzjtext/plain;	name*0*="''This%20is%20even%20more%20";	name*1*="%2A%2A%2Afun%2A%2A%2A%20";	name*2="is it.pdf"z%This is even more ***fun*** is it.pdfz8text/plain; name="This is even more ***fun*** is it.pdf"rfc2231_partly_encodedrfc2231_partly_encoded_2zitext/plain;	name*0*="''This%20is%20even%20more%20";	name*1="%2A%2A%2Afun%2A%2A%2A%20";	name*2="is it.pdf"z3This is even more %2A%2A%2Afun%2A%2A%2A%20is it.pdfzFtext/plain; name="This is even more %2A%2A%2Afun%2A%2A%2A%20is it.pdf"zVContent-Type: text/plain;
 name="This is even more %2A%2A%2Afun%2A%2A%2A%20is it.pdf"
(rfc2231_unknown_charset_treated_as_asciiz1text/plain; name*0*=bogus'xx'ascii_is_the_defaultascii_is_the_defaultz'text/plain; name="ascii_is_the_default"0rfc2231_bad_character_in_charset_parameter_valuez*text/plain; charset*=ascii''utf-8%F1%F2%F3u   utf-8���u$   text/plain; charset="utf-8���"z@Content-Type: text/plain; charset*=unknown-8bit''utf-8%F1%F2%F3
8rfc2231_utf8_in_supposedly_ascii_charset_parameter_valuez*text/plain; charset*=ascii''utf-8%E2%80%9Du   utf-8”u   text/plain; charset="utf-8”"z@Content-Type: text/plain; charset*=unknown-8bit''utf-8%E2%80%9D
6rfc2231_nonascii_in_charset_of_charset_parameter_valueu-   text/plain; charset*=utf-8”''utf-8%E2%80%9Dz9Content-Type: text/plain; charset*=utf-8''utf-8%E2%80%9D
'rfc2231_encoded_then_unencoded_segmentszUapplication/x-foo;	name*0*="us-ascii'en-us'My";	name*1=" Document";	name*2=" For You"zMy Document For Youz-application/x-foo; name="My Document For You"'rfc2231_unencoded_then_encoded_segmentszTapplication/x-foo;	name*0=us-ascii'en-us'My;	name*1*=" Document";	name*2*=" For You".rfc2231_quoted_unencoded_then_encoded_segmentszVapplication/x-foo;	name*0="us-ascii'en-us'My";	name*1*=" Document";	name*2*=" For You"z"us-ascii'en-us'My Document For Youz<application/x-foo; name="us-ascii'en-us'My Document For You"+rfc2231_folded_segments_correctly_formattedzContent-Type: application/x-foo;
 name*0*=us-ascii''with%20spaceswith%20spaceswith%20spaceswith%20spaceswith;
 name*1*=%20spaceswith%20spaceswith%20spaceswith%20spaces
r+   N)	bad/namesr!  badnames)z
ImAge/JPegr   r   r   )z  text  /  plain  r   r   r   )z"(foo) text (bar)/(baz)plain(stuff)r   r   r   zXwith spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaceszrapplication/x-foo;	name="with spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaces"zrapplication/x-foo; name="with spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaceswith spaces")r0   r1   r2   r3   r   r   InvalidHeaderDefectencodedecodeUndecodableBytesDefectcontent_type_paramsr4   r5   r6   s   @r   r   r      s    @.[ 	7
#,.	[ 	*
#,.[, 	,
#%-[@ 	%''('*A[P 	#''(%*Q[` 	$''(&*a[p 	+''(-*q[L 	 !M[\ 	" $][h 	! #i[t 	 !u[H 	) "I[V 	,
# %W[d 	' e[r 	58 )7+s[R 	#e%!S[f 	%/o&'(g[t 	-?56/8u[B 	Br"''(*,C[R 	%>-.<'S[f 	+\:j* ++ g[H 	J\:j-/ JJ I[p 	2() +q[~ 	&1%&(([L 	&2%&2(4M[^ 	%vi0
8I2K|4**+A-4,! _[J 	*6Z ),+K[\ 	&=$%1(3][n 	"#VI.vvj5F0H
G-CD++,H>$o[L	 	"=
#,$.M	[`	 	++ 67@-a	[|	 	-+ @A''(*J/}	[V
 	4( 
G-QR''(*=A6W
[v
 	>N'(''(*9	@w
[L 	4L67J	6 	)=23''(<+> 	%' <=''(*F' 	!' <=''(*F# 	#' JK''(K%" 	3?+,557 	;812**+;7
= 	C8
#**+,7E 	A;
#,0
C 	2&  *+''(;4  	2'  *+''(*;4. 	9'  9:''(*L;" 	63_%?J8Y[r   r   c            
       |   a  ] tR tRt o R tRRRRR]P                  .RR3R	R
R]P                  .3RRR. 3/tRt	V t
R# )TestContentTransferEncodingi#  c                   \        V4      pV^ 8  d
   V^ ,          M. pV^8  d   V^,          \        Jd
   V^,          MTpV'       d   RMRpV^8  d
   V^,          MWq,           R,           pV P                  RV4      p	V P                  V	P                  V4       V P                  V	P                  V4       V P                  W4       V P                  V	P                  \        P                  R7      V4       R# )r   r   r   zContent-Transfer-Encodingr   NzContent-Transfer-Encoding: )
r   r   rY   ra   cter   r|   r   r   r   )
r   r   r,  r,   r   r|   r   r   r   r   s
   &&&*      r   cte_as_value(TestContentTransferEncoding.cte_as_value&  s     Ic47rcd1gU&:477=32aCaV_t%;8&A$		73$v~~6?r   
RFC_2183_1base64no_valuer   7bitzContent-Transfer-Encoding:
junk_after_ctez7bit and a bunch moreextra_space_after_ctezbase64 r+   N)r0  r0  )r0   r1   r2   r3   r-  r   r   r$  
cte_paramsr4   r5   r6   s   @r   r*  r*  #  sm     @" 	  	../* 	#''(*
 	 "'Jr   r*  c                     a  ] tR tRt o R tRR"RRRRRR	R
/. RR3RRR/ ]P                  .RR3RRR/ ]P                  .3RRRRR/]P                  .3RRRRR/]P                  .^,          RR3RRRRR/]P                  .RR 3/tR!t	V t
R# )#TestContentDispositioniP  c                N   \        V4      pV^ 8  d
   V^ ,          M/ pV^8  d
   V^,          M. pV^8  d   V^,          \        Jd
   V^,          MTpV'       d   RMRpV^8  d
   V^,          MW,           R,           p	V P                  RV4      p
V P                  V
P                  V4       V P                  V
P
                  V4       V P                  V
P                  V4       V P                  W4       V P                  V
P                  \        P                  R7      V	4       R# )r   r   r   zContent-Dispositionr   NzContent-Disposition: )r   r   rY   ra   content_dispositionr   r   r|   r   r   r   )r   r   r9  r,   r   r   r|   r   r   r   r   s   &&&*       r   content_disp_as_value,TestContentDisposition.content_disp_as_valueS  s     Ic47rc47rcd1gU&:4717-RaCaV_t%;2F;..0CD8,		73$v~~6?r   r/  
RFC_2183_2zWattachment; filename=genome.jpeg;  modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
attachmentfilenamezgenome.jpegzmodification-datezWed, 12 Feb 1997 16:29:51 -0500zWattachment; filename="genome.jpeg"; modification-date="Wed, 12 Feb 1997 16:29:51 -0500"znContent-Disposition: attachment; filename="genome.jpeg";
 modification-date="Wed, 12 Feb 1997 16:29:51 -0500"
r1  r   NzContent-Disposition:
invalid_valuezab./kzab.invalid_value_with_paramszab./k; filename="foo"ro   +invalid_parameter_value_with_fws_between_ewzaattachment; filename="=?UTF-8?Q?Schulbesuchsbest=C3=A4ttigung=2E?=               =?UTF-8?Q?pdf?="u   Schulbesuchsbestättigung.pdfu4   attachment; filename="Schulbesuchsbestättigung.pdf"zUContent-Disposition: attachment;
 filename*=utf-8''Schulbesuchsbest%C3%A4ttigung.pdf
'parameter_value_with_fws_between_tokensz<attachment; filename="File =?utf-8?q?Name?= With Spaces.pdf"zFile Name With Spaces.pdfz0attachment; filename="File Name With Spaces.pdf"zFContent-Disposition: attachment; filename="File Name With Spaces.pdf"
r+   )inlinerC  )r0   r1   r2   r3   r:  r   r   r$  content_disp_paramsr4   r5   r6   s   @r   r7  r7  P  s    @* 	  	F "CEGF 	../$& 	''(	* 	$#''(	&* 	6.89''(*CG	8 	2J45''(>V4i<r   r7  c            #         a  ] tR tRt o R tRRRR^^ . 3RRRR^^ . 3RRRR^^ . 3R	R
R
R^^ . 3RRRR^^. 3RRRR^^. 3RRRR^^ . 3RRRR^^ . 3RRRR^^ ]P                  .3RRRRRR]P                  .3RRRRRR]P                  .3RRRRRR]P                  .3RRRRRR]P                  .3RRRRRR]P                  .3RR R RRR]P                  .3/tR!t	V t
R# )"TestMIMEVersionHeaderi  c                   V P                  R V4      pV P                  Wr4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V'       d
   RV,           pV P                  VP                  \        P                  R7      RV,           R,           4       R# )zMIME-Versionr   r   zMIME-Version:r   N)
rY   ra   versionmajorminorr   r|   r   r   r   )r   r   r   rH  rI  rJ  r|   r   s   &&&&&&& r   version_string_as_MIME_Version4TestMIMEVersionHeader.version_string_as_MIME_Version  s     ^V4$G,%(%(		736\Fv~~6(61D8	:r   r   z1.0r   z1.0 (produced by MetaSend Vx.x)r   z(produced by MetaSend Vx.x) 1.0
RFC_2045_4z1.(produced by MetaSend Vx.x)01_1z1.12_1z2.1
whitespacez1 .0#leading_trailing_whitespace_ignoredz  1.0  non_comment_garbage_afterz	1.0 <abc>non_comment_garbage_beforez	<abc> 1.0Nnon_comment_garbage_insidez1.<abc>0two_periodsz1..02_xz2.xro   missingr   r+   )r0   r1   r2   r3   rK  r   r$  r   version_string_paramsr4   r5   r6   s   @r   rF  rF    s    :, 	 	-- 	-- 	,, 	 	 	 	.0 	$''(&* 	%''('* 	%''('* 	''(* 	''(* 	''(* 	../1}F
r   rF  c            
         a  ] tR tRt o / RR]P
                  .RRRRRR3bRR. RRRRR	R3bR
R. RRRRR	R3bRR. RRRRR	R3bRR. RRRRRR3bRR. RRRRRR3bRR]P                  .RRRR R!R3bR"R#]P
                  .^,          R$RR$R%R!R3bR&R'. R'RR'R(R!R3bR)R*]P
                  .^,          R+RR+R,R!R3bR-R.]P
                  .^,          R/RR/R0R!R3bR1R2]P                  .R3RR3R4R!R3bR5R6. R7R8R9R:R!R3bR;R<. R=R>R9R:R!R3bR?R@]P
                  ]P
                  .R7R8R9R:R!R3bRARB]P                  .RCRDRR R!R3bRERF]P
                  ]P                  .RGRHRR R!R3btRI tRJ t	RK t
RL tRM tRN tRO tRP tRQ tRR tRS tRT tRU tRVtV tR# )WTestAddressHeaderiA  empty<>r   Naddress_onlyzzippy@pinhead.comzippyzpinhead.comname_and_addressz%Zaphrod Beblebrux <zippy@pinhead.com>zZaphrod Beblebruxquoted_local_partz)Zaphrod Beblebrux <"foo bar"@pinhead.com>z"foo bar"@pinhead.comfoo barquoted_parens_in_namez'"A \(Special\) Person" <person@dom.ain>z%"A (Special) Person" <person@dom.ain>zA (Special) Personzperson@dom.ainpersonzdom.ainquoted_backslashes_in_namez."Arthur \\Backslash\\ Foobar" <person@dom.ain>zArthur \Backslash\ Foobarname_with_dotzJohn X. Doe <jxd@example.com>z"John X. Doe" <jxd@example.com>zJohn X. Doezjxd@example.comjxdexample.comquoted_strings_in_local_partz""example" example"@example.comz"example example"@example.comzexample example$escaped_quoted_strings_in_local_partz!"\"example\" example"@example.comz"example" exampleescaped_escapes_in_local_partz#"\\"example\\" example"@example.comz#"\\example\\\\ example"@example.comz\example\\ example'spaces_in_unquoted_local_part_collapsedzmerwok  wok  @example.comz"merwok wok"@example.comz
merwok wok(spaces_around_dots_in_local_part_removedzmerwok. wok .  wok@example.comzmerwok.wok.wok@example.comzmerwok.wok.wokrfc2047_atom_is_decodedz'=?utf-8?q?=C3=89ric?= <foo@example.com>u   Éric <foo@example.com>r   foo@example.comro   !rfc2047_atom_in_phrase_is_decodedz6The =?utf-8?q?=C3=89ric=2C?= Himself <foo@example.com>u&   "The Éric, Himself" <foo@example.com>r   (rfc2047_atom_in_quoted_string_is_decodedz)"=?utf-8?q?=C3=89ric?=" <foo@example.com>"name_ending_with_dot_without_spacezJohn X.<jxd@example.com>z"John X." <jxd@example.com>zJohn X.name_starting_with_dotz. Doe <jxd@example.com>z". Doe" <jxd@example.com>z. Doec	                   V P                  R V4      p	V P                  W4       V P                  V	P                  V4       V	P                  p
V P                  \        V
4      V4       V P                  \        V	P                  4      ^4       V P                  V
.\        V	P                  ^ ,          P                  4      4       V P                  V
.\        V	P                  4      4       V P                  V
P                  V4       V P                  V
P                  V4       V P                  V
P                  V4       V P                  V
P                  V4       R# )senderN)rY   ra   r   r|   addressr`   r   groupslist	addressesdisplay_name	addr_specusernamedomain)r   r   r|   r   ry  rz  r{  r|  commentr   as   &&&&&&&&&  r   example_as_address$TestAddressHeader.example_as_address  s    Xv.$		73IIQ)QXX*!d188A;#8#89:!d1;;/06i0X.6*r   c	                   R P                  V4      pV'       d   R P                  V4      MRp	V P                  RV4      p
V P                  W4       V P                  V
P                  V4       V P                  V
P
                  ^ ,          P                  V
P                  4       V P                  \        V
P
                  4      ^4       V P                  \        V
P                  4      ^4       V
P                  ^ ,          pV P                  \        V4      V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       R# )zfoo: {};foo:;toN)formatrY   ra   r   r|   rv  rx  r   r`   ry  rz  r{  r|  )r   r   r|   r   ry  rz  r{  r|  r}  gdecodedr   r~  s   &&&&&&&&&   r   example_as_group"TestAddressHeader.example_as_group  s   ""6*18:$$W-gT6*%		73!..<QXX*Q[[)1-KKNQ)6i0X.6*r   c                   R pV P                  RV4      pV P                  W!4       V P                  \        VP                  4      ^4       V P                  \        VP                  4      ^4       \        ^4       FH  pV P                  VP                  V,          P                  ^ ,          VP                  V,          4       KJ  	  V P                  \        VP                  ^ ,          4      R4       V P                  \        VP                  ^,          4      R4       V P                  \        VP                  ^,          4      R4       V P                  VP                  ^,          P                  R4       R# )zTFred <dinsdale@python.org>, foo@example.com, "Harry W. Hastings" <hasty@example.com>r  zFred <dinsdale@python.org>rn  z'"Harry W. Hastings" <hasty@example.com>zHarry W. HastingsN)rY   ra   r   rv  rx  ranger`   ry  )r   rX   r   is   &   r   test_simple_address_list*TestAddressHeader.test_simple_address_list  s   >T5)"QXX*Q[[)1-qAQXXa[2215q{{1~F Q[[^,.JKQ[[^,.?@Q[[^,5	7Q44	!r   c                f	   \        V P                  P                  4       4      pR RP                  VR,           Uu. uF  q"^ ,          NK  	  up4      ,           R,           R,           RP                  VR,           Uu. uF  q"^ ,          NK  	  up4      ,           R,           RP                  VR,           Uu. uF  q"^ ,          NK  	  up4      ,           pRRP                  VR,           Uu. uF  q"^,          NK  	  up4      ,           R,           R,           RP                  VR,           Uu. uF  q"^,          NK  	  up4      ,           R,           RP                  VR,           Uu. uF  q"^,          NK  	  up4      ,           pV P	                  R	V4      pV P                  VP                  R
4      VP                  R
4      4       V P                  WT4       V P                  \        VP                  4      ^\        V4      ,           ^,
          4       V P                  VP                  ^ ,          P                  R4       V P                  VP                  ^,          P                  R4       V P                  VP                  ^,          P                  R4       V P                  \        VP                  4      \        V4      4       \        ^4       F  pV P                  VP                  V^,           ,          P                  4       V P                  \        VP                  V^,           ,          P                  ^ ,          4      W,          ^,          4       K  	  \        ^^\        V4      ,           ^,
          4       F  pV P                  VP                  V,          P                  4       V P                  \        VP                  V,          P                  ^ ,          4      W^,
          ,          ^,          4       K  	  \        \        V4      4       Fv  pV P                  \        VP                  V,          4      W,          ^,          4       V P                  VP                  V,          P                  W,          ^,          4       Kx  	  R# u upi u upi u upi u upi u upi u upi )z dummy list:;, another: (empty);,z, :N   Nz"A \"list\"": :r     Nz;,:r  NNzdummy list:;, another:;, z;, r  ,z
dummy listanotherzA "list"N)rw  example_paramsvaluesjoinrY   ra   splitr   rv  ry  rx  r  r   r`   rz  )r   examplesxr   expectedr   r  s   &      r   test_complex_address_list+TestAddressHeader.test_complex_address_list)  s}   ++22454(2,7,QaDD,789;?@"# IIXc];]tt];<= @DD (2,7,QaDD,78	9 0(2,7,QaDD,789;?@"# IIXc];]tt];<= @EE (2,7,QaDD,78	9 T6*x~~c':;%QXXCM(9A(=>!11<@!119=!11:>Q[[)3x=9qAahhqsm889S!A#!8!8!;<hk!nM  q!c(m+a/0Aahhqk667S!!6!6q!9:HqSM!<LM 1 s8}%ASQ0(+a.AQ[[^55x{1~F &9 8;7
 8;7s#   R
<R
6R
+R$
,R)
&R.
c                    V P                  R R4      pV P                  \        4      ;_uu_ 4        RVn        RRR4       R#   + '       g   i     R# ; irt  zabc@xyz.comro   N)rY   rp   rq   ru  rb   s   & r   test_address_read_only(TestAddressHeader.test_address_read_onlyL  s;    X}5~..AI /...   AA	c                    V P                  R R4      pV P                  \        4      ;_uu_ 4        RVn        RRR4       R#   + '       g   i     R# ; ir  )rY   rp   rq   rx  rb   s   & r   test_addresses_read_only*TestAddressHeader.test_addresses_read_onlyQ  s;    X}5~..AK /...r  c                    V P                  R R4      pV P                  \        4      ;_uu_ 4        RVn        RRR4       R#   + '       g   i     R# ; ir  )rY   rp   rq   rv  rb   s   & r   test_groups_read_only'TestAddressHeader.test_groups_read_onlyV  s;    X}5~..AH /...r  c                    R pV P                  RV4      pV P                  VP                  \        4       V P                  VP                  ^ ,          \        4       R# zme <who@example.com>r  N)rY   r   rx  r   r
   r   r   r   s   &  r   test_addresses_types&TestAddressHeader.test_addresses_types[  sE    'T6*akk51akk!ng6r   c                    R pV P                  RV4      pV P                  VP                  \        4       V P                  VP                  ^ ,          \        4       R# r  )rY   r   rv  r   r   r  s   &  r   test_groups_types#TestAddressHeader.test_groups_typesa  sE    'T6*ahh.ahhqk51r   c                d    V P                  R \        RRR4      4      pV P                  VR4       R# )r  mero   rg  zme <foo@example.com>NrY   r
   ra   rb   s   & r   test_set_from_Address'TestAddressHeader.test_set_from_Addressg  s.    T74#FG23r   c           	     ~    V P                  R \        RRR4      \        RRR4      .4      pV P                  VR4       R# )r  r  ro   rg  your  z+me <foo@example.com>, you <bar@example.com>Nr  rb   s   & r   test_set_from_Address_list,TestAddressHeader.test_set_from_Address_listk  sC    TGD%$G$+E5-$H$J KIJr   c                D   V P                  R \        RRR4      \        R\        RRR4      \        RR	R
4      .4      \        RRR4      .4      pV P                  VR4       V P                  VP	                  \
        P                  P                  ^(R7      R7      R4       R# )r  r  ro   rg  bingfizzb.comziffc.comr  r  zPme <foo@example.com>, bing: fiz <z@b.com>, zif <f@c.com>;, you <bar@example.com>max_line_lengthr   zWto: me <foo@example.com>,
 bing: fiz <z@b.com>, zif <f@c.com>;,
 you <bar@example.com>
N)rY   r
   r   ra   r   r   r   clonerb   s   & r   $test_set_from_Address_and_Group_list6TestAddressHeader.test_set_from_Address_and_Group_listp  s    TGD%$G$)&75#w3O3:5#w3O3Q %R$+E5-$H$J K 	 D 	Ev~~';';B';'OP3	4r   c                    V P                  R \        R\        RRR4      \        RRR4      .4      .4      pV P                  VR4       R	# )
r  r  r  r  r  r  r  r  z#bing: fiz <z@b.com>, zif <f@c.com>;N)rY   r   r
   ra   rb   s   & r   test_set_from_Group_list*TestAddressHeader.test_set_from_Group_list|  sS    TE&75#w3O3:5#w3O3Q %R $S TABr   r+   )r0   r1   r2   r3   r   r$  ObsoleteHeaderDefectr  r  r  r  r  r  r  r  r  r  r  r  r  r  r4   r5   r6   s   @r   rZ  rZ  A  s    m
(()m
 	   m
, 	44  /m
@ 	88 $Cm
T 	 74!Wm
h 	%>>)km
| 	,))*.m
P 	'.(()!+,,Sm
d 	/111!gm
x 	(3(()!+33"{m
L 	2((()!+''Om
` 	3-))*))cm
t 	"6%wm
H 	,E4 Km
\ 	38''&&(%_m
r 	-'))**um
F 	!&((&*E*EF(Im
Nf+"+"! !GF
 

724K

4C Cr   rZ  c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R  t"R! t#R" t$R# t%R$t&V t'R%# )&TestAddressAndGroupi  c                    V P                  \        4      ;_uu_ 4        \        WR 4       RRR4       R#   + '       g   i     R# ; i)ro   N)rp   rq   rr   )r   objrs   s   &&&r   rt   !TestAddressAndGroup._test_attr_ro  s,    ~..Cu% /...s	   5A	c                @    V P                  \        R RR4      R4       R# )ro   r  r   ry  Nrt   r
   rx   s   &r   test_address_display_name_ro0TestAddressAndGroup.test_address_display_name_ro  s    75%7Hr   c                @    V P                  \        R RR4      R4       R# )ro   r  r   r{  Nr  rx   s   &r   test_address_username_ro,TestAddressAndGroup.test_address_username_ro  s    75%7Dr   c                @    V P                  \        R RR4      R4       R# )ro   r  r   r|  Nr  rx   s   &r   test_address_domain_ro*TestAddressAndGroup.test_address_domain_ro  s    75%7Br   c                <    V P                  \        R 4      R4       R# )ro   ry  Nrt   r   rx   s   &r   test_group_display_name_ro.TestAddressAndGroup.test_group_display_name_ro  s    5<8r   c                <    V P                  \        R 4      R4       R# )ro   rx  Nr  rx   s   &r   test_group_addresses_ro+TestAddressAndGroup.test_group_addresses_ro  s    5<5r   c                6   \        R RR4      pV P                  VP                  R 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  \        V4      R4       R# )ro   r  r   bar@bazfoo <bar@baz>Nr
   ra   ry  r{  r|  rz  r`   r   r~  s   & r   !test_address_from_username_domain5TestAddressAndGroup.test_address_from_username_domain  st    E5%(/U+5)i0Q1r   c                6   \        R RR7      pV P                  VP                  R 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  \        V4      R4       R# )ro   r  rz  r  r   r  Nr  r  s   & r   test_address_from_addr_spec/TestAddressAndGroup.test_address_from_addr_spec  sr    EY//U+5)i0Q1r   c                4   \        R R7      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R 4       V P                  \        V4      R 4       R# )r  r  r   r  r   Nr  r  s   & r   !test_address_with_no_display_name5TestAddressAndGroup.test_address_with_no_display_name  sp    i(,U+5)i0Q+r   c                0   \        4       pV P                  VP                  R 4       V P                  VP                  R 4       V P                  VP                  R 4       V P                  VP
                  R4       V P                  \        V4      R4       R# )r   r\  Nr  r  s   & r   test_null_address%TestAddressAndGroup.test_null_address  sm    I,R(2&d+Q&r   c                4   \        R R7      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R 4       V P                  VP
                  R4       V P                  \        V4      R4       R# )buzzr|  r   z@buzzNr  r  s   & r   test_domain_only$TestAddressAndGroup.test_domain_only  sp    6",R(6*g.Q)r   c                4   \        R R7      pV P                  VP                  R4       V P                  VP                  R 4       V P                  VP                  R4       V P                  VP
                  R 4       V P                  \        V4      R 4       R# )r  r{  r   Nr  r  s   & r   test_username_only&TestAddressAndGroup.test_username_only  sp    V$,V,2&f-Q(r   c                2   \        R 4      pV P                  VP                  R 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  \        V4      R4       R# )r  r   r\  zbuzz <>Nr  r  s   & r   test_display_name_only*TestAddressAndGroup.test_display_name_only  so    FO0R(2&d+Q+r   c                6   \        R RR4      pV P                  VP                  R 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  \        V4      R4       R# )zSara J.zbad namerg  z"bad name"@example.comz""Sara J." <"bad name"@example.com>Nr  r  s   & r   test_quoting TestAddressAndGroup.test_quoting  sx     Iz=93Z0=1&>?Q!EFr   c                6   \        R RR4      pV P                  VP                  R 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  \        V4      R4       R# )r   woku   exàmple.comu   wok@exàmple.comu   Éric <wok@exàmple.com>Nr  r  s   & r   	test_il8nTestAddressAndGroup.test_il8n  sv    GUN31U+>2&89Q!;<r   c                   \        R R7      \        RR7      \        RR7      \        RR7      \        RR7      \        RR7      \        RR	7      \        R
R	7      \        RR	7      \        RR7      \        RR7      \        RR7      3pV FX  pV P                  VR7      ;_uu_ 4        V P                  \        R4      ;_uu_ 4        \	        R/ VB  RRR4       RRR4       KZ  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)zfoo)ry  zfoo
zfoo
zexample.comr  zexample.com
zexample.com
zwokr  zwok
zwok
zwok@example.comr  zwok@example.com
zwok@example.com
)kwargszinvalid argumentsNr+   )dictsubTestassertRaisesRegex
ValueErrorr
   )r   casesr  s   &  r   $test_crlf_in_constructor_args_raises8TestAddressAndGroup.test_crlf_in_constructor_args_raises  s    g&g&i((()*'"'")$././01
 FV,,d.D.DZQd.e.e!&! /f,, .e.e,,,s$   &C:C'C:'C72C::Dc                    V P                  \        4      ;_uu_ 4        \        R RR7       RRR4       R#   + '       g   i     R# ; i)ro   u   wők@example.comr  Nrp   r  r
   rx   s   &r   +test_non_ascii_username_in_addr_spec_raises?TestAddressAndGroup.test_non_ascii_username_in_addr_spec_raises  s-    z**E%78 +***	   6A	c                    V P                  \        4      ;_uu_ 4        \        R RRR7       RRR4       R#   + '       g   i     R# ; i)ro   r  r  )r{  rz  Nrp   r   r
   rx   s   &r   *test_address_addr_spec_and_username_raises>TestAddressAndGroup.test_address_addr_spec_and_username_raises  s.    y))EFi@ *)))	   7A	c                    V P                  \        4      ;_uu_ 4        \        R RRR7       RRR4       R#   + '       g   i     R# ; i)ro   r  r  )r|  rz  Nr  rx   s   &r   (test_address_addr_spec_and_domain_raises<TestAddressAndGroup.test_address_addr_spec_and_domain_raises  s.    y))E&I> *)))r  c           	         V P                  \        4      ;_uu_ 4        \        R RRRR7       RRR4       R#   + '       g   i     R# ; i)ro   bongr  r  )r{  r|  rz  Nr  rx   s   &r   5test_address_addr_spec_and_username_and_domain_raisesITestAddressAndGroup.test_address_addr_spec_and_username_and_domain_raises  s0    y))EF6YO *)))s	   8A		c                    V P                  \        4      ;_uu_ 4        \        R RR7       RRR4       R#   + '       g   i     R# ; i)ro   zbad name@example.comr  Nr  rx   s   &r   'test_space_in_addr_spec_username_raises;TestAddressAndGroup.test_space_in_addr_spec_username_raises  s-    z**E%;< +***r  c                    V P                  \        4      ;_uu_ 4        \        R RR7       RRR4       R#   + '       g   i     R# ; i)ro   zname@ex[]ample.comr  Nr  rx   s   &r   test_bad_addr_sepc_raises-TestAddressAndGroup.test_bad_addr_sepc_raises  s-    z**E%9: +***r  c                    \        R 4      pV P                  VP                  R 4       V P                  VP                  \	        4       4       V P                  \        V4      R4       R# )ro   r  Nr   ra   ry  rx  r   r`   r   gs   & r   test_empty_group$TestAddressAndGroup.test_empty_group  sI    %L/eg.Q)r   c                    \        R . R7      pV P                  VP                  R 4       V P                  VP                  \	        4       4       V P                  \        V4      R4       R# )ro   rx  r  Nr#  r$  s   & r   test_empty_group_list)TestAddressAndGroup.test_empty_group_list  sL    %2&/eg.Q)r   c                    \        4       pV P                  VP                  4       V P                  VP                  \        4       4       V P                  \        V4      R 4       R# )zNone:;N)r   r   ry  ra   rx  r   r`   r$  s   & r   test_null_group#TestAddressAndGroup.test_null_group  sE    G!..)eg.Q*r   c                
   \        R R R4      \        RR R4      .p\        RV4      pV P                  VP                  R4       V P                  VP                  \        V4      4       V P                  \        V4      R4       R# )bcr~  ro   zfoo: b <b@c>, a <b@c>;N)r
   r   ra   ry  rx  r   r`   r   addrsr%  s   &  r   test_group_with_addresses-TestAddressAndGroup.test_group_with_addresses%  sk    c3'c#)>?%/eEl3Q!9:r   c                   \        R R R4      \        RR R4      .p\        VR7      pV P                  VP                  4       V P	                  VP
                  \        V4      4       V P	                  \        V4      R4       R# )r0  r1  r~  r)  zNone: b <b@c>, a <b@c>;Nr
   r   r   ry  ra   rx  r   r`   r2  s   &  r   )test_group_with_addresses_no_display_name=TestAddressAndGroup.test_group_with_addresses_no_display_name,  sg    c3'c#)>?E"!..)eEl3Q!:;r   c                    \        R R R4      .p\        VR7      pV P                  VP                  4       V P	                  VP
                  \        V4      4       V P	                  \        V4      R4       R# )r0  r1  r)  zb <b@c>Nr7  r2  s   &  r   +test_group_with_one_address_no_display_name?TestAddressAndGroup.test_group_with_one_address_no_display_name3  s[    c3'(E"!..)eEl3Q+r   c                    \        R 4      pV P                  VP                  R 4       V P                  VP                  \	        4       4       V P                  \        V4      R4       R# )zfoo.barz"foo.bar":;Nr#  r$  s   & r   test_display_name_quoting-TestAddressAndGroup.test_display_name_quoting:  sJ    )3eg.Q/r   c                    \        R 4      pV P                  VP                  R 4       V P                  VP                  \	        4       4       V P                  \        V4      R4       R# )ra  	foo bar:;Nr#  r$  s   & r   #test_display_name_blanks_not_quoted7TestAddressAndGroup.test_display_name_blanks_not_quoted@  sJ    )3eg.Q-r   c                    \        R RR4      p\        \        P                  R7      pWR&   V P	                  VR,          R4       V P	                  VR,          P
                  V34       R# )ro   r  rg  r   Tor  zfoo <bar@example.com>N)r
   r   r   r   ra   rx  )r   r~  r   s   &  r   $test_set_message_header_from_address8TestAddressAndGroup.test_set_message_header_from_addressF  sV    E5-06>>*$4"9:4**QD1r   c                    \        R 4      p\        \        P                  R7      pWR&   V P	                  VR,          R4       V P	                  VR,          P
                  VP
                  4       R# )ra  r   rE  r  rA  N)r   r   r   r   ra   rx  )r   r%  r   s   &  r   "test_set_message_header_from_group6TestAddressAndGroup.test_set_message_header_from_groupM  sS    )6>>*$4+.4**AKK8r   c                p   \        R RR4      pV P                  \        R RR4      V4       V P                  \        RRR4      V4       V P                  \        R RR4      V4       V P                  \        R RR4      V4       V P                  V\	        4       8H  4       V P                  V\        8H  4       R# )ro   r  rg  r   N)r
   ra   assertNotEqualassertFalseobject
assertTruer   r  s   & r   test_address_comparison+TestAddressAndGroup.test_address_comparisonT  s    E5-0}=qAGE5-@!DGE5-@!DGE5%8!<fh'Y'r   c                N   \        R RR4      p\        RV.4      pV P                  \        RV34      V4       V P                  \        RV.4      V4       V P                  \        R. 4      V4       V P	                  V\        4       8H  4       V P                  V\        8H  4       R# )ro   r  rg  ra  r   N)r
   r   ra   rL  rM  rN  rO  r   )r   r~  r%  s   &  r   test_group_comparison)TestAddressAndGroup.test_group_comparison]  s    E5-0)aS!y1$/3E%!-q1E)R0!4fh'Y'r   r+   N)(r0   r1   r2   r3   rt   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r	  r  r  r  r  r  r   r&  r*  r-  r4  r8  r;  r>  rB  rF  rI  rP  rS  r4   r5   r6   s   @r   r  r    s     &IEC9622,'*),G="&9A?P=;**+;<,0.29(( (r   r  c                   t   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tRtV tR# )TestFoldingig  c           	         R FY  w  rV P                  R\        VRR7      4      pV P                  VP                  \        P
                  R7      RV,          4       K[  	  R# )z1Test the folding and encoding of address headers.rE  za@b.comr  r   zTo: %s <a@b.com>
N)	)zFoo Bar, Francez"Foo Bar, France")zFoo Bar (France)z"Foo Bar (France)")u   Foo Bar, Españaz"Foo =?utf-8?q?Bar=2C_Espa=C3=B1a?=)u   Foo Bar (España)z Foo Bar =?utf-8?b?KEVzcGHDsWEp?=)u   Foo, Bar Españaz"=?utf-8?q?Foo=2C_Bar_Espa=C3=B1a?=)u   Foo, Bar [España]z(=?utf-8?q?Foo=2C_Bar_=5BEspa=C3=B1a=5D?=)u   Foo Bär, Francez"Foo =?utf-8?q?B=C3=A4r=2C?= France)u   Foo Bär <France>z%Foo =?utf-8?q?B=C3=A4r_=3CFrance=3E?=)ur   Lôrem ipsum dôlôr sit amet, cônsectetuer adipiscing. Suspendisse pôtenti. Aliquam nibh. Suspendisse pôtenti.z=?utf-8?q?L=C3=B4rem_ipsum_d=C3=B4l=C3=B4r_sit_amet=2C_c=C3=B4nsectetuer?=
 =?utf-8?q?_adipiscing=2E_Suspendisse_p=C3=B4tenti=2E_Aliquam_nibh=2E?=
 Suspendisse =?utf-8?q?p=C3=B4tenti=2E?=)rY   r
   ra   r   r   r   )r   rW   resultr   s   &   r   test_address_display_names&TestFolding.test_address_display_namesi  sS    LD$   wty'IJAQVV6>>V:$86$AC'r   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )rG   r_   r   zsubject: this is a test
NrY   ra   r   r   r   rb   s   & r   test_short_unstructured#TestFolding.test_short_unstructured  s7    Y(89v~~64	6r   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )r!   zhThis is a long header line that will need to be folded into two lines and will demonstrate basic foldingr   zsSubject: This is a long header line that will need to be folded into two lines
 and will demonstrate basic folding
Nr\  rb   s   & r   test_long_unstructured"TestFolding.test_long_unstructured  sA    Y )1 2 	v~~6@	Ar   c                    V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      \        P                  ! R4      4       R# )r!   z1this is a short header that will be folded anywayr  r   z                Subject: this is a
                 short header that
                 will be folded
                 anyway
                NrY   ra   r   r   r   r  textwrapdedentrb   s   & r   'test_unstructured_short_max_line_length3TestFolding.test_unstructured_short_max_line_length  sX    Y )) *FF&....r.BFCOO  	r   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )r!   r   r   zSubject: test
Nr\  rb   s   & r   "test_fold_unstructured_single_word.TestFolding.test_fold_unstructured_single_word  s4    Y/v~~68IJr   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )r!   ztest test testr   zSubject: test test test
Nr\  rb   s   & r   test_fold_unstructured_short(TestFolding.test_fold_unstructured_short  s7    Y(89v~~63	5r   c                    V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      R4       R# )r!   5thisisaverylonglineconsistingofasinglewordthatwontfitr  r   zSubject: 
 =?utf-8?q?thisisa?=
 =?utf-8?q?verylon?=
 =?utf-8?q?glineco?=
 =?utf-8?q?nsistin?=
 =?utf-8?q?gofasin?=
 =?utf-8?q?gleword?=
 =?utf-8?q?thatwon?=
 =?utf-8?q?tfit?=
NrY   ra   r   r   r   r  rb   s   & r   )test_fold_unstructured_with_overlong_word5TestFolding.test_fold_unstructured_with_overlong_word  sL    Y )$ %FF&....r.BFC"	r   c                    V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      R4       R# )r!   zXthisisaverylonglineconsistingofasinglewordthatwontfit plusanotherverylongwordthatwontfitr  r   a  Subject: 
 =?utf-8?q?thisisa?=
 =?utf-8?q?verylon?=
 =?utf-8?q?glineco?=
 =?utf-8?q?nsistin?=
 =?utf-8?q?gofasin?=
 =?utf-8?q?gleword?=
 =?utf-8?q?thatwon?=
 =?utf-8?q?tfit_pl?=
 =?utf-8?q?usanoth?=
 =?utf-8?q?erveryl?=
 =?utf-8?q?ongword?=
 =?utf-8?q?thatwon?=
 =?utf-8?q?tfit?=
Nrp  rb   s   & r   .test_fold_unstructured_with_two_overlong_words:TestFolding.test_fold_unstructured_with_two_overlong_words  sN    Y )G HFF&....r.BFC"	r   c                    V P                  R R4      pV P                  VP                  \        P                  P                  ^#R7      R7      R4       R# )r!    thislongwordislessthanmaxlinelenr  r   z+Subject:
 thislongwordislessthanmaxlinelen
Nrp  rb   s   & r   .test_fold_unstructured_with_slightly_long_word:TestFolding.test_fold_unstructured_with_slightly_long_word  sF    Y(JKFF&....r.BFC;	=r   c                    V P                  R R4      pV P                  VP                  \        P                  P                  ^<R7      R7      \        P                  ! R4      4       R# )r!   zThis header is intended to demonstrate, in a fairly succinct way, that we now do not give a , special treatment in unstructured headers.r  r   z                Subject: This header is intended to demonstrate, in a fairly
                 succinct way, that we now do not give a , special treatment
                 in unstructured headers.
                 Nrc  rb   s   & r   "test_fold_unstructured_with_commas.TestFolding.test_fold_unstructured_with_commas  s\    Y )F G 	FF&....r.BFCOO  	r   c                    V P                  R R4      pV P                  VP                  \        P                  R7      \
        P                  ! R4      4       R# )rE  z"Theodore H. Perfect" <yes@man.com>, "My address is very long because my name is long" <foo@bar.com>, "Only A. Friend" <no@yes.com>r   z            To: "Theodore H. Perfect" <yes@man.com>,
             "My address is very long because my name is long" <foo@bar.com>,
             "Only A. Friend" <no@yes.com>
             N)rY   ra   r   r   r   rd  re  rb   s   & r   test_fold_address_list"TestFolding.test_fold_address_list  sK    T $, - 	v~~6 I 9 	r   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )r   zSat, 2 Feb 2002 17:00:06 -0800r   z&Date: Sat, 02 Feb 2002 17:00:06 -0800
Nr\  rb   s   & r   test_fold_date_header!TestFolding.test_fold_date_header  s8    V%EFv~~6A	Cr   c                    V P                  R R4      pV P                  VP                  \        P                  R7      R4       R# )zX-Report-Abusez]<https://www.mailitapp.com/report_abuse.php?mid=xxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx==-xxx-xx-xx>r   zX-Report-Abuse: =?utf-8?q?=3Chttps=3A//www=2Emailitapp=2Ecom/report=5Fabuse?=
 =?utf-8?q?=2Ephp=3Fmid=3Dxxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx=3D=3D-xxx-xx-xx?=
 =?utf-8?q?=3E?=
Nr\  rb   s   & r   &test_fold_overlong_words_using_RFC20472TestFolding.test_fold_overlong_words_using_RFC2047  sC    BC 	FF&..F)!	"r   c                   V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      R4       V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      R4       V P                  R R4      pV P                  VP                  \        P                  P                  ^R7      R7      R4       V P                  R R	4      pV P                  VP                  \        P                  P                  ^R7      R7      R
4       R# )z
Message-IDz+<somemessageidlongerthan@maxlinelength.com>r  r   z8Message-ID: <somemessageidlongerthan@maxlinelength.com>
z1<somemessageidlongerthan@[127.0.0.0.0.0.0.0.0.1]>z>Message-ID: <somemessageidlongerthan@[127.0.0.0.0.0.0.0.0.1]>
u   <ईमेल@wők.com>u$   Message-ID: <ईमेल@wők.com>
u"   <ईमेलfromMessage@wők.com>u0   Message-ID:
 <ईमेलfromMessage@wők.com>
Nrp  rb   s   & r   $test_message_id_header_is_not_folded0TestFolding.test_message_id_header_is_not_folded  s&   9; 	FF&....r.BFCG	I
 ?A 	FF&....r.BFCM	O
 \+DEFF&....r.BFC3	5 \+OPFF&....r.BFC@	Br   r+   N)r0   r1   r2   r3   rY  r]  r`  rf  ri  rl  rq  rt  rx  r{  r~  r  r  r  r4   r5   r6   s   @r   rV  rV  g  sV     C06
A
K5
 .=C
"B Br   rV  __main__)!r   rd  unittestemailr   r   email.messager   test.test_emailr   r   r	   email.headerregistryr
   r   test.supportr   rN  r   r   rU   r\   r   r   r   r*  r7  rF  rZ  r  rV  r0   mainr+   r   r   <module>r     s_        ! 7   / " 	7K 7Kt)] )"0^ "0\ %^ % %P >6^ >6 >6B tN t tn ). ) )X O^ O Od Z
N Z
 Z
z }C }C }C@
b(- b(JnB. nB` zMMO r   