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