Skip to content

Commit

Permalink
check spatial temporal bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang committed Jul 5, 2023
1 parent c13879d commit 29eb85f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.10
python-version: '3.10'
- name: Python info
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.organization=ecoextreml
sonar.projectKey=EcoExtreML_zampy
sonar.host.url=https://sonarcloud.io
sonar.sources=zampy/
sonar.sources=src/zampy/
sonar.tests=tests/
sonar.links.homepage=https://github.com/EcoExtreML/zampy
sonar.links.scm=https://github.com/EcoExtreML/zampy
Expand Down
16 changes: 16 additions & 0 deletions tests/test_dataset_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
import pytest
from zampy.datasets import dataset_protocol
from zampy.datasets.dataset_protocol import SpatialBounds
from zampy.datasets.dataset_protocol import TimeBounds
Expand Down Expand Up @@ -81,3 +82,18 @@ def test_copy_properties_file():
# Verify that the file has been copied
target_file_path = target_folder / "properties.json"
assert target_file_path.exists()


def test_invalid_spatial_bounds_north_south():
with pytest.raises(ValueError, match="greater than norther bound"):
SpatialBounds(51, 6, 54, 3)


def test_invalid_spatial_bounds_east_west():
with pytest.raises(ValueError, match="greater than east bound"):
SpatialBounds(54, 6, 51, 20)


def test_invalid_time_bounds():
with pytest.raises(ValueError):
TimeBounds(np.datetime64("2021-01-01"), np.datetime64("2020-12-31"))

0 comments on commit 29eb85f

Please sign in to comment.