From 194f669897b4b242c2996bed375352abdbefaa31 Mon Sep 17 00:00:00 2001 From: Bobby Date: Tue, 30 Aug 2022 23:06:15 -0400 Subject: Added Tests for Validating Emails --- tests/test_edify.py | 5 ----- tests/test_email.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) delete mode 100644 tests/test_edify.py create mode 100644 tests/test_email.py diff --git a/tests/test_edify.py b/tests/test_edify.py deleted file mode 100644 index bb81dbc..0000000 --- a/tests/test_edify.py +++ /dev/null @@ -1,5 +0,0 @@ -from edify.main import main - - -def test_main(): - assert main() == 0 diff --git a/tests/test_email.py b/tests/test_email.py new file mode 100644 index 0000000..2c90c52 --- /dev/null +++ b/tests/test_email.py @@ -0,0 +1,56 @@ +from edify.library import email + + +def test(): + emails = [ + "email@example.com", + "email@192.168.0.1", + "firstname.lastname@example.com", + "email@subdomain.example.com", + "firstname+lastname@example.com", + "1234567890@example.com", + "email@example-one.com", + "_______@example.com", + "email@example.museum", + "firstname-lastname@example.com", + "email@example.com.", + "plainaddress", + "#@%^%#$@#$@#.com", + "@example.com", + "Joe Smith ", + "email.example.com", + "email@example@example.com", + ".email@example.com", + "email.@example.com", + "email..email@example.com", + "あいうえお@example.com", + "email@-example.com", + "Abc..123@example.com" + ] + expectations = [ + True, + True, + True, + True, + True, + True, + True, + True, + True, + True, + False, + False, + False, + False, + False, + False, + False, + False, + False, + False, + False, + False, + False + ] + for i in range(len(emails)): + assert email(emails[i]) == expectations[i] -- cgit v1.2.3