Skip to content

Commit

Permalink
issue #41: add unit tests for phone_number format checking
Browse files Browse the repository at this point in the history
  • Loading branch information
saratavakoli77 committed Oct 10, 2024
1 parent 8aa5211 commit a789388
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit a789388

Please sign in to comment.