Skip to content

Commit

Permalink
remove tests that were redundant and correct mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zigaLuksic committed Aug 18, 2023
1 parent 07ea4d3 commit 4fe752e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion eolearn/core/eodata_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _get_feature_io_constructor(ftype: FeatureType, use_zarr: bool) -> type[Feat
return FeatureIOJson
if ftype.is_vector():
return FeatureIOGeoDf
return FeatureIOZarr if use_zarr else FeatureIONumpy
return FeatureIOZarr if use_zarr else FeatureIONumpy # type: ignore[return-value] # not sure why


def _remove_redundant_files(
Expand Down
20 changes: 5 additions & 15 deletions tests/core/test_eodata_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import json
import os
import sys
import tempfile
import warnings
from typing import Any

Expand Down Expand Up @@ -91,11 +90,6 @@ def eopatch_fixture():
return eopatch


def test_saving_to_a_file(eopatch):
with tempfile.NamedTemporaryFile() as fp, pytest.raises(CreateFailed):
eopatch.save(fp.name)


@mock_s3
@pytest.mark.parametrize("fs_loader", FS_LOADERS)
@pytest.mark.parametrize("use_zarr", [True, False])
Expand Down Expand Up @@ -221,11 +215,9 @@ def test_save_add_only_features(eopatch, fs_loader, use_zarr: bool):

@mock_s3
@pytest.mark.parametrize("fs_loader", FS_LOADERS)
@pytest.mark.parametrize("use_zarr", [True, False])
def test_bbox_always_saved(eopatch, fs_loader, use_zarr: bool):
_skip_when_appropriate(fs_loader, use_zarr)
def test_bbox_always_saved(eopatch, fs_loader):
with fs_loader() as temp_fs:
eopatch.save("/", filesystem=temp_fs, features=[FeatureType.DATA], use_zarr=use_zarr)
eopatch.save("/", filesystem=temp_fs, features=[FeatureType.DATA])
assert temp_fs.exists("/bbox.geojson")


Expand Down Expand Up @@ -340,12 +332,10 @@ def test_save_and_load_tasks(eopatch, fs_loader, use_zarr: bool):

@mock_s3
@pytest.mark.parametrize("fs_loader", FS_LOADERS)
@pytest.mark.parametrize("use_zarr", [True, False])
def test_fail_saving_nonexistent_feature(eopatch, fs_loader, use_zarr: bool):
_skip_when_appropriate(fs_loader, use_zarr)
def test_fail_saving_nonexistent_feature(eopatch, fs_loader):
features = [(FeatureType.DATA, "nonexistent")]
with fs_loader() as temp_fs, pytest.raises(ValueError):
eopatch.save("/", filesystem=temp_fs, features=features, use_zarr=use_zarr)
eopatch.save("/", filesystem=temp_fs, features=features)


@mock_s3
Expand Down Expand Up @@ -610,7 +600,7 @@ def test_partial_temporal_loading_fails_for_numpy(fs_loader: type[FS], eopatch:
@mock_s3
@pytest.mark.parametrize("fs_loader", FS_LOADERS)
@pytest.mark.parametrize("temporal_selection", [[3, 4, 10]])
def test_partial_temporal_loading_fails(fs_loader: type[FS], eopatch: EOPatch, temporal_selection):
def test_partial_temporal_loading_fails_bad_selection(fs_loader: type[FS], eopatch: EOPatch, temporal_selection):
_skip_when_appropriate(fs_loader, True)
with fs_loader() as temp_fs:
eopatch.save(path="patch-folder", filesystem=temp_fs, use_zarr=True)
Expand Down

0 comments on commit 4fe752e

Please sign in to comment.