Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bug_fixes' into bug_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cnavacch committed Oct 29, 2020
2 parents cb1cf69 + f8d1fc9 commit 9f9db5c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/openeo_pg_parser/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def translate_process_graph(pg_filepath, process_defs=None, parameters=None):

# remove first layer of the process graph
parameters = {} if parameters is None else parameters
if "parameters" in process_graph.keys():
if process_graph.get("parameters"):
for parameter_def in process_graph['parameters']:
parameter = OpenEOParameter(parameter_def)
parameters.update({parameter.name: parameter.default_value})
Expand Down
23 changes: 23 additions & 0 deletions tests/process_graphs/none.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "none-pg",
"summary": null,
"description": null,
"returns": null,
"parameters": null,
"process_graph": {
"sub": {
"process_id": "subtract",
"arguments": {
"data": [
{
"from_argument": "nir"
},
{
"from_argument": "red"
}
]
},
"result": true
}
}
}
7 changes: 7 additions & 0 deletions tests/test_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def test_translate_process_graph(self):
print(graph)
assert True

def test_translate_process_graph_none_params(self):
"""Translate a minimal process graph with all allowed values set to None."""
pg_file = os.path.join(self.pg_dirpath, "none.json")
graph = translate_process_graph(pg_file)
print(graph)
assert True

def test_process_graph_not_found(self):
""" Checks if an error is thrown when a process graph file cannot be found. """
pg_filepath = os.path.join(self.pg_dirpath, "does_not_exist.json")
Expand Down

0 comments on commit 9f9db5c

Please sign in to comment.