@@ -52,6 +52,57 @@ class TestEmailAddressDetector:
52
52
53
53
54
54
55
+
56
+ # Additional test cases
57
+
58
+ # Valid email addresses with different domain extensions
59
+
60
+
61
+
62
+
63
+
64
+ # Valid email addresses with numbers
65
+
66
+
67
+
68
+
69
+ # Valid email addresses, part of larger text with special characters
70
+ ('Contact us at: [email protected] !' , True ),
71
+ ('Email: [email protected] for more info.' , True ),
72
+
73
+ # Invalid email addresses with missing components
74
+ ('user@example' , False ),
75
+
76
+ ('@example.com' , False ),
77
+ ('user@' , False ),
78
+
79
+ # Invalid email addresses with special characters
80
+ ('user@exa*mple.com' , False ),
81
+ ('user@examp!e.com' , False ),
82
+ ('user@exampl$.com' , False ),
83
+ ('user@exam^ple.com' , False ),
84
+
85
+ # Unusual formats, mark as false
86
+ ('"user"@example.com' , False ), # Quoted local part
87
+ ('user@[123.123.123.123]' , False ), # IP address domain
88
+
89
+ # Invalid email addresses, incorrect use of special characters
90
+ ('user@exa,mple.com' , False ),
91
+ ('user@examp<le.com' , False ),
92
+ ('user@exampl>com' , False ),
93
+ ('user@exampl;e.com' , False ),
94
+
95
+ # Edge cases - rare but valid email formats
96
+ ('user+mailbox/[email protected] ' , True ),
97
+ ('customer/[email protected] ' , True ),
98
+ ('!def!xyz%[email protected] ' , True ),
99
+
100
+
101
+ # Edge cases - position of . (dot)
102
+ ('[email protected] ' , False ), # Double dot in domain
103
+ ('[email protected] ' , True ), # Leading dot in local part
104
+ ('[email protected] ' , False ), # Leading dot in domain
105
+ ('[email protected] .' , True ), # Trailing dot in domain
55
106
],
56
107
)
57
108
def test_analyze_line (self , payload , should_flag ):
0 commit comments