-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Top-level package for overturetoosm.""" | ||
|
||
__version__ = "0.2.0" | ||
__version__ = "0.2.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from typing import Dict, Any | ||
import pytest | ||
from src.overturetoosm.addresses import process_address | ||
|
||
|
||
@pytest.fixture(name="clean_dict") | ||
def clean_fix() -> Dict[str, Any]: | ||
"""Fixture with the clean address properties""" | ||
return { | ||
"addr:country": "US", | ||
"addr:postcode": "02459", | ||
"addr:street": "COMMONWEALTH AVE", | ||
"addr:housenumber": "1000", | ||
"addr:state": "MA", | ||
} | ||
|
||
|
||
@pytest.fixture(name="props_dict") | ||
def props_fix() -> Dict[str, Any]: | ||
"""Fixture with the raw address properties""" | ||
return { | ||
"theme": "addresses", | ||
"type": "address", | ||
"version": 0, | ||
"country": "US", | ||
"address_levels": [{"value": "MA"}, {"value": "NEWTON CENTRE"}], | ||
"postcode": "02459", | ||
"street": "COMMONWEALTH AVE", | ||
"number": "1000", | ||
} | ||
|
||
|
||
def test_process_address(props_dict, clean_dict) -> None: | ||
"""Test that address properties are processed correctly""" | ||
assert process_address(props_dict) == clean_dict | ||
|
||
|
||
def test_process_address_no_levels(props_dict, clean_dict) -> None: | ||
"""Test that address properties are processed correctly""" | ||
props_dict.pop("address_levels", None) | ||
clean_dict.pop("addr:state", None) | ||
assert process_address(props_dict) == clean_dict | ||
|
||
|
||
def test_process_address_not_us(props_dict, clean_dict) -> None: | ||
"""Test that address properties are processed correctly""" | ||
clean_dict.pop("addr:state", None) | ||
assert process_address(props_dict, style="CA") == clean_dict |