summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-07-23 19:46:35 (GMT)
committerBarry Warsaw <barry@python.org>2002-07-23 19:46:35 (GMT)
commit10d0d595e053290f17e51a95f8b25b4904ad45fe (patch)
tree3414b4ac485addfadcde32fd0dc5880a49b8dc88
parentb5da606dfd51c65b1bcbcb4b3165d36e313c16c8 (diff)
downloadcpython-10d0d595e053290f17e51a95f8b25b4904ad45fe.zip
cpython-10d0d595e053290f17e51a95f8b25b4904ad45fe.tar.gz
cpython-10d0d595e053290f17e51a95f8b25b4904ad45fe.tar.bz2
Added a couple of more tests for Header charset handling.
-rw-r--r--Lib/email/test/test_email.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 734e854..e4fb8bf 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2043,7 +2043,22 @@ A very long line that must get split to something other than at the
h = Header(hstr, maxlinelen=1024, header_name='Subject')
eq(h.encode(), hstr)
+ def test_us_ascii_header(self):
+ eq = self.assertEqual
+ s = 'hello'
+ x = decode_header(s)
+ eq(x, [('hello', None)])
+ h = make_header(x)
+ eq(s, h.encode())
+
+ def test_string_charset(self):
+ eq = self.assertEqual
+ h = Header()
+ h.append('hello', 'iso-8859-1')
+ eq(h, '=?iso-8859-1?q?hello?=')
+
+
# Test RFC 2231 header parameters decoding
class TestRFC2231(TestEmailBase):
def test_get_param(self):