summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-09-28 21:04:19 (GMT)
committerBarry Warsaw <barry@python.org>2002-09-28 21:04:19 (GMT)
commiteecdc742f5700d05b086321cb0d68e80498c67cb (patch)
tree445860a36340d4fc5162ed2a31e604ccd9bc3f34 /Lib/email/test
parentc202d93e0ebadfe9d1d61dbfa0b43a32a81cf9aa (diff)
downloadcpython-eecdc742f5700d05b086321cb0d68e80498c67cb.zip
cpython-eecdc742f5700d05b086321cb0d68e80498c67cb.tar.gz
cpython-eecdc742f5700d05b086321cb0d68e80498c67cb.tar.bz2
Add a test for SHORTEST encoding of utf-8 headers, and also update
some of the test values which change because of this.
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/test_email.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 46e1b00..4599156 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -580,9 +580,9 @@ Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?=
=?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?=
=?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?=
=?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?=
- =?utf-8?b?cyBOdW5zdHVjayBnaXQgdW5k?=
- =?utf-8?b?IFNsb3Rlcm1leWVyPyBKYSEgQmVpaGVyaHVuZCBkYXMgT2Rl?=
- =?utf-8?b?ciBkaWUgRmxpcHBlcndhbGR0?=
+ =?utf-8?q?s_Nunstuck_git_und?=
+ =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?=
+ =?utf-8?q?r_die_Flipperwaldt?=
=?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=
''')
@@ -598,9 +598,9 @@ Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?=
=?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?=
=?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?=
=?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?=
- =?utf-8?b?cyBOdW5zdHVjayBnaXQgdW5k?=
- =?utf-8?b?IFNsb3Rlcm1leWVyPyBKYSEgQmVpaGVyaHVuZCBkYXMgT2Rl?=
- =?utf-8?b?ciBkaWUgRmxpcHBlcndhbGR0?=
+ =?utf-8?q?s_Nunstuck_git_und?=
+ =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?=
+ =?utf-8?q?r_die_Flipperwaldt?=
=?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=''')
def test_long_header_encode(self):
@@ -2088,9 +2088,9 @@ class TestHeader(TestEmailBase):
=?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?=
=?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?=
=?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?=
- =?utf-8?b?cyBOdW5zdHVjayBnaXQgdW5k?=
- =?utf-8?b?IFNsb3Rlcm1leWVyPyBKYSEgQmVpaGVyaHVuZCBkYXMgT2Rl?=
- =?utf-8?b?ciBkaWUgRmxpcHBlcndhbGR0?=
+ =?utf-8?q?s_Nunstuck_git_und?=
+ =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?=
+ =?utf-8?q?r_die_Flipperwaldt?=
=?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=""")
eq(decode_header(enc),
[(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"),
@@ -2165,6 +2165,13 @@ A very long line that must get split to something other than at the
## raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii')
## raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1')
+ def test_utf8_shortest(self):
+ eq = self.assertEqual
+ h = Header(u'p\xf6stal', 'utf-8')
+ eq(h.encode(), '=?utf-8?q?p=C3=B6stal?=')
+ h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8')
+ eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=')
+
# Test RFC 2231 header parameters (en/de)coding