Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
9a9b51ea
Commit
9a9b51ea
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test remove_ext, tweak imrm test
parent
89be1aba
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_scripts/test_imrm.py
+3
-2
3 additions, 2 deletions
tests/test_scripts/test_imrm.py
tests/test_scripts/test_remove_ext.py
+38
-0
38 additions, 0 deletions
tests/test_scripts/test_remove_ext.py
with
41 additions
and
2 deletions
tests/test_scripts/test_imrm.py
+
3
−
2
View file @
9a9b51ea
...
...
@@ -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
())
This diff is collapsed.
Click to expand it.
tests/test_scripts/test_remove_ext.py
0 → 100644
+
38
−
0
View file @
9a9b51ea
#!/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
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment