mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
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.
This commit is contained in:
parent
b8a55c00d5
commit
06069330e3
1 changed files with 12 additions and 0 deletions
|
@ -117,6 +117,10 @@ class MessageTestCase(unittest.TestCase):
|
||||||
('', 'goit@lip.com'),
|
('', 'goit@lip.com'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
self.check(
|
||||||
|
'To: person@dom.ain (User J. Person)\n\n',
|
||||||
|
[('User J. Person', 'person@dom.ain')])
|
||||||
|
|
||||||
def test_twisted(self):
|
def test_twisted(self):
|
||||||
# This one is just twisted. I don't know what the proper
|
# This one is just twisted. I don't know what the proper
|
||||||
# result should be, but it shouldn't be to infloop, which is
|
# result should be, but it shouldn't be to infloop, which is
|
||||||
|
@ -164,5 +168,13 @@ class MessageTestCase(unittest.TestCase):
|
||||||
'foo',
|
'foo',
|
||||||
[('', 'guido@[132.151.1.21]')])
|
[('', '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)
|
test_support.run_unittest(MessageTestCase)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue