Skip to content

Commit 08d3ed0

Browse files
authored
Merge pull request #574 from sanders41/date-test
Add additional date conversion test
2 parents 3369c6f + d726397 commit 08d3ed0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

meilisearch_python_async/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ async def create_key(self, key: KeyCreate) -> Key:
387387
>>> )
388388
>>> keys = await client.create_key(key_info)
389389
"""
390-
# The json.loads(key.json()) is because Pydantic can't serialize a date in a Python dict,
391-
# but can when converting to a json string.
392390
if is_pydantic_2():
393391
response = await self._http_requests.post("keys", json.loads(key.model_dump_json(by_alias=True))) # type: ignore[attr-defined]
394392
else: # pragma: no cover

tests/test_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from datetime import datetime
1+
from datetime import datetime, timezone
22

33
import pytest
44

@@ -14,6 +14,10 @@ def test_is_pydantic_2():
1414
[
1515
("2021-05-11T03:12:22.563960100Z", datetime(2021, 5, 11, 3, 12, 22, 563960)),
1616
(datetime(2021, 5, 11, 3, 12, 22, 563960), datetime(2021, 5, 11, 3, 12, 22, 563960)),
17+
(
18+
datetime(2023, 7, 12, 1, 40, 11, 993699, tzinfo=timezone.utc),
19+
datetime(2023, 7, 12, 1, 40, 11, 993699, tzinfo=timezone.utc),
20+
),
1721
(None, None),
1822
],
1923
)

0 commit comments

Comments
 (0)