diff --git a/integrations/azure_ai_search/tests/test_document_store.py b/integrations/azure_ai_search/tests/test_document_store.py index ebffe6b83..754a8c0d0 100644 --- a/integrations/azure_ai_search/tests/test_document_store.py +++ b/integrations/azure_ai_search/tests/test_document_store.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 import os import random -from datetime import datetime +from datetime import datetime, timezone from typing import List from unittest.mock import patch @@ -245,7 +245,8 @@ def test_comparison_greater_than_with_iso_date(self, document_store, filterable_ d for d in filterable_docs if d.meta.get("date") is not None - and datetime.fromisoformat(d.meta["date"]) > datetime.fromisoformat("1972-12-11T19:54:58Z") + and datetime.strptime(d.meta["date"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) + > datetime.strptime("1972-12-11T19:54:58Z", "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) ], ) @@ -261,7 +262,8 @@ def test_comparison_greater_than_equal_with_iso_date(self, document_store, filte d for d in filterable_docs if d.meta.get("date") is not None - and datetime.fromisoformat(d.meta["date"]) >= datetime.fromisoformat("1969-07-21T20:17:40Z") + and datetime.strptime(d.meta["date"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) + >= datetime.strptime("1969-07-21T20:17:40Z", "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) ], ) @@ -277,7 +279,8 @@ def test_comparison_less_than_with_iso_date(self, document_store, filterable_doc d for d in filterable_docs if d.meta.get("date") is not None - and datetime.fromisoformat(d.meta["date"]) < datetime.fromisoformat("1969-07-21T20:17:40Z") + and datetime.strptime(d.meta["date"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) + < datetime.strptime("1969-07-21T20:17:40Z", "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) ], ) @@ -293,7 +296,8 @@ def test_comparison_less_than_equal_with_iso_date(self, document_store, filterab d for d in filterable_docs if d.meta.get("date") is not None - and datetime.fromisoformat(d.meta["date"]) <= datetime.fromisoformat("1969-07-21T20:17:40Z") + and datetime.strptime(d.meta["date"], "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) + <= datetime.strptime("1969-07-21T20:17:40Z", "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) ], )