Skip to content

Commit 4a6d5ea

Browse files
committed
fixup! Issue #114/#141 convert inline GeoJSON in aggregate_spatial to VectorCube
1 parent 886b663 commit 4a6d5ea

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

tests/test_views_execute.py

+24-16
Original file line numberDiff line numberDiff line change
@@ -537,24 +537,28 @@ def test_execute_mask(api):
537537
api.check_result("mask.json")
538538
assert dummy_backend.get_collection("S2_FAPAR_CLOUDCOVER").mask.call_count == 1
539539

540-
expected = {
540+
expected_spatial_extent = {
541541
"west": 7.02,
542542
"south": 51.2,
543543
"east": 7.65,
544544
"north": 51.7,
545-
"crs": 'EPSG:4326',
545+
"crs": "EPSG:4326",
546546
}
547-
expected_geometry = shapely.geometry.shape({
548-
"type": "Polygon",
549-
"coordinates": [[[7.02, 51.7], [7.65, 51.7], [7.65, 51.2], [7.04, 51.3], [7.02, 51.7]]]
550-
})
547+
expected_geometry = DriverVectorCube.from_geojson(
548+
{
549+
"type": "Polygon",
550+
"coordinates": [
551+
[[7.02, 51.7], [7.65, 51.7], [7.65, 51.2], [7.04, 51.3], [7.02, 51.7]],
552+
],
553+
}
554+
)
551555

552556
params = dummy_backend.last_load_collection_call('PROBAV_L3_S10_TOC_NDVI_333M_V2')
553-
assert params["spatial_extent"] == expected
557+
assert params["spatial_extent"] == expected_spatial_extent
554558
assert params["aggregate_spatial_geometries"] == expected_geometry
555559

556560
params = dummy_backend.last_load_collection_call('S2_FAPAR_CLOUDCOVER')
557-
assert params["spatial_extent"] == expected
561+
assert params["spatial_extent"] == expected_spatial_extent
558562

559563

560564
def test_execute_mask_optimized_loading(api):
@@ -563,24 +567,28 @@ def test_execute_mask_optimized_loading(api):
563567
)
564568
assert dummy_backend.get_collection("S2_FAPAR_CLOUDCOVER").mask.call_count == 1
565569

566-
expected = {
570+
expected_spatial_extent = {
567571
"west": 7.02,
568572
"south": 51.2,
569573
"east": 7.65,
570574
"north": 51.7,
571-
"crs": 'EPSG:4326',
575+
"crs": "EPSG:4326",
572576
}
573-
expected_geometry = shapely.geometry.shape({
574-
"type": "Polygon",
575-
"coordinates": [[[7.02, 51.7], [7.65, 51.7], [7.65, 51.2], [7.04, 51.3], [7.02, 51.7]]]
576-
})
577+
expected_geometry = DriverVectorCube.from_geojson(
578+
{
579+
"type": "Polygon",
580+
"coordinates": [
581+
[[7.02, 51.7], [7.65, 51.7], [7.65, 51.2], [7.04, 51.3], [7.02, 51.7]],
582+
],
583+
}
584+
)
577585

578586
params = dummy_backend.last_load_collection_call('S2_FAPAR_CLOUDCOVER')
579-
assert params["spatial_extent"] == expected
587+
assert params["spatial_extent"] == expected_spatial_extent
580588
assert isinstance(params.data_mask, DriverDataCube)
581589

582590
params = dummy_backend.last_load_collection_call('PROBAV_L3_S10_TOC_NDVI_333M_V2')
583-
assert params["spatial_extent"] == expected
591+
assert params["spatial_extent"] == expected_spatial_extent
584592
assert params["aggregate_spatial_geometries"] == expected_geometry
585593

586594

0 commit comments

Comments
 (0)