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

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Sun, 20 Oct 2002 22:44:00 -0700


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

Modified Files:
	test_email.py 
Log Message:
test_body_encoding(): a new test for Charset.body_encode(), especially
one that tests the obscure bug reported in SF # 625509.


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** test_email.py	21 Oct 2002 05:31:08 -0000	1.21
--- test_email.py	21 Oct 2002 05:43:58 -0000	1.22
***************
*** 2081,2084 ****
--- 2081,2091 ----
  # Test the Charset class
  class TestCharset(unittest.TestCase):
+     def tearDown(self):
+         from email import Charset as CharsetModule
+         try:
+             del CharsetModule.CHARSETS['fake']
+         except KeyError:
+             pass
+ 
      def test_idempotent(self):
          eq = self.assertEqual
***************
*** 2115,2118 ****
--- 2122,2132 ----
              # We probably don't have the Japanese codecs installed
              pass
+         # Testing SF bug #625509, which we have to fake, since there are no
+         # built-in encodings where the header encoding is QP but the body
+         # encoding is not.
+         from email import Charset as CharsetModule
+         CharsetModule.add_charset('fake', CharsetModule.QP, None)
+         c = Charset('fake')
+         eq('hello w\xf6rld', c.body_encode('hello w\xf6rld'))