From 7fa2cc8aab851c06bd209bac7c3dcbc0dfdd8e85 Mon Sep 17 00:00:00 2001 From: Ethan Hampton Date: Mon, 15 Dec 2025 21:15:26 -0600 Subject: [PATCH 1/2] Add hyphen to phone numbers --- README.md | 2 +- src/atlus/__init__.py | 2 +- src/atlus/atlus.py | 6 +++--- tests/test.py | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d87d36a..eb84452 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ pip install atlus >>> atlus.get_address("789 Oak Dr, Smallville California, 98765")[0] {"addr:housenumber": "789", "addr:street": "Oak Drive", "addr:city": "Smallville", "addr:state": "CA", "addr:postcode": "98765"} >>> atlus.get_phone("(202) 900-9019") -"+1 202-900-9019" +"+1-202-900-9019" ``` ## Docs diff --git a/src/atlus/__init__.py b/src/atlus/__init__.py index ec45294..ff78c27 100644 --- a/src/atlus/__init__.py +++ b/src/atlus/__init__.py @@ -12,7 +12,7 @@ {"addr:housenumber": "789", "addr:street": "Oak Drive", "addr:city": "Smallville", "addr:state": "CA", "addr:postcode": "98765"} >>> atlus.get_phone("(202) 900-9019") -"+1 202-900-9019" +"+1-202-900-9019" ``` """ diff --git a/src/atlus/atlus.py b/src/atlus/atlus.py index a58765f..1c66799 100644 --- a/src/atlus/atlus.py +++ b/src/atlus/atlus.py @@ -470,9 +470,9 @@ def get_phone(phone: str) -> str: ```python >>> get_phone("2029009019") - "+1 202-900-9019" + "+1-202-900-9019" >>> get_phone("(202) 900-9019") - "+1 202-900-9019" + "+1-202-900-9019" >>> get_phone("202-900-901") ValueError: Invalid phone number: 202-900-901 ``` @@ -491,6 +491,6 @@ def get_phone(phone: str) -> str: ) if phone_valid: return ( - f"+1 {phone_valid.group(1)}-{phone_valid.group(2)}-{phone_valid.group(3)}" + f"+1-{phone_valid.group(1)}-{phone_valid.group(2)}-{phone_valid.group(3)}" ) raise ValueError(f"Invalid phone number: {phone}") diff --git a/tests/test.py b/tests/test.py index 0626d26..2501b3e 100644 --- a/tests/test.py +++ b/tests/test.py @@ -433,11 +433,11 @@ def test_get_address_removed_postcode() -> None: def test_valid_phone_number() -> None: """Test cases for valid phone numbers""" - assert get_phone("2029009019") == "+1 202-900-9019" - assert get_phone("(202) 900-9019") == "+1 202-900-9019" - assert get_phone("202-900-9019") == "+1 202-900-9019" - assert get_phone("+1 202 900 9019") == "+1 202-900-9019" - assert get_phone("+1 (202) 900-9019") == "+1 202-900-9019" + assert get_phone("2029009019") == "+1-202-900-9019" + assert get_phone("(202) 900-9019") == "+1-202-900-9019" + assert get_phone("202-900-9019") == "+1-202-900-9019" + assert get_phone("+1 202 900 9019") == "+1-202-900-9019" + assert get_phone("+1 (202) 900-9019") == "+1-202-900-9019" def test_invalid_phone_number_1() -> None: From aa367806664baad90a7289164ac1d99ad41d98b7 Mon Sep 17 00:00:00 2001 From: Will Date: Tue, 16 Dec 2025 07:58:57 -0600 Subject: [PATCH 2/2] changing one phone format in comment --- src/atlus/atlus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atlus/atlus.py b/src/atlus/atlus.py index 1c66799..100238a 100644 --- a/src/atlus/atlus.py +++ b/src/atlus/atlus.py @@ -466,7 +466,7 @@ def get_address(address_string: str) -> tuple[dict[str, str], list[str | None]]: def get_phone(phone: str) -> str: - """Format phone numbers to the US and Canadian standard format of `+1 XXX-XXX-XXXX`. + """Format phone numbers to the US and Canadian standard format of `+1-XXX-XXX-XXXX`. ```python >>> get_phone("2029009019")