summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-12-30 19:14:38 (GMT)
committerBarry Warsaw <barry@python.org>2002-12-30 19:14:38 (GMT)
commit10ee7a7f15dd9c356c434575ab26c26bafc0112d (patch)
treed380b3815c8005ae49436795fdb893c370e1cd21 /Lib/email/test/test_email.py
parentf4fdff715af7a9d595444065c523f8de5303895d (diff)
downloadcpython-10ee7a7f15dd9c356c434575ab26c26bafc0112d.zip
cpython-10ee7a7f15dd9c356c434575ab26c26bafc0112d.tar.gz
cpython-10ee7a7f15dd9c356c434575ab26c26bafc0112d.tar.bz2
test_bad_8bit_header(): Tests for optional argument `errors'. See SF
bug #648119.
Diffstat (limited to 'Lib/email/test/test_email.py')
-rw-r--r--Lib/email/test/test_email.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 7c79739..1c77819 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2307,6 +2307,17 @@ A very long line that must get split to something other than at the
h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8')
eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=')
+ def test_bad_8bit_header(self):
+ raises = self.assertRaises
+ eq = self.assertEqual
+ x = 'Ynwp4dUEbay Auction Semiar- No Charge \x96 Earn Big'
+ raises(UnicodeError, Header, x)
+ h = Header()
+ raises(UnicodeError, h.append, x)
+ eq(str(Header(x, errors='replace')), x)
+ h.append(x, errors='replace')
+ eq(str(h), x)
+
# Test RFC 2231 header parameters (en/de)coding