File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1487,7 +1487,11 @@ def _filename_from_source(self, name):
1487
1487
source = getattr (self .inputs , name_source )
1488
1488
while isinstance (source , list ):
1489
1489
source = source [0 ]
1490
- _ , base , _ = split_filename (source )
1490
+ #special treatment for files
1491
+ if isinstance (source , str ) and os .path .exists (source ):
1492
+ _ , base , _ = split_filename (source )
1493
+ else :
1494
+ base = source
1491
1495
retval = name_template % base
1492
1496
_ , _ , ext = split_filename (retval )
1493
1497
if trait_spec .keep_extension and ext :
Original file line number Diff line number Diff line change 11
11
from nipype .utils .filemanip import split_filename
12
12
from nipype .interfaces .base import Undefined , config
13
13
from traits .testing .nose_tools import skip
14
-
14
+ import traits . api as traits
15
15
#test Bunch
16
16
def test_bunch ():
17
17
b = nib .Bunch ()
@@ -181,11 +181,15 @@ class spec2(nib.CommandLineInputSpec):
181
181
moo = nib .File (name_source = ['doo' ], hash_files = False , argstr = "%s" ,
182
182
position = 2 )
183
183
doo = nib .File (exists = True , argstr = "%s" , position = 1 )
184
+ goo = traits .Int (argstr = "%d" , position = 4 )
185
+ poo = nib .File (name_source = ['goo' ], hash_files = False , argstr = "%s" ,position = 3 )
186
+
184
187
class TestName (nib .CommandLine ):
185
188
_cmd = "mycommand"
186
189
input_spec = spec2
187
190
testobj = TestName ()
188
191
testobj .inputs .doo = tmp_infile
192
+ testobj .inputs .goo = 99
189
193
yield assert_true , '%s_generated' % nme in testobj .cmdline
190
194
testobj .inputs .moo = "my_%s_template"
191
195
yield assert_true , 'my_%s_template' % nme in testobj .cmdline
You can’t perform that action at this time.
0 commit comments