Skip to content

Commit

Permalink
assert datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jan 14, 2025
1 parent dc27041 commit 532acbd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stac_fastapi/api/tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime as python_datetime
from typing import List, Optional, Union

import attr
Expand Down Expand Up @@ -141,7 +141,7 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
filter: Optional[str] = None,
filter_crs: Optional[str] = None,
Expand Down Expand Up @@ -221,7 +221,7 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
**kwargs,
) -> stac.ItemCollection:
Expand All @@ -247,7 +247,7 @@ def item_collection(
self,
collection_id: str,
bbox: Optional[List[Union[float, int]]] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: int = 10,
token: str = None,
**kwargs,
Expand Down Expand Up @@ -400,10 +400,11 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
**kwargs,
):
assert isinstance(datetime, python_datetime)
return datetime

def get_item(self, item_id: str, collection_id: str, **kwargs) -> stac.Item:
Expand All @@ -419,7 +420,7 @@ def item_collection(
self,
collection_id: str,
bbox: Optional[List[Union[float, int]]] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: int = 10,
token: str = None,
**kwargs,
Expand Down

0 comments on commit 532acbd

Please sign in to comment.