Skip to content

Commit

Permalink
Fix iso-date format
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnah199 committed Oct 25, 2024
1 parent bc347b9 commit 485960b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions integrations/azure_ai_search/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
],
)

Expand All @@ -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)
],
)

Expand All @@ -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)
],
)

Expand All @@ -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)
],
)

Expand Down

0 comments on commit 485960b

Please sign in to comment.