-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
52 lines (39 loc) · 1.93 KB
/
tests.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
51
52
from unittest import TestCase, main
from phonenumber import PhoneNumber
class TestPhoneNumber(TestCase):
def test_1(self):
ph = PhoneNumber("+1(858)775-2868")
self.assertEqual("+1(858)775-2868", ph.original_value)
self.assertEqual("+18587752868", ph.stripped_value)
self.assertEqual("(858)775-2868", ph.get_value_as_north_america())
self.assertEqual("+1.858.775.2868", ph.get_value_as_international())
def test_2(self):
ph = PhoneNumber("+1(858)775-2868x123")
self.assertEqual("+1(858)775-2868x123", ph.original_value)
self.assertEqual("+18587752868x123", ph.stripped_value)
self.assertEqual("(858)775-2868x123", ph.get_value_as_north_america())
self.assertEqual("+1(858)775-2868x123",
ph.get_value_as_international())
def test_3(self):
ph = PhoneNumber("+598.123.4567x858")
self.assertEqual("+598.123.4567x858", ph.original_value)
self.assertEqual("+5981234567x858", ph.stripped_value)
self.assertEqual("", ph.get_value_as_north_america())
self.assertEqual("+598.123.456.7x858",
ph.get_value_as_international())
def test_4(self):
ph = PhoneNumber("+27 1234 5678 ext 4")
self.assertEqual("+27 1234 5678 ext 4", ph.original_value)
self.assertEqual("+2712345678x4", ph.stripped_value)
self.assertEqual("", ph.get_value_as_north_america())
self.assertEqual("+27 1234 5678 ext 4",
ph.get_value_as_international())
def test_5(self):
ph = PhoneNumber("858-775-2868")
self.assertEqual("858-775-2868", ph.original_value)
self.assertEqual("+18587752868", ph.stripped_value)
self.assertEqual("(858)775-2868", ph.get_value_as_north_america())
self.assertEqual("+1.858.775.2868",
ph.get_value_as_international())
if __name__ == '__main__':
main()