summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email_codecs.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2006-02-08 14:34:21 (GMT)
committerBarry Warsaw <barry@python.org>2006-02-08 14:34:21 (GMT)
commite58df82919808939f21e9756af65c5afb5d8b2e5 (patch)
treeebf1e42f435a305f4259a53b2d34675ff5f2bc1c /Lib/email/test/test_email_codecs.py
parenta871ef2b3e924f058ec1b0aed7d4c83a546414b7 (diff)
downloadcpython-e58df82919808939f21e9756af65c5afb5d8b2e5.zip
cpython-e58df82919808939f21e9756af65c5afb5d8b2e5.tar.gz
cpython-e58df82919808939f21e9756af65c5afb5d8b2e5.tar.bz2
Port relevant patches for SF 1409455 to the trunk for email 3.0/Python 2.5.
Will port to Python 2.4.
Diffstat (limited to 'Lib/email/test/test_email_codecs.py')
-rw-r--r--Lib/email/test/test_email_codecs.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/email/test/test_email_codecs.py b/Lib/email/test/test_email_codecs.py
index 75ef081..159989c 100644
--- a/Lib/email/test/test_email_codecs.py
+++ b/Lib/email/test/test_email_codecs.py
@@ -1,4 +1,5 @@
-# Copyright (C) 2002 Python Software Foundation
+# Copyright (C) 2002-2006 Python Software Foundation
+# Contact: email-sig@python.org
# email package unit tests for (optional) Asian codecs
import unittest
@@ -7,6 +8,8 @@ from test.test_support import TestSkipped, run_unittest
from email.test.test_email import TestEmailBase
from email.Charset import Charset
from email.Header import Header, decode_header
+from email.Message import Message
+
class TestEmailAsianCodecs(TestEmailBase):
@@ -42,6 +45,14 @@ Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=
# TK: full decode comparison
eq(h.__unicode__().encode('euc-jp'), long)
+ def test_payload_encoding(self):
+ jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa'
+ jcode = 'euc-jp'
+ msg = Message()
+ msg.set_payload(jhello, jcode)
+ ustr = unicode(msg.get_payload(), msg.get_content_charset())
+ self.assertEqual(jhello, ustr.encode(jcode))
+
def suite():