mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-44395: Fix MIMEPart.as_string to pass unixfrom properly (GH-26685)
This commit is contained in:
parent
45a78f906d
commit
30f7a77f35
3 changed files with 11 additions and 2 deletions
|
@ -775,6 +775,13 @@ class TestEmailMessage(TestEmailMessageBase, TestEmailBase):
|
|||
self.assertEqual(len(m.as_string(maxheaderlen=34).strip().splitlines()),
|
||||
6)
|
||||
|
||||
def test_as_string_unixform(self):
|
||||
m = self._str_msg('test')
|
||||
m.set_unixfrom('From foo@bar Thu Jan 1 00:00:00 1970')
|
||||
self.assertEqual(m.as_string(unixfrom=True),
|
||||
'From foo@bar Thu Jan 1 00:00:00 1970\n\ntest')
|
||||
self.assertEqual(m.as_string(unixfrom=False), '\ntest')
|
||||
|
||||
def test_str_defaults_to_policy_max_line_length(self):
|
||||
m = self._str_msg('Subject: long line' + ' ab'*50 + '\n\n')
|
||||
self.assertEqual(len(str(m).strip().splitlines()), 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue