Tighten parser email validation with regression tests

This commit is contained in:
StasonJatham committed 2026-09-20 15:54:50 +02:00
1 parent a7ca0e0d98
commit 1ead58173c
2 files changed
+11 -7

No files matched your search

+5
View File
@@ -56,6 +56,11 @@ class ParserTest(unittest.TestCase):
self.assertIsNone(p("no at sign at all"))
self.assertIsNone(p("plain text line:with:colons"))
self.assertIsNotNone(p("user%40domain.com:password")) # %40 still becomes '@'
# Symbol-laden local parts are rejected by the strict ASCII regex.
self.assertIsNone(p("[email protected]:12abcd"))
self.assertIsNone(p("[email protected]:pw"))
self.assertIsNone(p("[email protected]:pw")) # '+' not allowed by the regex
self.assertIsNotNone(p("[email protected]:pw"))
self.assertIsNotNone(
p("[email protected]:[email protected]:victory")
)