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

barry@users.sourceforge.net barry@users.sourceforge.net
Thu, 26 Sep 2002 10:21:04 -0700


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

Modified Files:
	test_email.py 
Log Message:
Fixing some RFC 2231 related issues as reported in the Spambayes
project, and with assistance from Oleg Broytmann.  Specifically,
added some new tests to make sure we handle RFC 2231 encoded
parameters correctly.  Two new data files were added which contain RFC
2231 encoded parameters.


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_email.py	18 Sep 2002 22:17:57 -0000	1.11
--- test_email.py	26 Sep 2002 17:21:01 -0000	1.12
***************
*** 1466,1469 ****
--- 1466,1477 ----
          self._idempotent(msg, text)
  
+     def test_rfc2231_charset(self):
+         msg, text = self._msgobj('msg_32.txt')
+         self._idempotent(msg, text)
+ 
+     def test_more_rfc2231_parameters(self):
+         msg, text = self._msgobj('msg_33.txt')
+         self._idempotent(msg, text)
+ 
      def test_content_type(self):
          eq = self.assertEquals
***************
*** 1515,1518 ****
--- 1523,1527 ----
          eq(msg1.get_payload(), '\n')
  
+ 
  
  # Test various other bits of the package's functionality
***************
*** 2148,2151 ****
--- 2157,2169 ----
          eq(h, '=?iso-8859-1?q?hello?=')
  
+     def test_unicode_error(self):
+         raises = self.assertRaises
+         raises(UnicodeError, Header, u'[P\xf6stal]', 'us-ascii')
+         raises(UnicodeError, Header, '[P\xf6stal]', 'us-ascii')
+         h = Header()
+         raises(UnicodeError, h.append, u'[P\xf6stal]', 'us-ascii')
+         raises(UnicodeError, h.append, '[P\xf6stal]', 'us-ascii')
+         raises(UnicodeError, Header, u'\u83ca\u5730\u6642\u592b', 'iso-8859-1')
+ 
  
  
***************
*** 2226,2229 ****
--- 2244,2252 ----
  -Me
  """)
+ 
+     def test_rfc2231_get_content_charset(self):
+         eq = self.assertEqual
+         msg = self._msgobj('msg_32.txt')
+         eq(msg.get_content_charset(), 'us-ascii')