Skip to content

test: adapt unittest to assert new warnings of c59fe34d… #789

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 10 additions & 1 deletion tests/rest/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3137,12 +3137,21 @@ def test_load_stac_band_filtering_no_band_metadata_default(self, dummy_backend,
@pytest.mark.parametrize(
["bands", "has_band_dimension", "expected_pg_args", "expected_warnings"],
[
(None, False, {}, ["bands_from_stac_collection: no band name source found"]),
(
None,
False,
{},
[
"bands_from_stac_collection: consulting items for band metadata",
"bands_from_stac_collection: no band name source found",
],
),
(
["B02", "B03"],
True,
{"bands": ["B02", "B03"]},
[
"bands_from_stac_collection: consulting items for band metadata",
"bands_from_stac_collection: no band name source found",
"Bands ['B02', 'B03'] were specified in `load_stac`, but no band dimension was detected in the STAC metadata. Working with band dimension and specified bands.",
],
Expand Down
37 changes: 28 additions & 9 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,9 @@ def test_band_from_common_bands_metadata(self):
Band("B04", common_name="red", wavelength_um=0.665),
Band("B03", common_name="green", wavelength_um=0.560),
],
[],
[
"bands_from_stac_catalog with summaries.keys()=dict_keys(['eo:bands']) (which is non-standard)",
],
),
(
{
Expand All @@ -1243,7 +1245,10 @@ def test_band_from_common_bands_metadata(self):
Band("B04", common_name="red", wavelength_um=0.665),
Band("B03", common_name="green", wavelength_um=0.560),
],
["Using 'eo:bands' metadata, but STAC extension eo was not declared."],
[
"bands_from_stac_catalog with summaries.keys()=dict_keys(['eo:bands']) (which is non-standard)",
"Using 'eo:bands' metadata, but STAC extension eo was not declared.",
],
),
(
{
Expand All @@ -1260,7 +1265,9 @@ def test_band_from_common_bands_metadata(self):
"links": [],
},
[Band("B04"), Band("B03")],
[],
[
"bands_from_stac_catalog with summaries.keys()=dict_keys(['bands']) (which is non-standard)",
],
),
(
{
Expand All @@ -1280,7 +1287,9 @@ def test_band_from_common_bands_metadata(self):
Band("B04", common_name="red", wavelength_um=0.665),
Band("B03", common_name="green", wavelength_um=0.560),
],
[],
[
"bands_from_stac_catalog with summaries.keys()=dict_keys(['bands']) (which is non-standard)",
],
),
],
)
Expand Down Expand Up @@ -1384,7 +1393,9 @@ def test_bands_from_stac_collection(self, data, expected, caplog, expected_warni
},
{},
[Band("B02"), Band("B03")],
[],
[
"bands_from_stac_collection: consulting items for band metadata",
],
),
(
# Collection with two items with different bands (eo:bands metadata)
Expand Down Expand Up @@ -1413,7 +1424,9 @@ def test_bands_from_stac_collection(self, data, expected, caplog, expected_warni
},
{},
[Band("B02"), Band("B03")],
[],
[
"bands_from_stac_collection: consulting items for band metadata",
],
),
(
# Collection with two items with different bands in different metadata format
Expand Down Expand Up @@ -1441,7 +1454,9 @@ def test_bands_from_stac_collection(self, data, expected, caplog, expected_warni
},
{},
[Band("B02"), Band("B03")],
[],
[
"bands_from_stac_collection: consulting items for band metadata",
],
),
(
# Collection with one item, with band metadata in asset
Expand All @@ -1466,7 +1481,9 @@ def test_bands_from_stac_collection(self, data, expected, caplog, expected_warni
},
{},
[Band("B02")],
[],
[
"bands_from_stac_collection: consulting items for band metadata",
],
),
(
# Collection with multiple items and assets, only partially with band metadata
Expand Down Expand Up @@ -1497,7 +1514,9 @@ def test_bands_from_stac_collection(self, data, expected, caplog, expected_warni
},
{},
[Band("B02")],
[],
[
"bands_from_stac_collection: consulting items for band metadata",
],
),
],
)
Expand Down