Skip to content

Commit 9a2206b

Browse files
committed
fix: namesource behavior and test error
1 parent 63c108f commit 9a2206b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

nipype/interfaces/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ def _filename_from_source(self, name, chain=None):
18441844
# special treatment for files
18451845
try:
18461846
_, base, source_ext = split_filename(source)
1847-
except AttributeError:
1847+
except (AttributeError, TypeError):
18481848
base = source
18491849
else:
18501850
if name in chain:

nipype/interfaces/tests/test_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ class spec2(nib.CommandLineInputSpec):
209209
position=2)
210210
doo = nib.File(exists=True, argstr="%s", position=1)
211211
goo = traits.Int(argstr="%d", position=4)
212-
poo = nib.File(name_source=['goo'], hash_files=False, argstr="%s", position=3)
212+
poo = nib.File(name_source=['goo'], hash_files=False, argstr="%s",
213+
position=3)
213214

214215
class TestName(nib.CommandLine):
215216
_cmd = "mycommand"
@@ -218,6 +219,7 @@ class TestName(nib.CommandLine):
218219
testobj.inputs.doo = tmp_infile
219220
testobj.inputs.goo = 99
220221
assert '%s_generated' % nme in testobj.cmdline
222+
assert '%d_generated' % testobj.inputs.goo in testobj.cmdline
221223
testobj.inputs.moo = "my_%s_template"
222224
assert 'my_%s_template' % nme in testobj.cmdline
223225

0 commit comments

Comments
 (0)