@@ -1004,33 +1004,25 @@ def test_folding_with_long_nospace_http_policy_1(self):
10041004 parsed_msg = message_from_bytes (m .as_bytes (), policy = policy .default )
10051005 self .assertEqual (parsed_msg ['Message-ID' ], m ['Message-ID' ])
10061006
1007- def test_no_wrapping_with_zero_max_line_length (self ):
1008- pol = policy .default .clone (max_line_length = 0 )
1009- subj = "S" * 100
1010- msg = EmailMessage (policy = pol )
1011- msg ["From" ] = "a@ex.com"
1012- msg ["To" ] = "b@ex.com"
1013- msg ["Subject" ] = subj
1014-
1015- raw = msg .as_bytes ()
1016- self .assertNotIn (b"\r \n " , raw , "Found fold indicator; wrapping not disabled" )
1017-
1018- parsed = message_from_bytes (raw , policy = policy .default )
1019- self .assertEqual (parsed ["Subject" ], subj )
1020-
1021- def test_no_wrapping_with_none_max_line_length (self ):
1022- pol = policy .default .clone (max_line_length = None )
1023- subj = "S" * 100
1024- body = "B" * 100
1025- msg = EmailMessage (policy = pol )
1026- msg ["From" ] = "a@ex.com"
1027- msg ["To" ] = "b@ex.com"
1028- msg ["Subject" ] = subj
1029- msg .set_content (body )
1030-
1031- parsed = message_from_bytes (msg .as_bytes (), policy = policy .default )
1032- self .assertEqual (parsed ["Subject" ], subj )
1033- self .assertEqual (parsed .get_body ().get_content ().rstrip ('\n ' ), body )
1007+ def test_no_wrapping_max_line_length (self ):
1008+ def do_test_no_wrapping_max_line_length (n ):
1009+ pol = policy .default .clone (max_line_length = n )
1010+ subj = "S" * 100
1011+ body = "B" * 100
1012+ msg = EmailMessage (policy = pol )
1013+ msg ["From" ] = "a@ex.com"
1014+ msg ["To" ] = "b@ex.com"
1015+ msg ["Subject" ] = subj
1016+ msg .set_content (body )
1017+
1018+ raw = msg .as_bytes ()
1019+ self .assertNotIn (b"\r \n " , raw , "Found fold indicator; wrapping not disabled" )
1020+
1021+ parsed = message_from_bytes (msg .as_bytes (), policy = policy .default )
1022+ self .assertEqual (parsed ["Subject" ], subj )
1023+ self .assertEqual (parsed .get_body ().get_content ().rstrip ('\n ' ), body )
1024+ do_test_no_wrapping_max_line_length (None )
1025+ do_test_no_wrapping_max_line_length (0 )
10341026
10351027 def test_invalid_header_names (self ):
10361028 invalid_headers = [
0 commit comments