summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-10-14 15:26:17 (GMT)
committerBarry Warsaw <barry@python.org>2002-10-14 15:26:17 (GMT)
commita74771c0b9f0110de51e15647d47852ea82cea46 (patch)
treef1a038377a2a05bd4e2f64e96842bb24263a2441
parent1a6ea3398efdf635cebcc1f97ef522ba80c228d1 (diff)
downloadcpython-a74771c0b9f0110de51e15647d47852ea82cea46.zip
cpython-a74771c0b9f0110de51e15647d47852ea82cea46.tar.gz
cpython-a74771c0b9f0110de51e15647d47852ea82cea46.tar.bz2
Two new tests for splitting (or not splitting) 8-bit header data.
-rw-r--r--Lib/email/test/test_email.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index daf9e28..176e774 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -703,6 +703,27 @@ from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93]
\tid 17k4h5-00034i-00
\tfor test@mems-exchange.org; Wed, 28 Aug 2002 11:25:20 -0400""")
+ def test_long_8bit_header(self):
+ eq = self.ndiffAssertEqual
+ msg = Message()
+ h = Header('Britische Regierung gibt', 'iso-8859-1')
+ h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte')
+ msg['Subject'] = h
+ eq(msg.as_string(), """\
+Subject: =?iso-8859-1?q?Britische_Regierung_gibt?=
+ =?iso-8859-1?q?gr=FCnes_Licht_f=FCr_Offshore-Windkraftprojekte?=
+
+""")
+
+ def test_long_8bit_header_no_charset(self):
+ eq = self.ndiffAssertEqual
+ msg = Message()
+ msg['Reply-To'] = 'Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>'
+ eq(msg.as_string(), """\
+Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>
+
+""")
+
# Test mangling of "From " lines in the body of a message