@@ -2261,50 +2261,6 @@ def test_multipart_no_boundary(self):
22612261 self .assertIsInstance (msg .defects [1 ],
22622262 errors .MultipartInvariantViolationDefect )
22632263
2264- multipart_msg = textwrap .dedent ("""\
2265- Date: Wed, 14 Nov 2007 12:56:23 GMT
2266- From: foo@bar.invalid
2267- To: foo@bar.invalid
2268- Subject: Content-Transfer-Encoding: base64 and multipart
2269- MIME-Version: 1.0
2270- Content-Type: multipart/mixed;
2271- boundary="===============3344438784458119861=="{}
2272-
2273- --===============3344438784458119861==
2274- Content-Type: text/plain
2275-
2276- Test message
2277-
2278- --===============3344438784458119861==
2279- Content-Type: application/octet-stream
2280- Content-Transfer-Encoding: base64
2281-
2282- YWJj
2283-
2284- --===============3344438784458119861==--
2285- """ )
2286-
2287- # test_defect_handling
2288- def test_multipart_invalid_cte (self ):
2289- msg = self ._str_msg (
2290- self .multipart_msg .format ("\n Content-Transfer-Encoding: base64" ))
2291- self .assertEqual (len (msg .defects ), 1 )
2292- self .assertIsInstance (msg .defects [0 ],
2293- errors .InvalidMultipartContentTransferEncodingDefect )
2294-
2295- # test_defect_handling
2296- def test_multipart_no_cte_no_defect (self ):
2297- msg = self ._str_msg (self .multipart_msg .format ('' ))
2298- self .assertEqual (len (msg .defects ), 0 )
2299-
2300- # test_defect_handling
2301- def test_multipart_valid_cte_no_defect (self ):
2302- for cte in ('7bit' , '8bit' , 'BINary' ):
2303- msg = self ._str_msg (
2304- self .multipart_msg .format (
2305- "\n Content-Transfer-Encoding: {}" .format (cte )))
2306- self .assertEqual (len (msg .defects ), 0 )
2307-
23082264 # test_headerregistry.TestContentTypeHeader invalid_1 and invalid_2.
23092265 def test_invalid_content_type (self ):
23102266 eq = self .assertEqual
@@ -2381,30 +2337,6 @@ def test_missing_start_boundary(self):
23812337 self .assertIsInstance (bad .defects [0 ],
23822338 errors .StartBoundaryNotFoundDefect )
23832339
2384- # test_defect_handling
2385- def test_first_line_is_continuation_header (self ):
2386- eq = self .assertEqual
2387- m = ' Line 1\n Subject: test\n \n body'
2388- msg = email .message_from_string (m )
2389- eq (msg .keys (), ['Subject' ])
2390- eq (msg .get_payload (), 'body' )
2391- eq (len (msg .defects ), 1 )
2392- self .assertDefectsEqual (msg .defects ,
2393- [errors .FirstHeaderLineIsContinuationDefect ])
2394- eq (msg .defects [0 ].line , ' Line 1\n ' )
2395-
2396- # test_defect_handling
2397- def test_missing_header_body_separator (self ):
2398- # Our heuristic if we see a line that doesn't look like a header (no
2399- # leading whitespace but no ':') is to assume that the blank line that
2400- # separates the header from the body is missing, and to stop parsing
2401- # headers and start parsing the body.
2402- msg = self ._str_msg ('Subject: test\n not a header\n To: abc\n \n b\n ' )
2403- self .assertEqual (msg .keys (), ['Subject' ])
2404- self .assertEqual (msg .get_payload (), 'not a header\n To: abc\n \n b\n ' )
2405- self .assertDefectsEqual (msg .defects ,
2406- [errors .MissingHeaderBodySeparatorDefect ])
2407-
24082340 def test_string_payload_with_extra_space_after_cte (self ):
24092341 # https://github.com/python/cpython/issues/98188
24102342 cte = "base64 "
0 commit comments