import unittest 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"] class TestPhoneNumber(unittest.TestCase): def test_phoneCorrect1(self): self.assertEqual(s2_a4_a.normalize(test_numbers[0]), "1-223-456-7890") def test_phoneCorrect2(self): self.assertEqual(s2_a4_a.normalize(test_numbers[1]), "1-223-456-7890") def test_phoneCorrect3(self): self.assertEqual(s2_a4_a.normalize(test_numbers[2]), "1-223-456-7890") def test_phoneCorrect4(self): self.assertEqual(s2_a4_a.normalize(test_numbers[3]), "1-223-456-7890") def test_phoneCorrect5(self): self.assertEqual(s2_a4_a.normalize(test_numbers[4]), "1-223-456-7890") def test_phoneCorrect6(self): self.assertEqual(s2_a4_a.normalize(test_numbers[5]), "1-223-456-7890") def test_phoneCorrect7(self): self.assertEqual(s2_a4_a.normalize(test_numbers[6]), "1-989-111-2222") def test_failure(self): self.assertRaises(ValueError,s2_a4_a.normalize, "adasd") if __name__ == '__main__': unittest.main()