We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7038404 commit 32dc6c8Copy full SHA for 32dc6c8
Lib/test/test_email/test_email.py
@@ -748,11 +748,14 @@ def test_invalid_header_names(self):
748
policy=thispolicy.__class__.__name__,
749
method=method,
750
):
751
- with self.assertRaises(ValueError) as cm:
752
- getattr(Message(policy=thispolicy), method)(name, value)
753
- msg = str(cm.exception)
754
- self.assertRegex(msg,'(?i)(?=.*invalid)(?=.*header)(?=.*name)')
755
- self.assertIn(f"{name!r}", msg)
+ message = Message(policy=thispolicy)
+ method = getattr(message, method)
+ with self.assertRaisesRegex(
+ ValueError,
+ '(?i)(?=.*invalid)(?=.*header)(?=.*name)'
756
+ ) as cm:
757
+ method(name, value)
758
+ self.assertIn(f"{name!r}", str(cm.exception))
759
760
761
def test_binary_quopri_payload(self):
0 commit comments