Skip to content

Commit

Permalink
Update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasreddy committed Dec 23, 2024
1 parent 7038404 commit 32dc6c8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Lib/test/test_email/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,14 @@ def test_invalid_header_names(self):
policy=thispolicy.__class__.__name__,
method=method,
):
with self.assertRaises(ValueError) as cm:
getattr(Message(policy=thispolicy), method)(name, value)
msg = str(cm.exception)
self.assertRegex(msg,'(?i)(?=.*invalid)(?=.*header)(?=.*name)')
self.assertIn(f"{name!r}", msg)
message = Message(policy=thispolicy)
method = getattr(message, method)
with self.assertRaisesRegex(
ValueError,
'(?i)(?=.*invalid)(?=.*header)(?=.*name)'
) as cm:
method(name, value)
self.assertIn(f"{name!r}", str(cm.exception))


def test_binary_quopri_payload(self):
Expand Down

0 comments on commit 32dc6c8

Please sign in to comment.