Merge pull request #6538 from jmchilton/tool_output_io

[18.01] Fix to_dict with io_details=True for tools with collection outputs.
This commit is contained in:
Björn Grüning
2018-07-26 22:26:41 +02:00
committed by GitHub
2 changed files with 16 additions and 1 deletions
+6 -1
View File
@@ -12,6 +12,9 @@ class ToolOutputBase(Dictifiable, object):
self.hidden = hidden
self.collection = False
def to_dict(self, view='collection', value_mapper=None, app=None):
return super(ToolOutputBase, self).to_dict(view=view, value_mapper=value_mapper)
class ToolOutput(ToolOutputBase):
"""
@@ -57,7 +60,7 @@ class ToolOutput(ToolOutputBase):
return iter((self.format, self.metadata_source, self.parent))
def to_dict(self, view='collection', value_mapper=None, app=None):
as_dict = super(ToolOutput, self).to_dict(view=view, value_mapper=value_mapper)
as_dict = super(ToolOutput, self).to_dict(view=view, value_mapper=value_mapper, app=app)
format = self.format
if format and format != "input" and app:
edam_format = app.datatypes_registry.edam_formats.get(self.format)
@@ -83,6 +86,8 @@ class ToolOutputCollection(ToolOutputBase):
<outputs>
"""
dict_collection_visible_keys = ['name', 'default_format', 'label', 'hidden', 'inherit_format', 'inherit_metadata']
def __init__(
self,
name,
+10
View File
@@ -79,6 +79,16 @@ class ToolsTestCase(api.ApiTestCase):
assert f2_info["min"] is None
assert f2_info["max"] is None
@skip_without_tool("collection_creates_list")
def test_show_output_collection(self):
tool_info = self._show_valid_tool("collection_creates_list")
outputs = tool_info["outputs"]
assert len(outputs) == 1
output = outputs[0]
assert output["label"] == "Duplicate List"
assert output["inherit_format"] is True
@skip_without_tool("test_data_source")
def test_data_source_ok_request(self):
with self.dataset_populator.test_history() as history_id: