diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index 95f14f0a577d96..ed41cf303ffe74 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -749,12 +749,12 @@ def test_invalid_header_names(self): method=method, ): message = Message(policy=thispolicy) - method = getattr(message, method) + class_method = getattr(message, method) with self.assertRaisesRegex( ValueError, '(?i)(?=.*invalid)(?=.*header)(?=.*name)' ) as cm: - method(name, value) + class_method(name, value) self.assertIn(f"{name!r}", str(cm.exception)) diff --git a/Lib/test/test_email/test_message.py b/Lib/test/test_email/test_message.py index b3e2b7bf71d956..905420dbdf33a2 100644 --- a/Lib/test/test_email/test_message.py +++ b/Lib/test/test_email/test_message.py @@ -1025,12 +1025,12 @@ def test_invalid_header_names(self): method=method, ): message = EmailMessage(policy=thispolicy) - method = getattr(message, method) + class_method = getattr(message, method) with self.assertRaisesRegex( ValueError, '(?i)(?=.*invalid)(?=.*header)(?=.*name)' ) as cm: - method(name,value) + class_method(name,value) self.assertIn(f"{name!r}", str(cm.exception)) def test_get_body_malformed(self):