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

TEST: Test remove_ext, tweak imrm test

parent 89be1aba
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ import fsl.scripts.imrm as imrm
from tests import touch
def test_imrm_usage():
assert imrm.main(['imrm']) != 0
assert imrm.main([]) != 0
def test_imrm():
......@@ -45,6 +45,7 @@ def test_imrm():
print('command', command)
print('expected', expected)
imrm.main(('imrm ' + command).split())
ret = imrm.main(('imrm ' + command).split())
assert ret == 0
assert sorted(os.listdir()) == sorted(expected.split())
#!/usr/bin/env python
#
# test_remove_ext.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import fsl.scripts.remove_ext as remove_ext
from tests import CaptureStdout
def test_usage():
assert remove_ext.main([]) != 0
def test_remove_ext():
# (input, expected output)
tests = [
('a', 'a'),
('a.nii', 'a'),
('a.nii.gz', 'a'),
('a.txt', 'a.txt'),
('a.nii b.img c.hdr', 'a b c'),
('a.nii b.img b.hdr', 'a b b'),
('a b.img c.txt', 'a b c.txt'),
('a.nii.gz b c.mnc', 'a b c'),
]
for input, expected in tests:
cap = CaptureStdout()
with cap:
ret = remove_ext.main(input.split())
assert ret == 0
got = cap.stdout.split()
assert sorted(got) == 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