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

fix(crunch): skip missing key in filter_property #1466

Merged
merged 2 commits into from
Jan 10, 2025
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
5 changes: 2 additions & 3 deletions eodag/plugins/crunch/filter_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ def proceed(
for product in products:
if property_key not in product.properties.keys():
logger.warning(
"%s not found in product.properties, filtering disabled.",
property_key,
f"{property_key} not found in {product}.properties, product skipped",
)
return products
continue
if operator_method(product.properties[property_key], property_value):
add_to_filtered(product)

Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_search_stac_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ def test_search_stac_static_crunch_filter_property(self):
)
self.assertEqual(len(filtered_items), 1)

with self.assertLogs(level="WARNING") as cm:
filtered_items = items.filter_property(foo="bar")
self.assertIn("foo not found in EOProduct", str(cm.output))
self.assertEqual(len(filtered_items), 0)

@mock.patch(
"eodag.api.core.EODataAccessGateway.fetch_product_types_list", autospec=True
)
Expand Down
Loading