summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-05-19 23:52:54 (GMT)
committerBarry Warsaw <barry@python.org>2002-05-19 23:52:54 (GMT)
commite0d85c834a5b3b0473d3e0e89efe9572d6a426ac (patch)
tree91113b50da45f8ef6f7d88616bb73be935e86d6f /Lib/test
parent7e21b6792babc785f96779d3881299ab643f7a1d (diff)
downloadcpython-e0d85c834a5b3b0473d3e0e89efe9572d6a426ac.zip
cpython-e0d85c834a5b3b0473d3e0e89efe9572d6a426ac.tar.gz
cpython-e0d85c834a5b3b0473d3e0e89efe9572d6a426ac.tar.bz2
Add two new tests of recent email package fixes: CRLF line endings,
and explicit maxlinelen arguments to the Header constructor.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index 5d6adc0..c4b185a 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -1323,6 +1323,18 @@ Here's the message body
eq(msg['message-id'], 'spam')
eq(msg.get_payload(), "Here's the message body\n")
+ def test_crlf_separation(self):
+ eq = self.assertEqual
+ fp = openfile('msg_26.txt')
+ p = Parser()
+ msg = p.parse(fp)
+ eq(len(msg.get_payload()), 2)
+ part1 = msg.get_payload(0)
+ eq(part1.get_type(), 'text/plain')
+ eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n')
+ part2 = msg.get_payload(1)
+ eq(part2.get_type(), 'application/riscos')
+
class TestBase64(unittest.TestCase):
@@ -1573,6 +1585,20 @@ class TestHeader(unittest.TestCase):
[(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"),
(utf8_head, "utf-8")])
+ def test_explicit_maxlinelen(self):
+ eq = self.assertEqual
+ hstr = 'A very long line that must get split to something other than at the 76th character boundary to test the non-default behavior'
+ h = Header(hstr)
+ eq(h.encode(), '''\
+A very long line that must get split to something other than at the 76th cha
+ racter boundary to test the non-default behavior''')
+ h = Header(hstr, header_name='Subject')
+ eq(h.encode(), '''\
+A very long line that must get split to something other than at the
+ 76th character boundary to test the non-default behavior''')
+ h = Header(hstr, maxlinelen=1024, header_name='Subject')
+ eq(h.encode(), hstr)
+
def _testclasses():