Skip to content

Commit 64d2bd3

Browse files
authored
Update test_bytes_parser_uses_policy_utf8_setting test
Now asserts that the UTF-8 encoded data is present in the final message
1 parent 29f3802 commit 64d2bd3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_email/test_email.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4019,8 +4019,14 @@ def test_bytes_parser_uses_policy_utf8_setting(self):
40194019
40204020
""".lstrip()
40214021
M_BYTES = BytesIO(m.encode())
4022+
40224023
msg = email.message_from_binary_file(M_BYTES, policy=email.policy.default.clone(utf8=True))
4023-
self.assertEqual(msg.as_string(), m)
4024+
for i, part in enumerate(msg.iter_parts(), 1):
4025+
_ = part.as_string()
4026+
4027+
msg_string = msg.as_string()
4028+
self.assertIn("This is the préamble.", msg_string)
4029+
self.assertIn("Un petit café", msg_string)
40244030

40254031
def test_parser_does_not_close_file(self):
40264032
with openfile('msg_02.txt', encoding="utf-8") as fp:

0 commit comments

Comments
 (0)