diff --git a/tests/test_ComputedObect.py b/tests/test_ComputedObect.py index ef177677..faab7fc8 100644 --- a/tests/test_ComputedObect.py +++ b/tests/test_ComputedObect.py @@ -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(): diff --git a/tests/test_DateRange.py b/tests/test_DateRange.py index e8db3917..bbe6db77 100644 --- a/tests/test_DateRange.py +++ b/tests/test_DateRange.py @@ -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") diff --git a/tests/test_Image/test_default_spectral_indices.yml b/tests/test_Image/test_default_spectral_indices.yml index f6e27a59..6a718e17 100644 --- a/tests/test_Image/test_default_spectral_indices.yml +++ b/tests/test_Image/test_default_spectral_indices.yml @@ -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 diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index 4038ef28..26e9cbc3 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -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 @@ -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."""