@@ -244,10 +244,10 @@ def test_delete(con100, requests_mock):
244244 assert adapter .called
245245
246246
247- def test_build_parameterized_cube_basic (con100 ):
248- layer = Parameter .string ("layer" )
249- dates = Parameter .string ("dates" )
250- bbox = Parameter ("bbox" , schema = "object" )
247+ def test_build_parameterized_cube_basic (con100 , recwarn ):
248+ layer = Parameter .string ("layer" , description = "Collection Id" )
249+ dates = Parameter .string ("dates" , description = "Temporal extent" )
250+ bbox = Parameter ("bbox" , schema = "object" , description = "bbox" )
251251 cube = con100 .load_collection (layer ).filter_temporal (dates ).filter_bbox (bbox )
252252
253253 assert cube .flat_graph () == {
@@ -265,6 +265,7 @@ def test_build_parameterized_cube_basic(con100):
265265 "result" : True ,
266266 }
267267 }
268+ assert recwarn .list == []
268269
269270
270271def test_build_parameterized_cube_single_date (con100 ):
@@ -293,10 +294,10 @@ def test_build_parameterized_cube_single_date(con100):
293294 }
294295
295296
296- def test_build_parameterized_cube_start_date (con100 ):
297- layer = Parameter .string ("layer" )
298- start = Parameter .string ("start" )
299- bbox = Parameter ("bbox" , schema = "object" )
297+ def test_build_parameterized_cube_start_date (con100 , recwarn ):
298+ layer = Parameter .string ("layer" , description = "Collection id" )
299+ start = Parameter .string ("start" , description = "Start date" )
300+ bbox = Parameter ("bbox" , schema = "object" , description = "Bbox" )
300301 cube = con100 .load_collection (layer ).filter_temporal (start , None ).filter_bbox (bbox )
301302
302303 assert cube .flat_graph () == {
@@ -314,12 +315,13 @@ def test_build_parameterized_cube_start_date(con100):
314315 "result" : True ,
315316 }
316317 }
318+ assert recwarn .list == []
317319
318320
319- def test_build_parameterized_cube_load_collection (con100 ):
320- layer = Parameter .string ("layer" )
321- dates = Parameter .string ("dates" )
322- bbox = Parameter ("bbox" , schema = "object" )
321+ def test_build_parameterized_cube_load_collection (con100 , recwarn ):
322+ layer = Parameter .string ("layer" , description = "Collection id" )
323+ dates = Parameter .string ("dates" , description = "temporal extent" )
324+ bbox = Parameter ("bbox" , schema = "object" , description = "bbox" )
323325 cube = con100 .load_collection (layer , spatial_extent = bbox , temporal_extent = dates )
324326
325327 assert cube .flat_graph () == {
@@ -333,6 +335,52 @@ def test_build_parameterized_cube_load_collection(con100):
333335 "result" : True ,
334336 }
335337 }
338+ assert recwarn .list == []
339+
340+
341+ def test_build_parameterized_cube_load_collection_invalid_bbox_schema (con100 ):
342+ layer = Parameter .string ("layer" , description = "Collection id" )
343+ dates = Parameter .string ("dates" , description = "Temporal extent" )
344+ bbox = Parameter .string ("bbox" , description = "Spatial extent" )
345+ with pytest .warns (
346+ UserWarning ,
347+ match = "Unexpected parameterized `spatial_extent` in `load_collection`: expected schema with type 'object' but got {'type': 'string'}." ,
348+ ):
349+ cube = con100 .load_collection (layer , spatial_extent = bbox , temporal_extent = dates )
350+
351+ assert cube .flat_graph () == {
352+ "loadcollection1" : {
353+ "process_id" : "load_collection" ,
354+ "arguments" : {
355+ "id" : {"from_parameter" : "layer" },
356+ "temporal_extent" : {"from_parameter" : "dates" },
357+ "spatial_extent" : {"from_parameter" : "bbox" },
358+ },
359+ "result" : True ,
360+ }
361+ }
362+
363+
364+ def test_build_parameterized_cube_filter_bbox_invalid_schema (con100 ):
365+ layer = Parameter .string ("layer" , description = "Collection id" )
366+ bbox = Parameter .string ("bbox" , description = "Spatial extent" )
367+ with pytest .warns (
368+ UserWarning ,
369+ match = "Unexpected parameterized `extent` in `filter_bbox`: expected schema with type 'object' but got {'type': 'string'}." ,
370+ ):
371+ cube = con100 .load_collection (layer ).filter_bbox (bbox )
372+
373+ assert cube .flat_graph () == {
374+ "loadcollection1" : {
375+ "process_id" : "load_collection" ,
376+ "arguments" : {"id" : {"from_parameter" : "layer" }, "temporal_extent" : None , "spatial_extent" : None },
377+ },
378+ "filterbbox1" : {
379+ "process_id" : "filter_bbox" ,
380+ "arguments" : {"data" : {"from_node" : "loadcollection1" }, "extent" : {"from_parameter" : "bbox" }},
381+ "result" : True ,
382+ },
383+ }
336384
337385
338386def test_build_parameterized_cube_load_collection_band (con100 ):
0 commit comments