Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit edb59c1

Browse files
committed
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.
1 parent fa91858 commit edb59c1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Lib/email/test/test_email.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,15 @@ def test_escape_dump(self):
16871687
16881688
self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
16891689

1690+
def test_name_with_dot(self):
1691+
x = 'John X. Doe <[email protected]>'
1692+
y = '"John X. Doe" <[email protected]>'
1693+
a, b = ('John X. Doe', '[email protected]')
1694+
self.assertEqual(Utils.parseaddr(x), (a, b))
1695+
self.assertEqual(Utils.parseaddr(y), (a, b))
1696+
# formataddr() quotes the name if there's a dot in it
1697+
self.assertEqual(Utils.formataddr((a, b)), y)
1698+
16901699
def test_quote_dump(self):
16911700
self.assertEqual(
16921701
Utils.formataddr(('A Silly; Person', '[email protected]')),

0 commit comments

Comments
 (0)