Skip to content

Commit

Permalink
Make the test suite succeed on Python 3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 10, 2020
1 parent 372b10a commit ae7b064
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.code-workspace
__pycache__/
dwd_data/
.idea/
.idea/
.venv*
*.egg-info
3 changes: 2 additions & 1 deletion python_dwd/download/download.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
""" download scripts """
from typing import List, Union, Tuple
from pathlib import Path
import urllib
import urllib.request
import urllib.error
import zipfile
from io import BytesIO
from multiprocessing import Pool
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pandas==1.0.3
pandas==1.0.4
tables==3.6.1
numpy==1.18.3
scipy==1.4.1
Expand All @@ -8,6 +8,6 @@ aiofiles==0.4.0
ipython==7.10.1
ipython-genutils==0.2.0
matplotlib==3.0.3
pytest==5.4.1
mock==0.7.2
pytest==5.4.3
mock==4.0.2
fire==0.3.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
author_email='gutzemann@gmail.com',
packages=['python_dwd'], # , 'python_dwd.additionals'
install_requires=['pandas', 'pathlib',
'zipfile', 'scipy', 'numpy']
'scipy', 'numpy'],
)
11 changes: 7 additions & 4 deletions tests/additionals/test_geo_location.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from python_dwd.additionals.geo_location import get_nearest_station,\
derive_nearest_neighbours
_derive_nearest_neighbours
from python_dwd.enumerations.parameter_enumeration import Parameter
from python_dwd.enumerations.period_type_enumeration import PeriodType
from python_dwd.enumerations.time_resolution_enumeration import TimeResolution
Expand All @@ -17,13 +17,13 @@
MagicMock(return_value=pd.read_json(f"{fixtures_dir}FIXED_METADATA.JSON"))
)
def test_get_nearest_station():
nearest_indices, distances = get_nearest_station(
nearest_station, distances = get_nearest_station(
[50., 51.4], [8.9, 9.3],
Parameter.TEMPERATURE_AIR,
TimeResolution.HOURLY,
PeriodType.RECENT)

assert nearest_indices == [4411, 15207]
assert nearest_station == 4411

np.testing.assert_array_almost_equal(
np.array(distances),
Expand All @@ -35,10 +35,13 @@ def test_derive_nearest_neighbours():

metadata = pd.read_json(f"{fixtures_dir}FIXED_METADATA.JSON")

distances, indices_nearest_neighbours = derive_nearest_neighbours(
distances, indices_nearest_neighbours = _derive_nearest_neighbours(
metadata.LAT.values,
metadata.LON.values,
coords)

assert list(indices_nearest_neighbours) == [432, 655]

np.testing.assert_array_almost_equal(distances,
np.array([0.00182907, 0.00227919]))

Expand Down

0 comments on commit ae7b064

Please sign in to comment.