diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-12-13 23:57:01 +0000 |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-12-13 23:57:01 +0000 |
commit | ccb9d05b6c6b32ac9429f90cf24a1da477fde79e (patch) | |
tree | a8ca264f47d0a9a985968c5397389315bd444c57 /Lib/email/test | |
parent | fa66d583f6eb79c95ff07a84cbae1d44c81f5b8e (diff) | |
download | cpython-ccb9d05b6c6b32ac9429f90cf24a1da477fde79e.tar.gz cpython-ccb9d05b6c6b32ac9429f90cf24a1da477fde79e.zip |
Merged revisions 87217 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87217 | r.david.murray | 2010-12-13 18:51:19 -0500 (Mon, 13 Dec 2010) | 5 lines
#1078919: make add_header automatically do RFC2231 encoding when needed.
Also document the use of three-tuples if control of the charset
and language is desired.
........
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 2d6b51de3cb..ee991eef86b 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -504,6 +504,29 @@ class TestMessageAPI(TestEmailBase): self.assertEqual(msg.get_payload(decode=True), bytes(x, 'raw-unicode-escape')) + # Issue 1078919 + def test_ascii_add_header(self): + msg = Message() + msg.add_header('Content-Disposition', 'attachment', + filename='bud.gif') + self.assertEqual('attachment; filename="bud.gif"', + msg['Content-Disposition']) + + def test_noascii_add_header(self): + msg = Message() + msg.add_header('Content-Disposition', 'attachment', + filename="Fußballer.ppt") + self.assertEqual( + 'attachment; filename*="utf-8\'\'Fu%C3%9Fballer.ppt"', + msg['Content-Disposition']) + + def test_nonascii_add_header_via_triple(self): + msg = Message() + msg.add_header('Content-Disposition', 'attachment', + filename=('iso-8859-1', '', 'Fußballer.ppt')) + self.assertEqual( + 'attachment; filename*="iso-8859-1\'\'Fu%DFballer.ppt"', + msg['Content-Disposition']) # Test the email.encoders module |