Skip to content

Commit

Permalink
Test phonenumber handling of phone number extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag committed Nov 16, 2023
1 parent a55feed commit 79bad4c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_phonenumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def test_phonenumber_default_format(self):
with override_settings(PHONENUMBER_DEFAULT_FORMAT="RFC3966"):
self.assertEqual(str(phone), "tel:+33-6-12-34-56-78")

def test_phonenumber_extensions(self):
for data in [
"+33612345678 extension 456",
"+33612345678 ext. 456",
"+33612345678,456",
]:
with self.subTest(data):
phone = PhoneNumber.from_string(data)
self.assertEqual(phone.as_international, "+33 6 12 34 56 78 ext. 456")
self.assertEqual(phone.as_rfc3966, "tel:+33-6-12-34-56-78;ext=456")

def test_phonenumber_formatting_properties(self):
phone = PhoneNumber.from_string("+33612345678")
self.assertEqual(phone.as_e164, "+33612345678")
Expand Down

0 comments on commit 79bad4c

Please sign in to comment.