diff options
author | Barry Warsaw <barry@python.org> | 2002-05-21 19:46:13 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-05-21 19:46:13 (GMT) |
commit | 0a8d4d5736c8cceda74e7134a6ff446fbee1d5cc (patch) | |
tree | a4398880090f36d335aceb320098fb563c656b6d /Lib/test | |
parent | 6cf09f0792df49527cda241743a34c3555a83835 (diff) | |
download | cpython-0a8d4d5736c8cceda74e7134a6ff446fbee1d5cc.zip cpython-0a8d4d5736c8cceda74e7134a6ff446fbee1d5cc.tar.gz cpython-0a8d4d5736c8cceda74e7134a6ff446fbee1d5cc.tar.bz2 |
Message.getaddrlist(): Use the AddressList.addresslist attribute
instead of calling the getaddrlist() method, since the latter doesn't
work with multiple calls (it will return the empty list for the second
and subsequent calls).
Closes SF bug #555035. Include a unittest.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_rfc822.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py index 0244f0d..dfce7c9 100644 --- a/Lib/test/test_rfc822.py +++ b/Lib/test/test_rfc822.py @@ -185,7 +185,7 @@ class MessageTestCase(unittest.TestCase): self.check('To: User J. Person <person@dom.ain>\n\n', [('User J. Person', 'person@dom.ain')]) - # This takes to long to add to the test suite + # This takes too long to add to the test suite ## def test_an_excrutiatingly_long_address_field(self): ## OBSCENELY_LONG_HEADER_MULTIPLIER = 10000 ## oneaddr = ('Person' * 10) + '@' + ('.'.join(['dom']*10)) + '.com' @@ -193,6 +193,25 @@ class MessageTestCase(unittest.TestCase): ## lst = rfc822.AddrlistClass(addr).getaddrlist() ## self.assertEqual(len(lst), OBSCENELY_LONG_HEADER_MULTIPLIER) + def test_2getaddrlist(self): + eq = self.assertEqual + msg = self.create_message("""\ +To: aperson@dom.ain +Cc: bperson@dom.ain +Cc: cperson@dom.ain +Cc: dperson@dom.ain + +A test message. +""") + ccs = [('', a) for a in + ['bperson@dom.ain', 'cperson@dom.ain', 'dperson@dom.ain']] + addrs = msg.getaddrlist('cc') + addrs.sort() + eq(addrs, ccs) + # Try again, this one used to fail + addrs = msg.getaddrlist('cc') + addrs.sort() + eq(addrs, ccs) def test_main(): test_support.run_unittest(MessageTestCase) |