Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
fslpy
Commits
13b827b0
Commit
13b827b0
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: unit test for fsl_sub
parent
e0ed39cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_wrappers/test_wrappers.py
+18
-3
18 additions, 3 deletions
tests/test_wrappers/test_wrappers.py
with
18 additions
and
3 deletions
tests/test_wrappers/test_wrappers.py
+
18
−
3
View file @
13b827b0
...
@@ -5,10 +5,11 @@
...
@@ -5,10 +5,11 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
#
import
os
import
os.path
as
op
import
os.path
as
op
import
itertools
as
it
import
itertools
as
it
import
textwrap
as
tw
import
textwrap
as
tw
import
os
import
shlex
import
numpy
as
np
import
numpy
as
np
...
@@ -21,8 +22,10 @@ from .. import mockFSLDIR, make_random_image
...
@@ -21,8 +22,10 @@ from .. import mockFSLDIR, make_random_image
def
checkResult
(
cmd
,
base
,
args
,
stripdir
=
None
):
def
checkResult
(
cmd
,
base
,
args
,
stripdir
=
None
):
"""
We can
'
t control the order in which command line args are generated,
"""
Check that the generate dcommand matches the expected command.
so we need to test all possible orderings.
Pre python 3.7, we couldn
'
t control the order in which command
line args were generated, so we needed to test all possible orderings.
:arg cmd: Generated command
:arg cmd: Generated command
:arg base: Beginning of expected command
:arg base: Beginning of expected command
...
@@ -409,3 +412,15 @@ def test_fsl_prepare_fieldmap():
...
@@ -409,3 +412,15 @@ def test_fsl_prepare_fieldmap():
nocheck
=
True
)
nocheck
=
True
)
expected
=
(
fpf
,
(
'
SIEMENS
'
,
'
ph
'
,
'
mag
'
,
'
out
'
,
'
2.46
'
,
'
--nocheck
'
))
expected
=
(
fpf
,
(
'
SIEMENS
'
,
'
ph
'
,
'
mag
'
,
'
out
'
,
'
2.46
'
,
'
--nocheck
'
))
assert
checkResult
(
result
.
stdout
[
0
],
*
expected
)
assert
checkResult
(
result
.
stdout
[
0
],
*
expected
)
def
test_fsl_sub
():
with
run
.
dryrun
(),
mockFSLDIR
(
bin
=
(
'
fsl_sub
'
,))
as
fsldir
:
expected
=
[
op
.
join
(
fsldir
,
'
bin
'
,
'
fsl_sub
'
),
'
--jobhold
'
,
'
123
'
,
'
--queue
'
,
'
long.q
'
,
'
some_command
'
,
'
--some_arg
'
]
result
=
fw
.
fsl_sub
(
'
some_command
'
,
'
--some_arg
'
,
jobhold
=
'
123
'
,
queue
=
'
long.q
'
)
assert
shlex
.
split
(
result
[
0
])
==
expected
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