2023-01-09 14:35:02 +01:00
|
|
|
import unittest
|
2023-01-09 14:53:41 +01:00
|
|
|
import s2_a4_a
|
|
|
|
|
|
|
|
test_numbers = [
|
|
|
|
"+1 223-456-7890",
|
|
|
|
"1-223-456-7890",
|
|
|
|
"+1 223 456-7890",
|
|
|
|
"(223) 456-7890",
|
|
|
|
"1 223 456 7890",
|
|
|
|
"223.456.7890",
|
|
|
|
"1-989-111-2222",
|
|
|
|
]
|
|
|
|
|
|
|
|
test_results = [
|
|
|
|
"1-223-456-7890"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
class Test_Normalizer(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
def test1(self):
|
|
|
|
input = s2_a4_a.normalize(test_numbers[0])
|
|
|
|
output = test_results[0]
|
|
|
|
self.assertEqual(input, output)
|
|
|
|
|
|
|
|
|
|
|
|
def test2(self):
|
|
|
|
self.assertRaises(ValueError, s2_a4_a.normalize, "Gehen Strings fit bre?")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|