Skip to content

Commit ae0b008

Browse files
committed
TST: Exercise surface recon type conversion
1 parent 0e31778 commit ae0b008

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

nibabies/cli/tests/test_parser.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,34 @@ def test_derivatives(tmp_path):
270270
parser.parse_args(temp_args)
271271

272272
_reset_config()
273+
274+
275+
@pytest.mark.parametrize(
276+
('args', 'expectation'),
277+
[
278+
([], 'auto'),
279+
(['--surface-recon-method', 'auto'], 'auto'),
280+
(['--surface-recon-method', 'mcribs'], 'mcribs'),
281+
(['--surface-recon-method', 'infantfs'], 'infantfs'),
282+
(['--surface-recon-method', 'freesurfer'], 'freesurfer'),
283+
(['--surface-recon-method', 'none'], None),
284+
(['--surface-recon-method', 'None'], None),
285+
(['--surface-recon-method', 123], (TypeError,)),
286+
],
287+
)
288+
def test_surface_recon_method(tmp_path, args, expectation):
289+
"""Check the correct parsing of the memory argument."""
290+
datapath = tmp_path / 'data'
291+
datapath.mkdir(exist_ok=True)
292+
_fs_file = tmp_path / 'license.txt'
293+
_fs_file.write_text('')
294+
295+
args = [str(datapath)] + MIN_ARGS[1:] + ['--fs-license-file', str(_fs_file)] + args
296+
297+
cm = nullcontext()
298+
if isinstance(expectation, tuple):
299+
cm = pytest.raises(expectation)
300+
301+
with cm:
302+
opts = _build_parser().parse_args(args)
303+
assert opts.surface_recon_method == expectation

0 commit comments

Comments
 (0)