[Python-checkins]
python/dist/src/Lib/email/test test_email.py, 1.66, 1.67
bwarsaw at users.sourceforge.net
bwarsaw at users.sourceforge.net
Mon Nov 29 04:46:56 CET 2004
Update of /cvsroot/python/python/dist/src/Lib/email/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19352/Lib/email/test
Modified Files:
test_email.py
Log Message:
RFC 2822 describes the characters allowed in a header field name. Conform to
this, and add test cases.
Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- test_email.py 28 Nov 2004 00:21:42 -0000 1.66
+++ test_email.py 29 Nov 2004 03:46:54 -0000 1.67
@@ -2402,6 +2402,22 @@
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 at 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):
More information about the Python-checkins
mailing list