Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasreddy committed Dec 17, 2024
1 parent 8129d13 commit 5e371cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Lib/test/test_email/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,11 @@ def test_invalid_header_names(self):
Message().add_header(name, value)
self.assertIn(f"Invalid header field name {name!r}", str(cm.exception))

invalid_headers = [
invalid_ascii_headers = [
('Header\x7F', 'Non-ASCII character'),
('Header\x1F', 'control character'),
('Header\x80', 'Extended ASCII'),
]
for name, value in invalid_headers:
for name, value in invalid_ascii_headers:
with self.subTest(name=name, problem=value):
with self.assertRaises(ValueError) as cm:
Message().add_header(name, value)
Expand All @@ -760,7 +760,7 @@ def test_invalid_header_names(self):
m[name] = value
self.assertIn(f"Invalid header field name {name!r}", str(cm.exception))

for name, value in invalid_headers:
for name, value in invalid_ascii_headers:
with self.subTest(name=name, problem=value):
with self.assertRaises(ValueError) as cm:
m = Message()
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_email/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,11 +1019,11 @@ def test_invalid_header_names(self):
EmailMessage().add_header(name, value)
self.assertIn(f"Invalid header field name {name!r}", str(cm.exception))

invalid_headers = [
invalid_ascii_headers = [
('Header\x7F', 'Non-ASCII character'),
('Header\x1F', 'control character'),
('Header\x80', 'Extended ASCII'),
]
for name, value in invalid_headers:
for name, value in invalid_ascii_headers:
with self.subTest(name=name, problem=value):
with self.assertRaises(ValueError) as cm:
EmailMessage().add_header(name, value)
Expand All @@ -1036,7 +1036,7 @@ def test_invalid_header_names(self):
m[name] = value
self.assertIn(f"Invalid header field name {name!r}", str(cm.exception))

for name, value in invalid_headers:
for name, value in invalid_ascii_headers:
with self.subTest(name=name, problem=value):
with self.assertRaises(ValueError) as cm:
m = EmailMessage()
Expand Down

0 comments on commit 5e371cc

Please sign in to comment.