Files
monica_site/site/contacts/tests_nominatim.py
T
westfarn 1f7d78de64
Deploy Beta / unit-tests (push) Successful in 9s
Deploy Beta / docker (push) Successful in 17s
Deploy Beta / deploy-beta (push) Successful in 2m31s
Add Django site, Docker packaging, and beta/prod Gitea deploys.
Unignore site/ (was blocked by mkdocs /site rule), add compose/Docker/uv tooling, and split deploys so push to main goes to beta while prod stays manual.
2026-08-08 07:32:55 -05:00

43 lines
1.4 KiB
Python

from contacts.nominatim import normalize_hit
def test_line1_keeps_house_number_from_query_when_nominatim_omits_it():
raw = {
"display_name": (
"Greensboro Drive, Wheaton, DuPage County, Illinois, 60189, United States"
),
"address": {
"road": "Greensboro Drive",
"town": "Wheaton",
"county": "DuPage County",
"state": "Illinois",
"postcode": "60189",
"country_code": "us",
"ISO3166-2-lvl4": "US-IL",
},
}
hit = normalize_hit(raw, query="1968 Greensboro Drive, Wheaton")
assert hit["line1"] == "1968 Greensboro Drive"
assert hit["label"].startswith("1968 Greensboro Drive")
assert hit["city"] == "Wheaton"
assert hit["state"] == "IL"
assert hit["zip"] == "60189"
def test_line1_prefers_nominatim_house_number():
raw = {
"display_name": "1968 Greensboro Drive, Wheaton, Illinois, 60189, United States",
"address": {
"house_number": "1968",
"road": "Greensboro Drive",
"town": "Wheaton",
"state": "Illinois",
"postcode": "60189",
"country_code": "us",
"ISO3166-2-lvl4": "US-IL",
},
}
hit = normalize_hit(raw, query="1968 Greensboro Drive")
assert hit["line1"] == "1968 Greensboro Drive"
assert hit["label"] == raw["display_name"]