Skip to content
Snippets Groups Projects
Commit 15243a3f authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: test new imrm script

parent f879120a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
#
# test_imrm.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import os
from fsl.utils.tempdir import tempdir
import fsl.scripts.imrm as imrm
from tests import touch
def test_imrm_usage():
assert imrm.main(['imrm']) != 0
def test_imrm():
# (files present, command, expected)
tests = [
('a.nii', 'a', ''),
('a.nii.gz', 'a', ''),
('a.img a.hdr', 'a', ''),
('a.img', 'a', ''),
('a.hdr', 'a', ''),
('a.nii b.nii', 'a', 'b.nii'),
('a.nii b.nii', 'a b', ''),
('a.nii b.nii', 'a b.nii', ''),
# suffix doesn't have to be correct
('a.nii.gz', 'a.nii', ''),
# files don't exist -> no problem
('a.nii', 'b', 'a.nii'),
]
for files, command, expected in tests:
with tempdir():
for f in files.split():
touch(f)
print('files', files)
print('command', command)
print('expected', expected)
imrm.main(('imrm ' + command).split())
assert sorted(os.listdir()) == sorted(expected.split())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment