-
Notifications
You must be signed in to change notification settings - Fork 58
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
5 changed files
with
80 additions
and
8 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
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 |
---|---|---|
|
@@ -48,7 +48,7 @@ def find_version(*file_paths): | |
author_email="[email protected]", | ||
py_modules=["pgeocode"], | ||
python_requires=">=3.6", | ||
install_requires=["requests", "numpy", "pandas"], | ||
install_requires=["requests", "numpy", "pandas", "scipy"], | ||
classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f], | ||
license="BSD", | ||
) |
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,19 +1,19 @@ | ||
# License 3-clause BSD | ||
# | ||
# Authors: Roman Yurchak <[email protected]> | ||
import json | ||
import os | ||
import urllib | ||
import json | ||
from zipfile import ZipFile | ||
from io import BytesIO | ||
from zipfile import ZipFile | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
from numpy.testing import assert_allclose, assert_array_equal | ||
|
||
import pgeocode | ||
from pgeocode import GeoDistance, Nominatim, haversine_distance | ||
from pgeocode import GeoDistance, Nominatim, haversine_distance, NearestNominatim | ||
from pgeocode import _open_extract_url | ||
|
||
|
||
|
@@ -129,7 +129,6 @@ def test_nominatim_all_countries(country): | |
|
||
|
||
def test_nominatim_distance_postal_code(): | ||
|
||
gdist = GeoDistance("fr") | ||
|
||
dist = gdist.query_postal_code("91120", "91120") | ||
|
@@ -180,6 +179,24 @@ def test_haversine_distance(): | |
assert_allclose(d_ref, d_pred, atol=3) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"country, postal_code, location, lat, long", | ||
[ | ||
("it", "00155", "Rome", 41.9028, 12.4964), | ||
("it", "20129", "Milan", 45.4642, 9.1900), | ||
("it", "10149", "Turin", 45.0703, 7.6869), | ||
("it", "90151", "Palermo", 38.1157, 13.3615), | ||
], | ||
) | ||
def test_inverse_geocoding(country, postal_code, location, lat, long): | ||
n = NearestNominatim(country) | ||
|
||
res = n.inverse_geocoding(lat, long, k=1) | ||
|
||
assert isinstance(res, list) | ||
assert postal_code in res | ||
|
||
|
||
def test_open_extract_url(httpserver): | ||
download_url = "/fr.txt" | ||
|
||
|