forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpo-33476: Fix _header_value_parser when address group is missing fin…
…al ';' (pythonGH-7484)
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2152,6 +2152,31 @@ def test_get_group_one_invalid(self): | |
self.assertEqual(group.mailboxes[1].local_part, 'x') | ||
self.assertIsNone(group.all_mailboxes[1].display_name) | ||
|
||
def test_get_group_missing_final_semicol(self): | ||
group = self._test_get_x(parser.get_group, | ||
('Monty Python:"Fred A. Bear" <[email protected]>,' | ||
'[email protected],John <jdoe@test>'), | ||
('Monty Python:"Fred A. Bear" <[email protected]>,' | ||
'[email protected],John <jdoe@test>;'), | ||
('Monty Python:"Fred A. Bear" <[email protected]>,' | ||
'[email protected],John <jdoe@test>;'), | ||
[errors.InvalidHeaderDefect], | ||
'') | ||
self.assertEqual(group.token_type, 'group') | ||
self.assertEqual(group.display_name, 'Monty Python') | ||
self.assertEqual(len(group.mailboxes), 3) | ||
self.assertEqual(group.mailboxes, | ||
group.all_mailboxes) | ||
self.assertEqual(group.mailboxes[0].addr_spec, | ||
'[email protected]') | ||
self.assertEqual(group.mailboxes[0].display_name, | ||
'Fred A. Bear') | ||
self.assertEqual(group.mailboxes[1].addr_spec, | ||
'[email protected]') | ||
self.assertEqual(group.mailboxes[2].display_name, | ||
'John') | ||
self.assertEqual(group.mailboxes[2].addr_spec, | ||
'jdoe@test') | ||
# get_address | ||
|
||
def test_get_address_simple(self): | ||
|
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2018-06-08-00-29-40.bpo-33476.R0Bhlj.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix _header_value_parser.py when address group is missing final ';'. | ||
Contributed by Enrique Perez-Terron |