diff options
author | Barry Warsaw <barry@python.org> | 2004-11-29 03:46:54 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2004-11-29 03:46:54 (GMT) |
commit | f4c7c402d4944c3e1ff1a83925d5e11549ff4e36 (patch) | |
tree | 0f751939c916dec67d2c6d5a7d974440e3eb3594 /Lib/email/test | |
parent | e48bad7a24d5bc6cd1677d94ac669009d561744a (diff) | |
download | cpython-f4c7c402d4944c3e1ff1a83925d5e11549ff4e36.zip cpython-f4c7c402d4944c3e1ff1a83925d5e11549ff4e36.tar.gz cpython-f4c7c402d4944c3e1ff1a83925d5e11549ff4e36.tar.bz2 |
RFC 2822 describes the characters allowed in a header field name. Conform to
this, and add test cases.
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index c620442..2d3841b3 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -2402,6 +2402,22 @@ Here's the message body eq(msg.get('Header'), value1) eq(msg.get('Next-Header'), value2) + def test_rfc2822_header_syntax(self): + eq = self.assertEqual + m = '>From: foo\nFrom: bar\n!"#QUX;~: zoo\n\nbody' + msg = email.message_from_string(m) + eq(len(msg.keys()), 3) + keys = msg.keys() + keys.sort() + eq(keys, ['!"#QUX;~', '>From', 'From']) + eq(msg.get_payload(), 'body') + + def test_rfc2822_space_not_allowed_in_header(self): + eq = self.assertEqual + m = '>From foo@example.com 11:25:53\nFrom: bar\n!"#QUX;~: zoo\n\nbody' + msg = email.message_from_string(m) + eq(len(msg.keys()), 0) + class TestBase64(unittest.TestCase): |