Skip to content

Commit

Permalink
try to repro
Browse files Browse the repository at this point in the history
  • Loading branch information
parthsdoshi committed Jan 3, 2024
1 parent b2566d8 commit e1548e8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Lib/test/test_email/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,23 @@ def test_as_bytes_policy(self):
g.flatten(msg)
self.assertEqual(fullrepr, s.getvalue())

def test_roundtrip(self) -> None:
"""Tests for gh-113594 to check that a message can be roundtripped
without crashing or losing information.
"""
email_raw_1 = \
b'Content-Type: multipart/mixed; boundary="==="\n\n--===\n' + \
b'Content-Type: message/plain\n \n \xe6\x82\xa80123456789012.3456789\n' + \
b'\n--===--\n'
email_raw_2 = b'Content-Type: multipart/mixed; boundary="==="\n\n--===\n' + \
b'Content-Type: message/plain\n \n \xe6\x82\xa80123456789012.34567890\n' + \
b'\n--===--\n'

message_1 = email.message_from_bytes(email_raw_1, policy=email.policy.SMTPUTF8)
print(message_1)
message_2 = email.message_from_bytes(email_raw_2, policy=email.policy.SMTPUTF8)
print(message_2)

# test_headerregistry.TestContentTypeHeader.bad_params
def test_bad_param(self):
msg = email.message_from_string("Content-Type: blarg; baz; boo\n")
Expand Down

0 comments on commit e1548e8

Please sign in to comment.