|
15 | 15 | from openeo_driver.processes import ProcessArgs, ProcessRegistry, ProcessRegistryException, ProcessSpec |
16 | 16 |
|
17 | 17 |
|
18 | | -def test_process_spec_basic_040(): |
19 | | - spec = ( |
20 | | - ProcessSpec("mean", "Mean value") |
21 | | - .param("input", "Input data", schema={"type": "array", "items": {"type": "number"}}) |
22 | | - .param("mask", "The mask", schema=ProcessSpec.RASTERCUBE, required=False) |
23 | | - .returns("Mean value of data", schema={"type": "number"}) |
24 | | - ) |
25 | | - assert spec.to_dict_040() == { |
26 | | - "id": "mean", |
27 | | - "description": "Mean value", |
28 | | - "parameters": { |
29 | | - "input": { |
30 | | - "description": "Input data", |
31 | | - "required": True, |
32 | | - "schema": {"type": "array", "items": {"type": "number"}} |
33 | | - }, |
34 | | - "mask": { |
35 | | - "description": "The mask", |
36 | | - "required": False, |
37 | | - "schema": {"type": "object", "format": "raster-cube"} |
38 | | - } |
39 | | - }, |
40 | | - "parameter_order": ["input", "mask"], |
41 | | - "returns": {"description": "Mean value of data", "schema": {"type": "number"}}, |
42 | | - } |
43 | 18 |
|
44 | 19 |
|
45 | 20 | def test_process_spec_basic_100(): |
@@ -70,19 +45,6 @@ def test_process_spec_basic_100(): |
70 | 45 | } |
71 | 46 |
|
72 | 47 |
|
73 | | -def test_process_spec_no_params_040(caplog): |
74 | | - caplog.set_level(logging.DEBUG) |
75 | | - spec = ProcessSpec("foo", "bar").returns("output", schema={"type": "number"}) |
76 | | - assert spec.to_dict_040() == { |
77 | | - "id": "foo", |
78 | | - "description": "bar", |
79 | | - "parameters": {}, |
80 | | - "parameter_order": [], |
81 | | - "returns": {"description": "output", "schema": {"type": "number"}}, |
82 | | - } |
83 | | - assert caplog.messages == ["Process with no parameters"] |
84 | | - |
85 | | - |
86 | 48 | def test_process_spec_no_params_100(caplog): |
87 | 49 | caplog.set_level(logging.DEBUG) |
88 | 50 | spec = ProcessSpec("foo", "bar").returns("output", schema={"type": "number"}) |
@@ -269,34 +231,6 @@ def max(*args): |
269 | 231 | } |
270 | 232 |
|
271 | 233 |
|
272 | | -def test_process_registry_with_spec_040(): |
273 | | - reg = ProcessRegistry() |
274 | | - |
275 | | - def add_function_with_spec(spec: ProcessSpec): |
276 | | - def decorator(f): |
277 | | - reg.add_function(f=f, spec=spec.to_dict_040()) |
278 | | - return f |
279 | | - |
280 | | - return decorator |
281 | | - |
282 | | - @add_function_with_spec( |
283 | | - ProcessSpec("foo", "bar") |
284 | | - .param("input", "Input", schema=ProcessSpec.RASTERCUBE) |
285 | | - .returns(description="Output", schema=ProcessSpec.RASTERCUBE) |
286 | | - ) |
287 | | - def foo(*args): |
288 | | - return 42 |
289 | | - |
290 | | - assert reg.get_spec('foo') == { |
291 | | - "id": "foo", |
292 | | - "description": "bar", |
293 | | - "parameters": { |
294 | | - "input": {"description": "Input", "schema": {"type": "object", "format": "raster-cube"}, |
295 | | - "required": True}, |
296 | | - }, |
297 | | - "parameter_order": ["input"], |
298 | | - "returns": {"description": "Output", "schema": {"type": "object", "format": "raster-cube"}} |
299 | | - } |
300 | 234 |
|
301 | 235 |
|
302 | 236 | def test_process_registry_with_spec_100(): |
|
0 commit comments