aboutsummaryrefslogtreecommitdiff
path: root/tests/test_phone.py
blob: 8c95d602ba0b2b3008a8b7921a62b30e81733a1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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