[Python-3000-checkins] r57761 - python/branches/py3k/Lib/email/test/test_email.py

barry.warsaw python-3000-checkins at python.org
Thu Aug 30 21:17:19 CEST 2007


Author: barry.warsaw
Date: Thu Aug 30 21:17:18 2007
New Revision: 57761

Modified:
   python/branches/py3k/Lib/email/test/test_email.py
Log:
More email package fixes.


Modified: python/branches/py3k/Lib/email/test/test_email.py
==============================================================================
--- python/branches/py3k/Lib/email/test/test_email.py	(original)
+++ python/branches/py3k/Lib/email/test/test_email.py	Thu Aug 30 21:17:18 2007
@@ -744,9 +744,17 @@
     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 <a-very-long-address at example.com>'
-        eq(msg.as_string(), """\
-Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address at example.com>
+        header_string = ('Britische Regierung gibt gr\xfcnes Licht '
+                         'f\xfcr Offshore-Windkraftprojekte '
+                         '<a-very-long-address at example.com>')
+        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 @@
 
     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)
 
 


More information about the Python-3000-checkins mailing list