def test_is_cwl_file_type_not_files(): test_types = [ "int", "string", "float", ["null", "string"], { "type": "enum", "symbols": [1, 2] }, { "type": "enum", "symbols": ["A", "B"] }, { "type": "array", "items": "string" }, { "type": "array", "items": "int" }, ["null", { "type": "array", "items": "string" }], ] for i, io_type in enumerate(test_types): io_info = {"name": "test-{}".format(i), "type": io_type} assert not is_cwl_file_type(io_info), "Test [{}]: {}".format( i, io_info)
def __init__( self, builder, # type: Builder joborder, # type: Dict[Text, Union[Dict[Text, Any], List, Text, None]] requirements, # type: List[Dict[Text, Text]] hints, # type: List[Dict[Text, Text]] name, # type: Text wps_process, # type: WpsProcessInterface expected_outputs, # type: List[CWL_Output_Type] ): # type: (...) -> None super(WpsWorkflowJob, self).__init__(builder, joborder, None, requirements, hints, name) self.wps_process = wps_process self.expected_outputs = { } # type: CWL_ExpectedOutputs # {id: file-pattern} for output in expected_outputs: # TODO Should we support something else? if is_cwl_file_type(output): # Expecting output to look like this # output = {"id": "file:///tmp/random_path/process_name#output_id, # "type": "File", # "outputBinding": {"glob": output_name } # } output_id = shortname(output["id"]) self.expected_outputs[output_id] = output["outputBinding"][ "glob"]
def test_is_cwl_file_type_none_one_or_many_files(): io_info = { "name": "test", "type": ["null", "File", { "type": "array", "items": "File" }] } assert is_cwl_file_type(io_info)
def test_is_cwl_file_type_file_array(): io_info = { "name": "test", "type": {"type": "array", "items": "File"} } assert is_cwl_file_type(io_info)
def test_is_cwl_file_type_potential_file(): io_info = { "name": "test", "type": ["null", "File"] } assert is_cwl_file_type(io_info)
def test_is_cwl_file_type_guaranteed_file(): io_info = { "name": "test", "type": "File" } assert is_cwl_file_type(io_info)