-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_phone.py
50 lines (37 loc) · 1.02 KB
/
test_phone.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from helpers import normalize_number
# phone numbers
# some complex test setup
# disable_network_connections()
# dashes and not
# def test_with_dashes():
# # if normalize_number("123-456-7890") == "123-456-7890":
# # print("good")
# # else:
# # print("error")
# assert normalize_number("123-456-7890") == "123-456-7890"
def test_without_dashes():
# if normalize_number("5556667777") == "555-666-7777":
# print("good")
# else:
# print("error")
assert normalize_number("5556667777") == "555-666-7777"
# result = normalize_number("1234567890")
# if result == "123-456-7890":
# print("good")
# else:
# print("error:", result)
# parentheses
"(123) 456-7890" # -> "123-456-7890"
# spaces
"123 456 7890" # -> "123-456-7890"
# country code
"+1 (123) 456-7890" # -> "123-456-7890"
"+64 (123) 456-7890" # -> error
# number of digits
"6" # error
# non-numeric
"abc" # error
"+100000000" # error
"000000000" # error
# loop through digits
# if not an int, throw an error