summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-06-29 05:58:45 (GMT)
committerBarry Warsaw <barry@python.org>2002-06-29 05:58:45 (GMT)
commit9546e7972cd7fafa7da597cd433c6a59a3198ad8 (patch)
tree9797f7c4552229eaacd17a7cd2593013773fb604
parent12566a8826ad7afe123f035a43483fe97a2fa3c5 (diff)
downloadcpython-9546e7972cd7fafa7da597cd433c6a59a3198ad8.zip
cpython-9546e7972cd7fafa7da597cd433c6a59a3198ad8.tar.gz
cpython-9546e7972cd7fafa7da597cd433c6a59a3198ad8.tar.bz2
Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
New test cases.
-rw-r--r--Lib/test/data/msg_29.txt22
-rw-r--r--Lib/test/test_email.py13
2 files changed, 34 insertions, 1 deletions
diff --git a/Lib/test/data/msg_29.txt b/Lib/test/data/msg_29.txt
new file mode 100644
index 0000000..1fab561
--- /dev/null
+++ b/Lib/test/data/msg_29.txt
@@ -0,0 +1,22 @@
+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-Type: text/plain; charset=us-ascii;
+ title*0*="us-ascii'en'This%20is%20even%20more%20";
+ title*1*="%2A%2A%2Afun%2A%2A%2A%20";
+ title*2="isn't it!"
+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
+
+
+Hi,
+
+Do you like this message?
+
+-Me
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index b617bc0..efca478 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -158,7 +158,7 @@ class TestMessageAPI(TestEmailBase):
msg.set_boundary('BOUNDARY')
header, value = msg.items()[4]
eq(header.lower(), 'content-type')
- eq(value, 'text/plain; charset=us-ascii; boundary="BOUNDARY"')
+ eq(value, 'text/plain; charset="us-ascii"; boundary="BOUNDARY"')
# This one has a Content-Type: header, with a boundary, stuck in the
# middle of its headers. Make sure the order is preserved; it should
# be fifth.
@@ -1787,6 +1787,17 @@ A very long line that must get split to something other than at the
eq(h.encode(), hstr)
+# Test RFC 2231 header parameters decoding
+class TestRFC2231(TestEmailBase):
+ def test_get_param(self):
+ eq = self.assertEqual
+ msg = self._msgobj('msg_29.txt')
+ eq(msg.get_param('title'),
+ ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!'))
+ eq(msg.get_param('title', unquote=0),
+ ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"'))
+
+
def _testclasses():
mod = sys.modules[__name__]