@@ -2237,70 +2237,6 @@ def test_parse_missing_minor_type(self):
22372237 eq (msg .get_content_maintype (), 'text' )
22382238 eq (msg .get_content_subtype (), 'plain' )
22392239
2240- # test_defect_handling
2241- def test_same_boundary_inner_outer (self ):
2242- msg = self ._msgobj ('msg_15.txt' )
2243- # XXX We can probably eventually do better
2244- inner = msg .get_payload (0 )
2245- self .assertHasAttr (inner , 'defects' )
2246- self .assertEqual (len (inner .defects ), 1 )
2247- self .assertIsInstance (inner .defects [0 ],
2248- errors .StartBoundaryNotFoundDefect )
2249-
2250- # test_defect_handling
2251- def test_multipart_no_boundary (self ):
2252- msg = self ._msgobj ('msg_25.txt' )
2253- self .assertIsInstance (msg .get_payload (), str )
2254- self .assertEqual (len (msg .defects ), 2 )
2255- self .assertIsInstance (msg .defects [0 ],
2256- errors .NoBoundaryInMultipartDefect )
2257- self .assertIsInstance (msg .defects [1 ],
2258- errors .MultipartInvariantViolationDefect )
2259-
2260- multipart_msg = textwrap .dedent ("""\
2261- Date: Wed, 14 Nov 2007 12:56:23 GMT
2262- From: foo@bar.invalid
2263- To: foo@bar.invalid
2264- Subject: Content-Transfer-Encoding: base64 and multipart
2265- MIME-Version: 1.0
2266- Content-Type: multipart/mixed;
2267- boundary="===============3344438784458119861=="{}
2268-
2269- --===============3344438784458119861==
2270- Content-Type: text/plain
2271-
2272- Test message
2273-
2274- --===============3344438784458119861==
2275- Content-Type: application/octet-stream
2276- Content-Transfer-Encoding: base64
2277-
2278- YWJj
2279-
2280- --===============3344438784458119861==--
2281- """ )
2282-
2283- # test_defect_handling
2284- def test_multipart_invalid_cte (self ):
2285- msg = self ._str_msg (
2286- self .multipart_msg .format ("\n Content-Transfer-Encoding: base64" ))
2287- self .assertEqual (len (msg .defects ), 1 )
2288- self .assertIsInstance (msg .defects [0 ],
2289- errors .InvalidMultipartContentTransferEncodingDefect )
2290-
2291- # test_defect_handling
2292- def test_multipart_no_cte_no_defect (self ):
2293- msg = self ._str_msg (self .multipart_msg .format ('' ))
2294- self .assertEqual (len (msg .defects ), 0 )
2295-
2296- # test_defect_handling
2297- def test_multipart_valid_cte_no_defect (self ):
2298- for cte in ('7bit' , '8bit' , 'BINary' ):
2299- msg = self ._str_msg (
2300- self .multipart_msg .format (
2301- "\n Content-Transfer-Encoding: {}" .format (cte )))
2302- self .assertEqual (len (msg .defects ), 0 )
2303-
23042240 # test_headerregistry.TestContentTypeHeader invalid_1 and invalid_2.
23052241 def test_invalid_content_type (self ):
23062242 eq = self .assertEqual
@@ -2377,30 +2313,6 @@ def test_missing_start_boundary(self):
23772313 self .assertIsInstance (bad .defects [0 ],
23782314 errors .StartBoundaryNotFoundDefect )
23792315
2380- # test_defect_handling
2381- def test_first_line_is_continuation_header (self ):
2382- eq = self .assertEqual
2383- m = ' Line 1\n Subject: test\n \n body'
2384- msg = email .message_from_string (m )
2385- eq (msg .keys (), ['Subject' ])
2386- eq (msg .get_payload (), 'body' )
2387- eq (len (msg .defects ), 1 )
2388- self .assertDefectsEqual (msg .defects ,
2389- [errors .FirstHeaderLineIsContinuationDefect ])
2390- eq (msg .defects [0 ].line , ' Line 1\n ' )
2391-
2392- # test_defect_handling
2393- def test_missing_header_body_separator (self ):
2394- # Our heuristic if we see a line that doesn't look like a header (no
2395- # leading whitespace but no ':') is to assume that the blank line that
2396- # separates the header from the body is missing, and to stop parsing
2397- # headers and start parsing the body.
2398- msg = self ._str_msg ('Subject: test\n not a header\n To: abc\n \n b\n ' )
2399- self .assertEqual (msg .keys (), ['Subject' ])
2400- self .assertEqual (msg .get_payload (), 'not a header\n To: abc\n \n b\n ' )
2401- self .assertDefectsEqual (msg .defects ,
2402- [errors .MissingHeaderBodySeparatorDefect ])
2403-
24042316 def test_string_payload_with_extra_space_after_cte (self ):
24052317 # https://github.com/python/cpython/issues/98188
24062318 cte = "base64 "
0 commit comments