[Python-checkins] python/dist/src/Lib/test test_rfc822.py,1.15,1.16

bwarsaw@sourceforge.net bwarsaw@sourceforge.net
Tue, 21 May 2002 12:46:15 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20770/Lib/test

Modified Files:
	test_rfc822.py 
Log Message:
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.


Index: test_rfc822.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** test_rfc822.py	13 Nov 2001 21:33:52 -0000	1.15
--- test_rfc822.py	21 May 2002 19:46:13 -0000	1.16
***************
*** 186,190 ****
                     [('User J. Person', 'person@dom.ain')])
  
!     # This takes to long to add to the test suite
  ##    def test_an_excrutiatingly_long_address_field(self):
  ##        OBSCENELY_LONG_HEADER_MULTIPLIER = 10000
--- 186,190 ----
                     [('User J. Person', 'person@dom.ain')])
  
!     # This takes too long to add to the test suite
  ##    def test_an_excrutiatingly_long_address_field(self):
  ##        OBSCENELY_LONG_HEADER_MULTIPLIER = 10000
***************
*** 194,197 ****
--- 194,216 ----
  ##        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():