diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-02-08 18:13:01 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-02-08 18:13:01 (GMT) |
commit | 01e46ee7e28f5f14ede2b7078cfd277199751dc3 (patch) | |
tree | ab1808c55105351d4bf0a8e794e9d7eb70139d45 /Lib/test/test_email | |
parent | ff9616bbf7ecbd55a7206dae28f06ef90f270566 (diff) | |
parent | 0400d33928e6b463db164836da670700f03edc5d (diff) | |
download | cpython-01e46ee7e28f5f14ede2b7078cfd277199751dc3.zip cpython-01e46ee7e28f5f14ede2b7078cfd277199751dc3.tar.gz cpython-01e46ee7e28f5f14ede2b7078cfd277199751dc3.tar.bz2 |
Merge: #16983: Apply postel's law to encoded words inside quoted strings.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r-- | Lib/test/test_email/test__header_value_parser.py | 9 | ||||
-rw-r--r-- | Lib/test/test_email/test_headerregistry.py | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 646082b..32996ca 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -540,6 +540,15 @@ class TestParser(TestParserMixin, TestEmailBase): self._test_get_x(parser.get_bare_quoted_string, '""', '""', '', [], '') + # Issue 16983: apply postel's law to some bad encoding. + def test_encoded_word_inside_quotes(self): + self._test_get_x(parser.get_bare_quoted_string, + '"=?utf-8?Q?not_really_valid?="', + '"not really valid"', + 'not really valid', + [errors.InvalidHeaderDefect], + '') + # get_comment def test_get_comment_only(self): diff --git a/Lib/test/test_email/test_headerregistry.py b/Lib/test/test_email/test_headerregistry.py index f2df372..7d64a38 100644 --- a/Lib/test/test_email/test_headerregistry.py +++ b/Lib/test/test_email/test_headerregistry.py @@ -1155,6 +1155,16 @@ class TestAddressHeader(TestHeaderBase): 'example.com', None), + 'rfc2047_atom_in_quoted_string_is_decoded': + ('"=?utf-8?q?=C3=89ric?=" <foo@example.com>', + [errors.InvalidHeaderDefect], + 'Éric <foo@example.com>', + 'Éric', + 'foo@example.com', + 'foo', + 'example.com', + None), + } # XXX: Need many more examples, and in particular some with names in |