From 8c571047ccff0368a1e8cd6de41b88b40c1d5910 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 30 Aug 2007 19:17:18 +0000 Subject: [PATCH] More email package fixes. --- Lib/email/test/test_email.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index f7cac97dcce..324332b24cf 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -744,9 +744,17 @@ Subject: =?iso-8859-1?q?Britische_Regierung_gibt_gr=FCnes_Licht_f=FCr_Offshore-W def test_long_8bit_header_no_charset(self): eq = self.ndiffAssertEqual msg = Message() - msg['Reply-To'] = 'Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte ' - eq(msg.as_string(), """\ -Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte + header_string = ('Britische Regierung gibt gr\xfcnes Licht ' + 'f\xfcr Offshore-Windkraftprojekte ' + '') + msg['Reply-To'] = header_string + self.assertRaises(UnicodeEncodeError, msg.as_string) + msg = Message() + msg['Reply-To'] = Header(header_string, 'utf-8', + header_name='Reply-To') + eq(msg.as_string(maxheaderlen=78), """\ +Reply-To: =?utf-8?q?Britische_Regierung_gibt_gr=C3=BCnes_Licht_f=C3=BCr_Offs?= + =?utf-8?q?hore-Windkraftprojekte_=3Ca-very-long-address=40example=2Ecom=3E?= """) @@ -1010,9 +1018,9 @@ class TestMIMEApplication(unittest.TestCase): def test_body(self): eq = self.assertEqual - bytes = '\xfa\xfb\xfc\xfd\xfe\xff' + bytes = b'\xfa\xfb\xfc\xfd\xfe\xff' msg = MIMEApplication(bytes) - eq(msg.get_payload(), '+vv8/f7/') + eq(msg.get_payload(), b'+vv8/f7/') eq(msg.get_payload(decode=True), bytes)