diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index 8bde0ef8949d76..7d63e8a3cddc42 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -749,7 +749,7 @@ def test_invalid_header_names(self): method=method, ): with self.assertRaises(ValueError) as cm: - getattr(Message(policy=thispolicy), method(name, value)) + getattr(Message(policy=thispolicy), method)(name, value) msg = str(cm.exception) self.assertRegex(msg,'(?i)(?=.*invalid)(?=.*header)(?=.*name)') self.assertIn(f"{name!r}", msg) diff --git a/Lib/test/test_email/test_message.py b/Lib/test/test_email/test_message.py index 89bd6d3a93d97c..651d9d027089b3 100644 --- a/Lib/test/test_email/test_message.py +++ b/Lib/test/test_email/test_message.py @@ -1025,7 +1025,7 @@ def test_invalid_header_names(self): method=method, ): with self.assertRaises(ValueError) as cm: - getattr(EmailMessage(policy=thispolicy), method(name, value)) + getattr(EmailMessage(policy=thispolicy), method)(name, value) msg = str(cm.exception) self.assertRegex( msg, '(?i)(?=.*invalid)(?=.*header)(?=.*name)') self.assertIn(f"{name!r}", msg)