File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3712,6 +3712,16 @@ def test_bytes_header_parser(self):
3712
3712
self .assertIsInstance (msg .get_payload (), str )
3713
3713
self .assertIsInstance (msg .get_payload (decode = True ), bytes )
3714
3714
3715
+ def test_header_parser_multipart_is_valid (self ):
3716
+ # Don't flag valid multipart emails as having defects
3717
+ with openfile ('msg_47.txt' , encoding = "utf-8" ) as fp :
3718
+ msgdata = fp .read ()
3719
+
3720
+ parser = email .parser .Parser (policy = email .policy .default )
3721
+ parsed_msg = parser .parsestr (msgdata , headersonly = True )
3722
+
3723
+ self .assertEqual (parsed_msg .defects , [])
3724
+
3715
3725
def test_bytes_parser_does_not_close_file (self ):
3716
3726
with openfile ('msg_02.txt' , 'rb' ) as fp :
3717
3727
email .parser .BytesParser ().parse (fp )
Original file line number Diff line number Diff line change @@ -67,14 +67,6 @@ def test_only_split_on_cr_lf(self):
67
67
])
68
68
self .assertEqual (msg .get_payload (), "" )
69
69
70
- def test_headers_only_multipart (self ):
71
- with openfile ('msg_47.txt' , encoding = "utf-8" ) as fp :
72
- msgdata = fp .read ()
73
-
74
- parser = email .parser .Parser (policy = email .policy .default )
75
- parsed_msg = parser .parsestr (msgdata , headersonly = True )
76
-
77
- self .assertEqual (parsed_msg .defects , [])
78
70
79
71
class MyMessage (EmailMessage ):
80
72
pass
You can’t perform that action at this time.
0 commit comments