Skip to content

Commit

Permalink
Merge pull request #97 from raphaelrpl/big-tmp
Browse files Browse the repository at this point in the history
🎨 code review and minor adjusts in tests
  • Loading branch information
raphaelrpl authored Aug 19, 2024
2 parents 830d3e3 + 0b36637 commit 58c8d27
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Changes
=======

Version 1.0.0 (2024-08-14)
Version 1.0.0 (2024-08-19)
--------------------------

- Add driver for Copernicus DataSpace EcoSystem.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is part of Brazil Data Cube BDC-Collectors.
# Copyright (C) 2023 INPE.
# Copyright (C) 2024 INPE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -70,7 +70,7 @@
'sentinelsat>=0.14,<1.3',
'Shapely>=1.8',
'tqdm>=4.50',
'pystac-client>=0.6,<0.7'
'pystac-client>=0.6,<0.8'
]

packages = find_packages()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scihub.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_search(self, app, requests_mock, catalog_scihub):
}
)

requests_mock.post(search_url, json=json_result, status_code=200, headers={'content-type': 'application/json'})
requests_mock.get(search_url, json=json_result, status_code=200, headers={'content-type': 'application/json'})

res = provider.search('S2MSI1C', start_date='2020-01-01', end_date='2020-01-10',
platform='Sentinel-2', cloud_cover=100, bbox=[-54, -12, -52, -10])
Expand Down
18 changes: 17 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

import pytest
import requests
import shapely.geometry

from bdc_collectors.exceptions import DownloadError
from bdc_collectors.utils import download_stream, working_directory
from bdc_collectors.utils import download_stream, to_geom, working_directory


@pytest.fixture
Expand Down Expand Up @@ -81,3 +82,18 @@ def test_change_work_dir():
assert os.getcwd() == tmp

assert os.getcwd() == old


def test_to_geom():
for value in ["POINT(-54 -12)", shapely.geometry.Point(-53, -15), {"type": "Point", "coordinates": [-47, -10]}]:
geom = to_geom(value)
assert isinstance(geom, shapely.geometry.base.BaseGeometry)

with pytest.raises(ValueError) as exc:
to_geom(10)

exc.match("Invalid geometry")

with pytest.raises(shapely.errors.GEOSException) as exc:
to_geom("PPOINT (-54 -12)")
exc.match("ParseException: Unknown type: 'PPOINT'")

0 comments on commit 58c8d27

Please sign in to comment.