Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve arguments of get_patrols #275

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add invalid format
  • Loading branch information
Yun-Wu committed Sep 30, 2024
commit 88ea866352cd994fa08c84c45d3e72d70cdcf5a6
10 changes: 6 additions & 4 deletions tests/test_earthranger_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ def test_das_client_method(er_io):


def test_get_patrols_datestr(er_io):
# patrols = er_io.get_patrols(
# since=pd.Timestamp("2017-01-01").isoformat(),
# until=pd.Timestamp("2017-04-01").isoformat(),
# )
since_str = "2017-01-01"
since_time = pd.to_datetime(since_str).replace(tzinfo=pytz.UTC)
until_str = "2017-04-01"
Expand All @@ -109,6 +105,11 @@ def test_get_patrols_datestr(er_io):
assert start <= until_time and end >= since_time


def test_get_patrols_datestr_invalid_format(er_io):
with pytest.raises(ValueError):
er_io.get_patrols(since="not a date")


def test_get_patrol_events(er_io):
events = er_io.get_patrol_events(
since=pd.Timestamp("2017-01-01").isoformat(),
Expand All @@ -119,6 +120,7 @@ def test_get_patrol_events(er_io):
assert "geometry" in events
assert "patrol_id" in events
assert "patrol_segment_id" in events
assert "time" in events


def test_post_observations(er_io):
Expand Down