Skip to content

Commit 7e81e3d

Browse files
committed
added test to hit multiple files in output_file_template
1 parent b35bc73 commit 7e81e3d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pydra/engine/tests/test_helpers_file.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from pathlib import Path
44
import attr
5+
from unittest.mock import Mock
56
import pytest
67
from fileformats.generic import File
78
from ..specs import SpecInfo, ShellSpec
@@ -10,6 +11,7 @@
1011
ensure_list,
1112
MountIndentifier,
1213
copy_nested_files,
14+
template_update_single,
1315
)
1416

1517

@@ -398,3 +400,20 @@ class MyCommand(ShellCommandTask):
398400
assert task.cmdline == f"my {filename}"
399401
task.inputs.optional = "custom-file-out.txt"
400402
assert task.cmdline == f"my {filename} --opt custom-file-out.txt"
403+
404+
405+
def test_template_formatting(tmp_path):
406+
field = Mock()
407+
field.name = "grad"
408+
field.argstr = "--grad"
409+
field.metadata = {"output_file_template": ("{in_file}.bvec", "{in_file}.bval")}
410+
inputs = Mock()
411+
inputs_dict = {"in_file": "/a/b/c/file.txt", "grad": True}
412+
413+
assert template_update_single(
414+
field,
415+
inputs,
416+
inputs_dict_st=inputs_dict,
417+
output_dir=tmp_path,
418+
spec_type="input",
419+
) == [f"{tmp_path}/file.bvec", f"{tmp_path}/file.bval"]

0 commit comments

Comments
 (0)