Skip to content

Conversation

@demoncoder-crypto
Copy link
Contributor

Added Unit Tests for OpenSentinelMap: Introduced a new test suite (TestOpenSentinelMap) in tests/test_datasets.py to specifically address test coverage for the OpenSentinelMap dataset class, fulfilling issue #516.

Implemented Mock Data Fixture: Created a pytest fixture (open_sentinel_map_data) that generates a temporary, self-contained mock dataset structure (including NPZ images, PNG masks, CSV metadata, and JSON config) required for testing OpenSentinelMap without needing the actual data.

Verified Core Functionality: The new tests cover essential OpenSentinelMap operations, including initialization with different splits/bands, data loading (getitem) with variations (interpolation, padding, truncation, random pairing), handling invalid inputs, and basic plotting (plot).

@Joao-L-S-Almeida
Copy link
Contributor

Hi, @demoncoder-crypto. Thank you for you contribution.
However, the automatic tests are still failing with output:

ERROR tests/test_datasets.py::TestMNeonTreeNonGeo::test_dataset_sample - AttributeError: type object 'MNeonTreeNonGeo' has no attribute 'train_data_dir'
ERROR tests/test_datasets.py::TestMNeonTreeNonGeo::test_plot - AttributeError: type object 'MNeonTreeNonGeo' has no attribute 'train_data_dir'
ERROR tests/test_datasets.py::TestMBrickKilnNonGeo::test_dataset_sample - AttributeError: type object 'MBrickKilnNonGeo' has no attribute 'train_data_dir'
ERROR tests/test_datasets.py::TestMBrickKilnNonGeo::test_plot - AttributeError: type object 'MBrickKilnNonGeo' has no attribute 'train_data_dir'
ERROR tests/test_datasets.py::TestMEuroSATNonGeo::test_dataset_sample - AttributeError: type object 'MEuroSATNonGeo' has no attribute 'splits_dir'
ERROR tests/test_datasets.py::TestMEuroSATNonGeo::test_plot - AttributeError: type object 'MEuroSATNonGeo' has no attribute 'splits_dir'
ERROR tests/test_datasets.py::TestFireScarsNonGeo::test_dataset_length - AttributeError: type object 'FireScarsNonGeo' has no attribute 'data_dir'
ERROR tests/test_datasets.py::TestFireScarsNonGeo::test_dataset_sample - AttributeError: type object 'FireScarsNonGeo' has no attribute 'data_dir'
ERROR tests/test_datasets.py::TestFireScarsNonGeo::test_plot - AttributeError: type object 'FireScarsNonGeo' has no attribute 'data_dir'
ERROR tests/test_datasets.py::TestMBigEarthNonGeo::test_dataset_sample - AttributeError: type object 'MBigEarthNonGeo' has no attribute 'metadata_filename'
ERROR tests/test_datasets.py::TestMBigEarthNonGeo::test_plot - AttributeError: type object 'MBigEarthNonGeo' has no attribute 'metadata_filename'
ERROR tests/test_datasets.py::TestMForestNetNonGeo::test_dataset_sample - AttributeError: type object 'MForestNetNonGeo' has no attribute 'examples_dir'
ERROR tests/test_datasets.py::TestMForestNetNonGeo::test_plot - AttributeError: type object 'MForestNetNonGeo' has no attribute 'examples_dir'
ERROR tests/test_datasets.py::TestMNzCattleNonGeo::test_dataset_sample - AttributeError: type object 'MNzCattleNonGeo' has no attribute 'images_dir'
ERROR tests/test_datasets.py::TestMNzCattleNonGeo::test_plot - AttributeError: type object 'MNzCattleNonGeo' has no attribute 'images_dir'
ERROR tests/test_datasets.py::TestMPv4gerNonGeo::test_dataset_sample - AttributeError: type object 'MPv4gerNonGeo' has no attribute 'images_dirname'
ERROR tests/test_datasets.py::TestMPv4gerNonGeo::test_plot - AttributeError: type object 'MPv4gerNonGeo' has no attribute 'images_dirname'
ERROR tests/test_datasets.py::TestMPv4gerSegNonGeo::test_dataset_sample - AttributeError: type object 'MPv4gerSegNonGeo' has no attribute 'images_dirname'
ERROR tests/test_datasets.py::TestMPv4gerSegNonGeo::test_plot - AttributeError: type object 'MPv4gerSegNonGeo' has no attribute 'images_dirname'
ERROR tests/test_datasets.py::TestMSo2SatNonGeo::test_dataset_sample - AttributeError: type object 'MSo2SatNonGeo' has no attribute 'h5_filename'
ERROR tests/test_datasets.py::TestMSo2SatNonGeo::test_plot - AttributeError: type object 'MSo2SatNonGeo' has no attribute 'h5_filename'
ERROR tests/test_datasets.py::TestMBeninSmallHolderCashewsNonGeo::test_dataset_sample - AttributeError: type object 'MBeninSmallHolderCashewsNonGeo' has no attribute 'chips_dir'
ERROR tests/test_datasets.py::TestMBeninSmallHolderCashewsNonGeo::test_plot - AttributeError: type object 'MBeninSmallHolderCashewsNonGeo' has no attribute 'chips_dir'
ERROR tests/test_datasets.py::TestMChesapeakeLandcoverNonGeo::test_dataset_sample - AttributeError: type object 'MChesapeakeLandcoverNonGeo' has no attribute 'train_img_dir'
ERROR tests/test_datasets.py::TestMChesapeakeLandcoverNonGeo::test_plot - AttributeError: type object 'MChesapeakeLandcoverNonGeo' has no attribute 'train_img_dir'
ERROR tests/test_datasets.py::TestSen1Floods11NonGeo::test_dataset_sample - AttributeError: type object 'Sen1Floods11NonGeo' has no attribute 's1_dir'
ERROR tests/test_datasets.py::TestSen1Floods11NonGeo::test_plot - AttributeError: type object 'Sen1Floods11NonGeo' has no attribute 's1_dir'
ERROR tests/test_datasets.py::TestMultiTemporalCropClassification::test_dataset_sample - AttributeError: type object 'MultiTemporalCropClassification' has no attribute 'data_dir'
ERROR tests/test_datasets.py::TestMultiTemporalCropClassification::test_plot - AttributeError: type object 'MultiTemporalCropClassification' has no attribute 'data_dir'
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_init - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_invalid_split - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_invalid_band - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_len - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_getitem_interpolated_stacked - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_getitem_not_interpolated_stacked - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_getitem_padding_truncation - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_getitem_pick_random_pair - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_getitem_target_channel - TypeError: Cannot handle this data type: (1, 1, 1), |u1
ERROR tests/test_datasets.py::TestOpenSentinelMap::test_plot - TypeError: Cannot handle this data type: (1, 1, 1), |u1

@demoncoder-crypto
Copy link
Contributor Author

demoncoder-crypto commented Apr 7, 2025

Ok I will work on it. Try to resolve it. Thanks for the response @Joao-L-S-Almeida

@Joao-L-S-Almeida Joao-L-S-Almeida added 1.1 and removed 1.0.1 labels Apr 7, 2025
@Joao-L-S-Almeida
Copy link
Contributor

Thank you. No worries.

@demoncoder-crypto
Copy link
Contributor Author

Screenshot 2025-04-07 200548

@demoncoder-crypto
Copy link
Contributor Author

Any updates @Joao-L-S-Almeida

@Joao-L-S-Almeida
Copy link
Contributor

Hi, @demoncoder-crypto. There are tests failing due to missing directories and attributes. I'm trying to reproduce them.

@romeokienzler
Copy link
Collaborator

@demoncoder-crypto closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants