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

update #176

Merged
merged 11 commits into from
Jan 28, 2024
4 changes: 4 additions & 0 deletions tests/test_ComputedObect.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def test_open(self, tmp_path):
opened = ee.Number.open(file)
assert object.eq(opened).getInfo()

def test_open_not_correct_suffix(self):
with pytest.raises(ValueError):
ee.Number.open("file.toto")

def test_deprecated_method(self, tmp_path):
(object := ee.Number(1.1)).save((file := tmp_path / "test.gee"))
with pytest.deprecated_call():
Expand Down
8 changes: 8 additions & 0 deletions tests/test_DateRange.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ def test_deprecated_alertnate_method(self, daterange_instance):
assert list.size().getInfo() == 30
assert first.format("YYYY-MM-dd").getInfo() == "2020-01-01"
assert last.format("YYYY-MM-dd").getInfo() == "2020-01-31"


class TestCheckUnit:
"""Test the ``check_unit`` method exception."""

def test_check_unit(self):
with pytest.raises(ValueError):
ee.DateRange.geetools.check_unit("toto")
2 changes: 1 addition & 1 deletion tests/test_Image/test_default_spectral_indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ WI2: -0.3508100169371153
WI2015: -108966.54196450702
WRI: 0.39238655381190113
WVP: 681.9462692210739
kEVI: 0.754691564374628
kEVI: 0.7546915643746379
kIPVI: 0.6366978189206153
kNDVI: 0.27339563784123116
kRVI: 2.04969719717336
Expand Down
11 changes: 11 additions & 0 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Test all the deprecated methods that have not been kept in the new implementation."""

from datetime import datetime

import pytest

import geetools
Expand All @@ -17,6 +19,15 @@ def test_stretch_percentile(self):
geetools.visualization.stretch_percentile(None, None)


class TestDate:
"""Test methods from the deprecated_date module."""

def test_millis_to_datetime(self):
with pytest.deprecated_call():
date = geetools.date.millisToDatetime(1527811200000)
assert date == datetime.strptime("2018-06-01", "%Y-%m-%d")


class TestCollection:
"""Test methods from the deprecated_collection module."""

Expand Down