summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-07-16 20:44:16 (GMT)
committerBarry Warsaw <barry@python.org>2001-07-16 20:44:16 (GMT)
commit06069330e33caa2ff936f2a6cf596938bb91bad8 (patch)
tree252665352c1fe548d34ebb1b88176671766fe2bc /Lib
parentb8a55c00d51643bdfdad5b7c35437eaf1b00a7be (diff)
downloadcpython-06069330e33caa2ff936f2a6cf596938bb91bad8.zip
cpython-06069330e33caa2ff936f2a6cf596938bb91bad8.tar.gz
cpython-06069330e33caa2ff936f2a6cf596938bb91bad8.tar.bz2
test_basic(): Add a test for "person@dom.ain (User J. Person)" which
was already correctly parsed (contrary to a comment in Mailman). test_rfc2822_phrases(): RFC 2822 now requires that we allow `.' in phrases, which means we must accept dots in unquoted realname parts. Add a test to check the change in rfc822.py 1.58.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_rfc822.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py
index 5427257..4040cdb 100644
--- a/Lib/test/test_rfc822.py
+++ b/Lib/test/test_rfc822.py
@@ -117,6 +117,10 @@ class MessageTestCase(unittest.TestCase):
('', 'goit@lip.com'),
])
+ self.check(
+ 'To: person@dom.ain (User J. Person)\n\n',
+ [('User J. Person', 'person@dom.ain')])
+
def test_twisted(self):
# This one is just twisted. I don't know what the proper
# result should be, but it shouldn't be to infloop, which is
@@ -164,5 +168,13 @@ class MessageTestCase(unittest.TestCase):
'foo',
[('', 'guido@[132.151.1.21]')])
+ def test_rfc2822_phrases(self):
+ # RFC 2822 (the update to RFC 822) specifies that dots in phrases are
+ # obsolete syntax, which conforming programs MUST recognize but NEVER
+ # generate (see $4.1 Miscellaneous obsolete tokens). This is a
+ # departure from RFC 822 which did not allow dots in non-quoted
+ # phrases.
+ self.check('To: User J. Person <person@dom.ain>\n\n',
+ [('User J. Person', 'person@dom.ain')])
test_support.run_unittest(MessageTestCase)