summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-12-30 16:19:52 (GMT)
committerBarry Warsaw <barry@python.org>2002-12-30 16:19:52 (GMT)
commitedb59c1ee8872d4a9f5e57b39874ca1d115f2fd4 (patch)
treed784a56e893ec62b1547f9d9a187dd93de368b94 /Lib/email/test/test_email.py
parentfa91858c6c6b1f51bf5aa2483f3e6df9c86dca41 (diff)
downloadcpython-edb59c1ee8872d4a9f5e57b39874ca1d115f2fd4.zip
cpython-edb59c1ee8872d4a9f5e57b39874ca1d115f2fd4.tar.gz
cpython-edb59c1ee8872d4a9f5e57b39874ca1d115f2fd4.tar.bz2
test_name_with_dots(): A new test to ensure that we're implementing
RFC 2822's rules w.r.t. dots in the realname part of address fields.
Diffstat (limited to 'Lib/email/test/test_email.py')
-rw-r--r--Lib/email/test/test_email.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 61b412a..cbcc0df 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -1687,6 +1687,15 @@ class TestMiscellaneous(unittest.TestCase):
b = 'person@dom.ain'
self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
+ def test_name_with_dot(self):
+ x = 'John X. Doe <jxd@example.com>'
+ y = '"John X. Doe" <jxd@example.com>'
+ a, b = ('John X. Doe', 'jxd@example.com')
+ self.assertEqual(Utils.parseaddr(x), (a, b))
+ self.assertEqual(Utils.parseaddr(y), (a, b))
+ # formataddr() quotes the name if there's a dot in it
+ self.assertEqual(Utils.formataddr((a, b)), y)
+
def test_quote_dump(self):
self.assertEqual(
Utils.formataddr(('A Silly; Person', 'person@dom.ain')),