def test_06_params(instance_path): """Test referencing input parameters in other fields.""" hello = Path(instance_path) / 'hello.tar' hello.touch() argv = ['tar', 'xf', 'hello.tar', 'goodbye.txt'] factory = CommandLineToolFactory( argv, directory=instance_path, ) assert factory.inputs[1].default == 'goodbye.txt' assert factory.inputs[1].type == 'string' assert factory.inputs[1].inputBinding.position == 2 goodbye_id = factory.inputs[1].id # simulate run output = Path(instance_path) / 'goodbye.txt' output.touch() parameters = list(factory.guess_outputs([output])) assert parameters[0][0].type == 'File' assert parameters[0][0].outputBinding.glob == \ '$(inputs.{0})'.format(goodbye_id) tool = factory.generate_tool() assert tool.to_argv() == argv
def test_04_output(instance_path): """Test describtion of outputs from a command.""" hello = Path(instance_path) / 'hello.tar' hello.touch() argv = ['tar', 'xf', 'hello.tar'] factory = CommandLineToolFactory(argv, directory=instance_path) # simulate run output = Path(instance_path) / 'hello.txt' output.touch() parameters = list(factory.guess_outputs([output])) assert parameters[0][0].type == 'File' assert parameters[0][0].outputBinding.glob == 'hello.txt' tool = factory.generate_tool() assert tool.to_argv() == argv