Skip to content

Commit

Permalink
fix(crunch): skip missing key in filter_property (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato authored Jan 10, 2025
1 parent 938c23e commit 17c23a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 17c23a4

Please sign in to comment.