From c6344afd77b8bf5baeb67fee8270ca24c555ec6c Mon Sep 17 00:00:00 2001 From: Bobby Date: Wed, 31 Aug 2022 00:04:23 -0400 Subject: Added Phone Number Validation --- tests/test_phone.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_phone.py (limited to 'tests') diff --git a/tests/test_phone.py b/tests/test_phone.py new file mode 100644 index 0000000..6a26af5 --- /dev/null +++ b/tests/test_phone.py @@ -0,0 +1,24 @@ +from edify.library import phone_number + +def test(): + phones = { + "1234567890": True, + "123 456 7890": True, + "123-456-7890": True, + "123.456.7890": True, + "123 456 7890": True, + "+1 (123) 456-7890": True, + "+1 (123) 456 7890": True, + "+1 (123) 456-7890": True, + "+102 (123) 456-7890": True, + "+91 (123) 456-7890": True, + "90122121": True, + "12345678901": True, + "+1 (124) 232": True, + "+1 (123) 45-890": True, + "+1 (1) 456-7890": True, + "9012": False, + "+1 (615) 243-": False + } + for phone, expectation in phones.items(): + assert phone_number(phone) == expectation -- cgit v1.2.3