From a7893884b365ee01224452c5bec67370f19e6163 Mon Sep 17 00:00:00 2001 From: saratvk Date: Thu, 10 Oct 2024 14:13:43 -0400 Subject: [PATCH] issue #41: add unit tests for phone_number format checking --- tests/test_inspection.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_inspection.py b/tests/test_inspection.py index d0d2842..e6d748f 100644 --- a/tests/test_inspection.py +++ b/tests/test_inspection.py @@ -298,6 +298,22 @@ def test_registration_number_mixed_format(self): instance = FertilizerInspection(registration_number="12A34567B") self.assertIsNone(instance.registration_number) +class TestFertilizerInspectionPhoneNumberFormat(unittest.TestCase): + def test_phone_number_with_country_code(self): + instance = FertilizerInspection(company_phone_number="1-800-640-9605") + self.assertEqual(instance.company_phone_number, "800-640-9605") + + def test_phone_number_with_parentheses(self): + instance = FertilizerInspection(manufacturer_phone_number="(757) 123-4567, (800) 456-7890") + self.assertEqual(instance.manufacturer_phone_number, "757-123-4567") + + def test_phone_number_with_parentheses_and_country_code(self): + instance = FertilizerInspection(manufacturer_phone_number="+1 (757) 123-4567, (800) 456-7890") + self.assertEqual(instance.manufacturer_phone_number, "757-123-4567") + + def test_phone_number_with_chars(self): + instance = FertilizerInspection(manufacturer_phone_number="+1 800 123-4567 FAX") + self.assertEqual(instance.manufacturer_phone_number, "800-123-4567") if __name__ == "__main__": unittest.main()