diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-06-21 14:27:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-21 14:27:26 (GMT) |
commit | 20a1495b8a93596b322ea19bb09008db036eb7e6 (patch) | |
tree | d2b21729908d7e820856d82983448ddb4ee3ee15 /Lib/test | |
parent | 6614eac843c5dc0f4c2664ef610b81e556e44923 (diff) | |
download | cpython-20a1495b8a93596b322ea19bb09008db036eb7e6.zip cpython-20a1495b8a93596b322ea19bb09008db036eb7e6.tar.gz cpython-20a1495b8a93596b322ea19bb09008db036eb7e6.tar.bz2 |
bpo-44395: Fix MIMEPart.as_string to pass unixfrom properly (GH-26685)
(cherry picked from commit 30f7a77f359a0fc6e37988b0f317a77a15d66b7b)
Co-authored-by: Dong-hee Na <donghee.na@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_email/test_message.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_message.py b/Lib/test/test_email/test_message.py index fab97d9..7aaf780 100644 --- a/Lib/test/test_email/test_message.py +++ b/Lib/test/test_email/test_message.py @@ -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) |