summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-10-21 05:43:58 (GMT)
committerBarry Warsaw <barry@python.org>2002-10-21 05:43:58 (GMT)
commit41118045483790571f96fdf75a5689c0c3a93eeb (patch)
tree3bb059438bd31ddc1e09bfe116814b39fe6d104e /Lib/email
parent34aa44538d894e1b3bc1bf12a42f60c0fd74ccde (diff)
downloadcpython-41118045483790571f96fdf75a5689c0c3a93eeb.zip
cpython-41118045483790571f96fdf75a5689c0c3a93eeb.tar.gz
cpython-41118045483790571f96fdf75a5689c0c3a93eeb.tar.bz2
test_body_encoding(): a new test for Charset.body_encode(), especially
one that tests the obscure bug reported in SF # 625509.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/test/test_email.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 5b93d8b..6a36581 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2080,6 +2080,13 @@ two line""")
# 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
# Make sure us-ascii = no Unicode conversion
@@ -2114,6 +2121,13 @@ class TestCharset(unittest.TestCase):
except LookupError:
# 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'))