@@ -53,6 +53,23 @@ def _item():
5353 )
5454
5555
56+ @pytest .fixture
57+ def _item_start_end ():
58+ return Item (
59+ id = "test_item_datetime" ,
60+ type = "Feature" ,
61+ geometry = {"type" : "Point" , "coordinates" : [0 , 0 ]},
62+ bbox = [- 180 , - 90 , 180 , 90 ],
63+ properties = {
64+ "datetime" : None ,
65+ "start_datetime" : "2000-01-01T00:00:00Z" ,
66+ "end_datetime" : "2000-01-02T00:00:00Z" ,
67+ },
68+ links = item_links ,
69+ assets = {},
70+ )
71+
72+
5673@pytest .fixture
5774def item (_item : Item ):
5875 return _item .model_dump_json ()
@@ -119,6 +136,71 @@ def item_collection(
119136 return CoreClient
120137
121138
139+ @pytest .fixture
140+ def TestCoreClientDatetime (collection_dict , _item_start_end ):
141+ class CoreClient (core .BaseCoreClient ):
142+ def post_search (
143+ self , search_request : BaseSearchPostRequest , ** kwargs
144+ ) -> stac .ItemCollection :
145+ return stac .ItemCollection (
146+ type = "FeatureCollection" ,
147+ features = [
148+ _item_start_end .model_dump (),
149+ ],
150+ )
151+
152+ def get_search (
153+ self ,
154+ collections : Optional [List [str ]] = None ,
155+ ids : Optional [List [str ]] = None ,
156+ bbox : Optional [List [NumType ]] = None ,
157+ intersects : Optional [str ] = None ,
158+ datetime : Optional [Union [str , datetime ]] = None ,
159+ limit : Optional [int ] = 10 ,
160+ ** kwargs ,
161+ ) -> stac .ItemCollection :
162+ return stac .ItemCollection (
163+ type = "FeatureCollection" ,
164+ features = [
165+ _item_start_end .model_dump (),
166+ ],
167+ )
168+
169+ def get_item (self , item_id : str , collection_id : str , ** kwargs ) -> stac .Item :
170+ return stac .Item (** _item_start_end .model_dump ())
171+
172+ def all_collections (self , ** kwargs ) -> stac .Collections :
173+ return stac .Collections (
174+ collections = [stac .Collection (** collection_dict )],
175+ links = [
176+ {"href" : "test" , "rel" : "root" },
177+ {"href" : "test" , "rel" : "self" },
178+ {"href" : "test" , "rel" : "parent" },
179+ ],
180+ )
181+
182+ def get_collection (self , collection_id : str , ** kwargs ) -> stac .Collection :
183+ return stac .Collection (** collection_dict )
184+
185+ def item_collection (
186+ self ,
187+ collection_id : str ,
188+ bbox : Optional [List [Union [float , int ]]] = None ,
189+ datetime : Optional [Union [str , datetime ]] = None ,
190+ limit : int = 10 ,
191+ token : str = None ,
192+ ** kwargs ,
193+ ) -> stac .ItemCollection :
194+ return stac .ItemCollection (
195+ type = "FeatureCollection" ,
196+ features = [
197+ _item_start_end .model_dump (),
198+ ],
199+ )
200+
201+ return CoreClient
202+
203+
122204@pytest .fixture
123205def AsyncTestCoreClient (collection_dict , item_dict ):
124206 class AsyncCoreClient (core .AsyncBaseCoreClient ):
0 commit comments