def test_integer_as_phone(self): '''Tests whether Phone can be created from just an integer 3345551234''' phone1 = 3345551234 real_phone = '334-555-1234' number1 = PhoneNumber(phone1, 'cell') self.assertIn(real_phone, number1.get_number())
def test_phone_extension(self): '''Test ability to create phone object from 334-555-1234 ext. 1234 and variants''' phone1 = '334-555-1234 ext. 1234' phone2 = '(334) 555-1234 ext. 1234' phone3 = '1-334 555 1234 ext. 1234' phone4 = '3345551234x1234' number1 = PhoneNumber(phone1, 'cell') number2 = PhoneNumber(phone2, 'cell') number3 = PhoneNumber(phone3, 'cell') number4 = PhoneNumber(phone4, 'cell') self.assertIn(phone1, number1.get_number()) self.assertIn(phone1, number2.get_number()) self.assertIn(phone1, number3.get_number()) self.assertIn(phone1, number4.get_number())
def test_simple_phone(self): '''Test ability to create phone object from simple 334-555-1234 number and variants''' phone1 = '334-555-1234' phone2 = '(334) 555-1234' phone3 = '334 555 1234' phone4 = '3345551234' number1 = PhoneNumber(phone1, 'cell') number2 = PhoneNumber(phone2, 'cell') number3 = PhoneNumber(phone3, 'cell') number4 = PhoneNumber(phone4, 'cell') self.assertIn(phone1, number1.get_number()) self.assertIn(phone1, number2.get_number()) self.assertIn(phone1, number3.get_number()) self.assertIn(phone1, number4.get_number())