mirror of
https://github.com/python/cpython.git
synced 2025-09-28 11:15:17 +00:00
More email package fixes.
This commit is contained in:
parent
b13c493ae5
commit
8c571047cc
1 changed files with 13 additions and 5 deletions
|
@ -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):
|
def test_long_8bit_header_no_charset(self):
|
||||||
eq = self.ndiffAssertEqual
|
eq = self.ndiffAssertEqual
|
||||||
msg = Message()
|
msg = Message()
|
||||||
msg['Reply-To'] = 'Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>'
|
header_string = ('Britische Regierung gibt gr\xfcnes Licht '
|
||||||
eq(msg.as_string(), """\
|
'f\xfcr Offshore-Windkraftprojekte '
|
||||||
Reply-To: Britische Regierung gibt gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte <a-very-long-address@example.com>
|
'<a-very-long-address@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 @@ class TestMIMEApplication(unittest.TestCase):
|
||||||
|
|
||||||
def test_body(self):
|
def test_body(self):
|
||||||
eq = self.assertEqual
|
eq = self.assertEqual
|
||||||
bytes = '\xfa\xfb\xfc\xfd\xfe\xff'
|
bytes = b'\xfa\xfb\xfc\xfd\xfe\xff'
|
||||||
msg = MIMEApplication(bytes)
|
msg = MIMEApplication(bytes)
|
||||||
eq(msg.get_payload(), '+vv8/f7/')
|
eq(msg.get_payload(), b'+vv8/f7/')
|
||||||
eq(msg.get_payload(decode=True), bytes)
|
eq(msg.get_payload(decode=True), bytes)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue