File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 2
2
import sys
3
3
from pathlib import Path
4
4
import attr
5
+ from unittest .mock import Mock
5
6
import pytest
6
7
from fileformats .generic import File
7
8
from ..specs import SpecInfo , ShellSpec
10
11
ensure_list ,
11
12
MountIndentifier ,
12
13
copy_nested_files ,
14
+ template_update_single ,
13
15
)
14
16
15
17
@@ -398,3 +400,20 @@ class MyCommand(ShellCommandTask):
398
400
assert task .cmdline == f"my { filename } "
399
401
task .inputs .optional = "custom-file-out.txt"
400
402
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" ]
You can’t perform that action at this time.
0 commit comments