Skip to content

Commit 6b37de4

Browse files
committed
add tests
1 parent 9fe7ccd commit 6b37de4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

nipype/interfaces/dipy/tests/test_base.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from distutils.version import LooseVersion
23
from collections import namedtuple
34
from ...base import traits, File, TraitedSpec, BaseInterfaceInputSpec
45
from ..base import (
@@ -8,7 +9,10 @@
89
DipyBaseInterface,
910
no_dipy,
1011
get_dipy_workflows,
12+
get_default_args,
13+
dipy_version
1114
)
15+
DIPY_1_14_LESS = LooseVersion(dipy_version()) < LooseVersion("1.14")
1216

1317

1418
def test_convert_to_traits_type():
@@ -112,6 +116,32 @@ def test_create_interface_specs():
112116
assert "out_params" in current_params.keys()
113117

114118

119+
@pytest.mark.skipif(no_dipy() and DIPY_1_14_LESS,
120+
reason="DIPY is not installed")
121+
def test_get_default_args():
122+
from dipy.utils.deprecator import deprecated_params
123+
124+
def test(dummy=11, x=3):
125+
return dummy, x
126+
127+
@deprecated_params('x', None, '0.3', '0.5', alternative='test2.y')
128+
def test2(dummy=11, x=3):
129+
return dummy, x
130+
131+
@deprecated_params(['dummy', 'x'], None, '0.3', alternative='test2.y')
132+
def test3(dummy=11, x=3):
133+
return dummy, x
134+
135+
@deprecated_params(['dummy', 'x'], None, '0.3', '0.5',
136+
alternative='test2.y')
137+
def test4(dummy=11, x=3):
138+
return dummy, x
139+
140+
expected_res = {'dummy': 11, 'x': 3}
141+
for func in [test, test2, test3, test4]:
142+
assert get_default_args(func) == expected_res
143+
144+
115145
@pytest.mark.skipif(no_dipy(), reason="DIPY is not installed")
116146
def test_dipy_to_nipype_interface():
117147
from dipy.workflows.workflow import Workflow
@@ -178,3 +208,4 @@ def test_get_dipy_workflows():
178208
test_convert_to_traits_type()
179209
test_create_interface_specs()
180210
test_dipy_to_nipype_interface()
211+
test_get_default_args()

0 commit comments

Comments
 (0)