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

Skip to content

Commit 4be9ecc

Browse files
committed
getaddresses(): Like the change in rfc822.py, this one needs to access
the AddressList.addresslist attribute directly. Also, add a test case for the email.Utils.getaddresses() interface.
1 parent c421ad4 commit 4be9ecc

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lib/email/Utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def getaddresses(fieldvalues):
113113
"""Return a list of (REALNAME, EMAIL) for each fieldvalue."""
114114
all = COMMASPACE.join(fieldvalues)
115115
a = _AddressList(all)
116-
return a.getaddrlist()
116+
return a.addresslist
117117

118118

119119

Lib/test/test_email.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,13 @@ def test_charset_richcomparisons(self):
12351235
eq(cset1, cset2)
12361236
eq(cset2, cset1)
12371237

1238+
def test_getaddresses(self):
1239+
eq = self.assertEqual
1240+
eq(Utils.getaddresses(['[email protected] (Al Person)',
1241+
'Bud Person <[email protected]>']),
1242+
[('Al Person', '[email protected]'),
1243+
('Bud Person', '[email protected]')])
1244+
12381245

12391246

12401247
# Test the iterator/generators

0 commit comments

Comments
 (0)