summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/test_headerregistry.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-04-17 07:55:11 (GMT)
committerGitHub <noreply@github.com>2024-04-17 07:55:11 (GMT)
commit03108045d25e4a75575d8a19d3187599e17277a4 (patch)
treeebba209b8171b16306a5fc27b0f773b303e94dce /Lib/test/test_email/test_headerregistry.py
parent5f4c7cf3f49629bcf890c305e0a90ffd708110a2 (diff)
downloadcpython-03108045d25e4a75575d8a19d3187599e17277a4.zip
cpython-03108045d25e4a75575d8a19d3187599e17277a4.tar.gz
cpython-03108045d25e4a75575d8a19d3187599e17277a4.tar.bz2
[3.12] gh-75171: Fix parsing invalid email address headers starting or ending with a dot (GH-15600) (GH-117964)
(cherry picked from commit 8cc9adbfddc8e37cf7d621b12754eecb0584f5da) Co-authored-by: tsufeki <tsufeki@ymail.com> Co-authored-by: Tim Bell <timothybell@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_email/test_headerregistry.py')
-rw-r--r--Lib/test/test_email/test_headerregistry.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_headerregistry.py b/Lib/test/test_email/test_headerregistry.py
index 25347ef..bb7ca8d 100644
--- a/Lib/test/test_email/test_headerregistry.py
+++ b/Lib/test/test_email/test_headerregistry.py
@@ -1237,6 +1237,26 @@ class TestAddressHeader(TestHeaderBase):
'example.com',
None),
+ 'name_ending_with_dot_without_space':
+ ('John X.<jxd@example.com>',
+ [errors.ObsoleteHeaderDefect],
+ '"John X." <jxd@example.com>',
+ 'John X.',
+ 'jxd@example.com',
+ 'jxd',
+ 'example.com',
+ None),
+
+ 'name_starting_with_dot':
+ ('. Doe <jxd@example.com>',
+ [errors.InvalidHeaderDefect, errors.ObsoleteHeaderDefect],
+ '". Doe" <jxd@example.com>',
+ '. Doe',
+ 'jxd@example.com',
+ 'jxd',
+ 'example.com',
+ None),
+
}
# XXX: Need many more examples, and in particular some with names in