def test_03_input(instance_path): """Check the essential input parameters.""" whale = Path(instance_path) / 'whale.txt' whale.touch() argv = [ 'echo', '-f', '-i42', '--example-string', 'hello', '--file=whale.txt', ] tool = CommandLineToolFactory(argv, directory=instance_path).generate_tool() assert tool.arguments[0].prefix == '-f' assert tool.inputs[0].default == 42 assert tool.inputs[0].type == 'int' assert tool.inputs[0].inputBinding.prefix == '-i' assert tool.inputs[0].inputBinding.separate is False assert tool.inputs[1].default == 'hello' assert tool.inputs[1].type == 'string' assert tool.inputs[1].inputBinding.prefix == '--example-string' assert tool.inputs[1].inputBinding.separate is True assert tool.inputs[2].default.path == Path('whale.txt') assert tool.inputs[2].type == 'File' assert tool.inputs[2].inputBinding.prefix == '--file=' assert tool.inputs[2].inputBinding.separate is False assert tool.to_argv() == argv
def test_09_array_inputs(instance_path): """Test specification of input parameters in arrays.""" argv = [ 'echo', '-A', 'one', 'two', 'three', '-B=four', '-B=five', '-B=six', '-C=seven,eight,nine', ] tool = CommandLineToolFactory(argv, directory=instance_path).generate_tool() # TODO add grouping for -A and -B assert tool.inputs[-1].type == 'string[]' assert tool.inputs[-1].default == ['seven', 'eight', 'nine'] assert tool.inputs[-1].inputBinding.prefix == '-C=' assert tool.inputs[-1].inputBinding.itemSeparator == ',' assert tool.inputs[-1].inputBinding.separate is False assert tool.to_argv() == argv
def test_short_base_command_detection(): """Test base command detection without arguments.""" tool = CommandLineToolFactory(('echo', 'A')).generate_tool() assert tool.cwlVersion == 'v1.0' assert tool.__class__.__name__ == 'CommandLineTool' assert tool.inputs[0].default == 'A' assert tool.to_argv() == ['echo', 'A']
def test_base_command_detection(instance_path): """Test base command detection.""" hello = Path(instance_path) / 'hello.tar' hello.touch() argv = ['tar', 'xf', 'hello.tar'] tool = CommandLineToolFactory(argv, directory=instance_path).generate_tool() assert tool.baseCommand == ['tar', 'xf'] assert tool.inputs[0].default.path == Path('hello.tar') assert tool.inputs[0].type == 'File' assert tool.inputs[0].inputBinding.prefix is None assert tool.inputs[0].inputBinding.separate is True assert tool.to_argv() == argv