Skip to content

Support VectorCube in ApiTester.result #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JohanKJSchreurs opened this issue Apr 17, 2023 · 1 comment
Closed

Support VectorCube in ApiTester.result #179

JohanKJSchreurs opened this issue Apr 17, 2023 · 1 comment
Assignees

Comments

@JohanKJSchreurs
Copy link
Contributor

The unit tests of openeo-geopyspark-driver are failing, see example log below.

This was traced to the ApiTest.result method in openeo-python-driver. This method is now receiving a new type for process_graph, which was not yet supported, namely: VectorCube.

In the unit tests of the GeoPySpark driver cube.aggregate_spatial is returning a VectorCube.

A small change should allow us to convert the VectorCube to a process graph, the same was as a DataCube is converted to a process graph.

Failing tests

========================================================================================================= short test summary info ==========================================================================================================
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry0-expected_lon_lat_agg0] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry1-expected_lon_lat_agg1] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry2-expected_lon_lat_agg2] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry3-expected_lon_lat_agg3] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry4-expected_lon_lat_agg4] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[default-geometry5-expected_lon_lat_agg5] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry0-expected_lon_lat_agg0] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry1-expected_lon_lat_agg1] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry2-expected_lon_lat_agg2] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry3-expected_lon_lat_agg3] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry4-expected_lon_lat_agg4] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry[None-geometry5-expected_lon_lat_agg5] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry_multiple_aggregations[geometry0-expected0] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry_multiple_aggregations[geometry1-expected1] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry_multiple_aggregations[geometry2-expected2] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_single_geometry_multiple_aggregations[geometry3-expected3] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_heterogeneous_geometry_collection - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_with_single_geometry[default-geometry0-expected_lon_lat_agg0] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_with_single_geometry[default-geometry1-expected_lon_lat_agg1] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_with_single_geometry[None-geometry0-expected_lon_lat_agg0] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_with_single_geometry[None-geometry1-expected_lon_lat_agg1] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_of_points[default] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_of_points[None] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_of_polygons - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_heterogeneous[default] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_heterogeneous[None] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_feature_collection_heterogeneous_multiple_aggregations - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_geometry_from_file[default] - TypeError: argument of type 'VectorCube' is not iterable
FAILED tests/test_api_result.py::TestAggregateSpatial::test_aggregate_geometry_from_file[None] - TypeError: argument of type 'VectorCube' is not iterable
===================================================================================================== 29 failed, 16 warnings in 5.11s ======================================================================================================

Traceback

_______________________________________________________________________________________ TestAggregateSpatial.test_aggregate_geometry_from_file[None] _______________________________________________________________________________________

self = <tests.test_api_result.TestAggregateSpatial object at 0x7f07310c7eb0>, api100 = <openeo_driver.testing.ApiTester object at 0x7f0730d66f70>, load_collection_spatial_extent = None

    @pytest.mark.parametrize("load_collection_spatial_extent", ["default", None])
    def test_aggregate_geometry_from_file(self, api100, load_collection_spatial_extent):
        cube = self._load_cube(spatial_extent=load_collection_spatial_extent)
        cube = cube.aggregate_spatial(
            get_test_data_file("geometries/FeatureCollection.geojson"), "mean"
        )
>       result = api100.check_result(cube).json

tests/test_api_result.py:1900:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../openeo-python-driver/openeo_driver/testing.py:294: in check_result
    response = self.result(process_graph=process_graph, path=path, preprocess=preprocess)
../openeo-python-driver/openeo_driver/testing.py:279: in result
    data = self.get_process_graph_dict(process_graph)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <openeo_driver.testing.ApiTester object at 0x7f0730d66f70>, process_graph = <openeo.rest.vectorcube.VectorCube object at 0x7f07309f63d0>, title = None, description = None

    def get_process_graph_dict(self, process_graph: dict, title: str = None, description: str = None) -> dict:
        """
        Build dict containing process graph (e.g. to POST, or to expect in metadata),
        according to API version
        """
>       if "process_graph" in process_graph:
E       TypeError: argument of type 'VectorCube' is not iterable

../openeo-python-driver/openeo_driver/testing.py:250: TypeError

@soxofaan
Copy link
Member

fixed by a1f97ac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants