@@ -2262,70 +2262,6 @@ def test_parse_missing_minor_type(self):
22622262 eq (msg .get_content_maintype (), 'text' )
22632263 eq (msg .get_content_subtype (), 'plain' )
22642264
2265- # test_defect_handling
2266- def test_same_boundary_inner_outer (self ):
2267- msg = self ._msgobj ('msg_15.txt' )
2268- # XXX We can probably eventually do better
2269- inner = msg .get_payload (0 )
2270- self .assertHasAttr (inner , 'defects' )
2271- self .assertEqual (len (inner .defects ), 1 )
2272- self .assertIsInstance (inner .defects [0 ],
2273- errors .StartBoundaryNotFoundDefect )
2274-
2275- # test_defect_handling
2276- def test_multipart_no_boundary (self ):
2277- msg = self ._msgobj ('msg_25.txt' )
2278- self .assertIsInstance (msg .get_payload (), str )
2279- self .assertEqual (len (msg .defects ), 2 )
2280- self .assertIsInstance (msg .defects [0 ],
2281- errors .NoBoundaryInMultipartDefect )
2282- self .assertIsInstance (msg .defects [1 ],
2283- errors .MultipartInvariantViolationDefect )
2284-
2285- multipart_msg = textwrap .dedent ("""\
2286- Date: Wed, 14 Nov 2007 12:56:23 GMT
2287- From: foo@bar.invalid
2288- To: foo@bar.invalid
2289- Subject: Content-Transfer-Encoding: base64 and multipart
2290- MIME-Version: 1.0
2291- Content-Type: multipart/mixed;
2292- boundary="===============3344438784458119861=="{}
2293-
2294- --===============3344438784458119861==
2295- Content-Type: text/plain
2296-
2297- Test message
2298-
2299- --===============3344438784458119861==
2300- Content-Type: application/octet-stream
2301- Content-Transfer-Encoding: base64
2302-
2303- YWJj
2304-
2305- --===============3344438784458119861==--
2306- """ )
2307-
2308- # test_defect_handling
2309- def test_multipart_invalid_cte (self ):
2310- msg = self ._str_msg (
2311- self .multipart_msg .format ("\n Content-Transfer-Encoding: base64" ))
2312- self .assertEqual (len (msg .defects ), 1 )
2313- self .assertIsInstance (msg .defects [0 ],
2314- errors .InvalidMultipartContentTransferEncodingDefect )
2315-
2316- # test_defect_handling
2317- def test_multipart_no_cte_no_defect (self ):
2318- msg = self ._str_msg (self .multipart_msg .format ('' ))
2319- self .assertEqual (len (msg .defects ), 0 )
2320-
2321- # test_defect_handling
2322- def test_multipart_valid_cte_no_defect (self ):
2323- for cte in ('7bit' , '8bit' , 'BINary' ):
2324- msg = self ._str_msg (
2325- self .multipart_msg .format (
2326- "\n Content-Transfer-Encoding: {}" .format (cte )))
2327- self .assertEqual (len (msg .defects ), 0 )
2328-
23292265 # test_headerregistry.TestContentTypeHeader invalid_1 and invalid_2.
23302266 def test_invalid_content_type (self ):
23312267 eq = self .assertEqual
@@ -2402,30 +2338,6 @@ def test_missing_start_boundary(self):
24022338 self .assertIsInstance (bad .defects [0 ],
24032339 errors .StartBoundaryNotFoundDefect )
24042340
2405- # test_defect_handling
2406- def test_first_line_is_continuation_header (self ):
2407- eq = self .assertEqual
2408- m = ' Line 1\n Subject: test\n \n body'
2409- msg = email .message_from_string (m )
2410- eq (msg .keys (), ['Subject' ])
2411- eq (msg .get_payload (), 'body' )
2412- eq (len (msg .defects ), 1 )
2413- self .assertDefectsEqual (msg .defects ,
2414- [errors .FirstHeaderLineIsContinuationDefect ])
2415- eq (msg .defects [0 ].line , ' Line 1\n ' )
2416-
2417- # test_defect_handling
2418- def test_missing_header_body_separator (self ):
2419- # Our heuristic if we see a line that doesn't look like a header (no
2420- # leading whitespace but no ':') is to assume that the blank line that
2421- # separates the header from the body is missing, and to stop parsing
2422- # headers and start parsing the body.
2423- msg = self ._str_msg ('Subject: test\n not a header\n To: abc\n \n b\n ' )
2424- self .assertEqual (msg .keys (), ['Subject' ])
2425- self .assertEqual (msg .get_payload (), 'not a header\n To: abc\n \n b\n ' )
2426- self .assertDefectsEqual (msg .defects ,
2427- [errors .MissingHeaderBodySeparatorDefect ])
2428-
24292341 def test_string_payload_with_extra_space_after_cte (self ):
24302342 # https://github.com/python/cpython/issues/98188
24312343 cte = "base64 "
0 commit comments