[Python-checkins] python/dist/src/Lib/email/test test_email.py,1.24,1.25

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Mon, 30 Dec 2002 08:19:54 -0800


Update of /cvsroot/python/python/dist/src/Lib/email/test
In directory sc8-pr-cvs1:/tmp/cvs-serv11868

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


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** test_email.py	5 Nov 2002 21:36:17 -0000	1.24
--- test_email.py	30 Dec 2002 16:19:52 -0000	1.25
***************
*** 1688,1691 ****
--- 1688,1700 ----
          self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
  
+     def test_name_with_dot(self):
+         x = 'John X. Doe <jxd@example.com>'
+         y = '"John X. Doe" <jxd@example.com>'
+         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(