Skip to content

Commit

Permalink
Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
perryzjc committed Nov 17, 2023
1 parent b663791 commit 7d4bc67
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions tests/plugins/email_address_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,57 @@ class TestEmailAddressDetector:
('[email protected]', True),
('[email protected]', True),
('[email protected]', True),
# Additional test cases
# Valid email addresses with different domain extensions
('[email protected]', True),
('[email protected]', True),
('[email protected]', True),
('[email protected]', True),
# Valid email addresses with numbers
('[email protected]', True),
('[email protected]', True),
('[email protected]', True),
# Valid email addresses, part of larger text with special characters
('Contact us at: [email protected]!', True),
('Email: [email protected] for more info.', True),
# Invalid email addresses with missing components
('user@example', False),
('[email protected]', False),
('@example.com', False),
('user@', False),
# Invalid email addresses with special characters
('user@exa*mple.com', False),
('user@examp!e.com', False),
('user@exampl$.com', False),
('user@exam^ple.com', False),
# Unusual formats, mark as false
('"user"@example.com', False), # Quoted local part
('user@[123.123.123.123]', False), # IP address domain
# Invalid email addresses, incorrect use of special characters
('user@exa,mple.com', False),
('user@examp<le.com', False),
('user@exampl>com', False),
('user@exampl;e.com', False),
# Edge cases - rare but valid email formats
('user+mailbox/[email protected]', True),
('customer/[email protected]', True),
('!def!xyz%[email protected]', True),
('[email protected]', True),
# Edge cases - position of . (dot)
('[email protected]', False), # Double dot in domain
('[email protected]', True), # Leading dot in local part
('[email protected]', False), # Leading dot in domain
('[email protected].', True), # Trailing dot in domain
],
)
def test_analyze_line(self, payload, should_flag):
Expand Down

0 comments on commit 7d4bc67

Please sign in to comment.