]> granicus.if.org Git - python/commitdiff
Added a couple of more tests for Header charset handling.
authorBarry Warsaw <barry@python.org>
Tue, 23 Jul 2002 19:46:35 +0000 (19:46 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 23 Jul 2002 19:46:35 +0000 (19:46 +0000)
Lib/email/test/test_email.py

index 734e8549338929d6bd57444bce18b8fb0da4eae5..e4fb8bfe0cb085371e4897d942c770badc422189 100644 (file)
@@ -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?=')
+
 
+\f
 # Test RFC 2231 header parameters decoding
 class TestRFC2231(TestEmailBase):
     def test_get_param(self):