def test_bad_phone_regex(): for item in BAD_PHONES: assert PHONE_REGEX.search(item) is None
def test_partial_phone_regex(): for item in PARTIAL_PHONES: assert item != PHONE_REGEX.search(item)
def replace_phone_numbers(text, replace_with='<phone>'): """Replace all phone numbers in ``text`` str with ``replace_with`` str.""" return PHONE_REGEX.sub(replace_with, text)
def test_good_phone_regex(): for item in GOOD_PHONES: assert item == PHONE_REGEX.search(item).group()
def test_partial_phone_regex(self): for item in PARTIAL_PHONES: self.assertNotEqual(item, PHONE_REGEX.search(item))
def replace_phone_numbers(text, replace_with='*PHONE*'): """Replace all phone numbers in ``text`` str with ``replace_with`` str.""" return PHONE_REGEX.sub(replace_with, text)
def test_bad_phone_regex(self): for item in BAD_PHONES: self.assertIsNone(PHONE_REGEX.search(item))
def test_good_phone_regex(self): for item in GOOD_PHONES: self.assertEqual(item, PHONE_REGEX.search(item).group())