diff options
author | Barry Warsaw <barry@python.org> | 2001-10-17 20:52:26 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-10-17 20:52:26 (GMT) |
commit | 07227d1ec027b8a6b189fecf4ac9eb555e2b0ec7 (patch) | |
tree | 4e4455a452a9c0b1b76d49bf984320c1c36ca0d8 /Lib/test | |
parent | d1eeecbd431ddd85a012f7e24fd7123b96ba4324 (diff) | |
download | cpython-07227d1ec027b8a6b189fecf4ac9eb555e2b0ec7.zip cpython-07227d1ec027b8a6b189fecf4ac9eb555e2b0ec7.tar.gz cpython-07227d1ec027b8a6b189fecf4ac9eb555e2b0ec7.tar.bz2 |
Two merges from the mimelib project:
test_no_semis_header_splitter(): This actually should still split.
test_no_split_long_header(): An example of an unsplittable line.
test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
splitting long headers.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_email.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index fe6ffd2..e0180f7 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -28,6 +28,7 @@ from test_support import findfile NL = '\n' EMPTYSTRING = '' +SPACE = ' ' @@ -276,6 +277,39 @@ class TestLongHeaders(unittest.TestCase): g(msg) self.assertEqual(sfp.getvalue(), openfile('msg_18.txt').read()) + def test_no_semis_header_splitter(self): + msg = Message() + msg['From'] = 'test@dom.ain' + refparts = [] + for i in range(10): + refparts.append('<%d@dom.ain>' % i) + msg['References'] = SPACE.join(refparts) + msg.set_payload('Test') + sfp = StringIO() + g = Generator(sfp) + g(msg) + self.assertEqual(sfp.getvalue(), """\ +From: test@dom.ain +References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain> + <5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain> + +Test""") + + def test_no_split_long_header(self): + msg = Message() + msg['From'] = 'test@dom.ain' + refparts = [] + msg['References'] = 'x' * 80 + msg.set_payload('Test') + sfp = StringIO() + g = Generator(sfp) + g(msg) + self.assertEqual(sfp.getvalue(), """\ +From: test@dom.ain +References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +Test""") + # Test mangling of "From " lines in the body of a message |