diff --git a/semantica/ingest/feed_ingestor.py b/semantica/ingest/feed_ingestor.py index db68861a..0dc40559 100644 --- a/semantica/ingest/feed_ingestor.py +++ b/semantica/ingest/feed_ingestor.py @@ -359,9 +359,14 @@ class FeedParser: return parser.parse(date_string) except (ImportError, OSError): + # If dateutil isn't available, fall through to raising ValueError pass + except Exception as e: + # If dateutil fails to parse, raise ValueError to signal invalid input + raise ValueError(f"Invalid date format: {date_string}") from e - return None + # No known formats matched and dateutil is unavailable; raise ValueError + raise ValueError(f"Invalid date format: {date_string}") def validate_feed(self, feed_data: FeedData) -> bool: """ diff --git a/tests/ingest/test_file_ingestor.py b/tests/ingest/test_file_ingestor.py index 60a18ac6..dc58c4d6 100644 --- a/tests/ingest/test_file_ingestor.py +++ b/tests/ingest/test_file_ingestor.py @@ -7,6 +7,7 @@ from unittest.mock import MagicMock # and we must populate the attributes that the code tries to import/patch. module_names = [ + "boto3", "google", "google.cloud", "google.cloud.storage", @@ -23,6 +24,7 @@ for name in module_names: # Explicitly add the classes that will be patched/used sys.modules["google.cloud.storage"].Client = MagicMock() sys.modules["azure.storage.blob"].BlobServiceClient = MagicMock() +sys.modules["boto3"].client = MagicMock() from pathlib import Path # noqa: E402 from unittest.mock import patch # noqa: E402