summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-05-17 19:28:44 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2019-05-17 19:28:44 (GMT)
commitfeac6cd7753425fba006e97e2d9b74a0c0c75894 (patch)
tree60e2974c9254ed17c8bc5e7bf952c1668ed36e77 /Lib/test/test_email
parentcbe72d842646ded2454784679231e3d1e6252e72 (diff)
downloadcpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.zip
cpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.tar.gz
cpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.tar.bz2
bpo-33524: Fix the folding of email header when max_line_length is 0 or None (#13391)
and there are non-ascii characters in the header.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r--Lib/test/test_email/test_policy.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_policy.py b/Lib/test/test_email/test_policy.py
index c2c437e..0aea934 100644
--- a/Lib/test/test_email/test_policy.py
+++ b/Lib/test/test_email/test_policy.py
@@ -1,4 +1,5 @@
import io
+import sys
import types
import textwrap
import unittest
@@ -134,6 +135,18 @@ class PolicyAPITests(unittest.TestCase):
for attr, value in expected.items():
self.assertEqual(getattr(added, attr), value)
+ def test_fold_zero_max_line_length(self):
+ expected = 'Subject: =?utf-8?q?=C3=A1?=\n'
+
+ msg = email.message.EmailMessage()
+ msg['Subject'] = 'รก'
+
+ p1 = email.policy.default.clone(max_line_length=0)
+ p2 = email.policy.default.clone(max_line_length=None)
+
+ self.assertEqual(p1.fold('Subject', msg['Subject']), expected)
+ self.assertEqual(p2.fold('Subject', msg['Subject']), expected)
+
def test_register_defect(self):
class Dummy:
def __init__(self):