From edb59c1ee8872d4a9f5e57b39874ca1d115f2fd4 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 30 Dec 2002 16:19:52 +0000 Subject: [PATCH] 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. --- Lib/email/test/test_email.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 61b412a9afe..cbcc0df1b11 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 ' + y = '"John X. Doe" ' + 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')),