Skip to content

Commit

Permalink
TST - Scripts inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabknight committed Dec 19, 2024
1 parent 7079040 commit bd62183
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
26 changes: 25 additions & 1 deletion scripts/tests/test_volume_stats_in_ROI.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,33 @@ def test_help_option(script_runner):
def test_execution_tractometry(script_runner, monkeypatch):
monkeypatch.chdir(os.path.expanduser(tmp_dir.name))
in_roi = os.path.join(SCILPY_HOME, 'tractometry',
'IFGWM.nii.gz')
'IFGWM.nii.gz')
in_ref = os.path.join(SCILPY_HOME, 'tractometry',
'mni_masked.nii.gz')

# Test with a single ROI input
ret = script_runner.run('scil_volume_stats_in_ROI.py',
in_roi, '--metrics', in_ref)
assert ret.success

# Test with multiple ROIs input
ret = script_runner.run('scil_volume_stats_in_ROI.py',
in_roi, in_roi, in_roi, '--metrics', in_ref)
assert ret.success

# Test with multiple metric input
ret = script_runner.run('scil_volume_stats_in_ROI.py',
in_roi, '--metrics', in_ref, in_ref, in_ref)
assert ret.success

# Test with multiple metric and ROIs input
ret = script_runner.run('scil_volume_stats_in_ROI.py',
in_roi, in_roi, '--metrics', in_ref, in_ref)
assert ret.success

# Test with a metric folder
metrics_dir = os.path.join(SCILPY_HOME, 'plot')
in_roi = os.path.join(SCILPY_HOME, 'plot', 'mask_wm.nii.gz')
ret = script_runner.run('scil_volume_stats_in_ROI.py',
in_roi, '--metrics_dir', metrics_dir)
assert ret.success
19 changes: 17 additions & 2 deletions scripts/tests/test_volume_stats_in_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,24 @@ def test_help_option(script_runner):

def test_execution(script_runner, monkeypatch):
monkeypatch.chdir(os.path.expanduser(tmp_dir.name))
in_map = os.path.join(SCILPY_HOME, 'plot', 'fa.nii.gz')
in_metric = os.path.join(SCILPY_HOME, 'plot', 'fa.nii.gz')
in_atlas = os.path.join(SCILPY_HOME, 'plot', 'atlas_brainnetome.nii.gz')
atlas_lut = os.path.join(SCILPY_HOME, 'plot', 'atlas_brainnetome.json')

# Test with a single metric
ret = script_runner.run('scil_volume_stats_in_labels.py',
in_atlas, atlas_lut, "--metrics", in_metric)
assert ret.success

# Test with multiple metrics
ret = script_runner.run('scil_volume_stats_in_labels.py',
in_atlas, atlas_lut, "--metrics",
in_metric, in_metric, in_metric)
assert ret.success

# Test with a metric folder
metrics_dir = os.path.join(SCILPY_HOME, 'plot')
ret = script_runner.run('scil_volume_stats_in_labels.py',
in_atlas, atlas_lut, "--metrics", in_map)
in_atlas, atlas_lut, "--metrics_dir",
metrics_dir)
assert ret.success

0 comments on commit bd62183

Please sign in to comment.