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
6a743aa1
Commit
6a743aa1
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test case for fot submit behaviour
parent
4026cbba
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_wrapperutils.py
+31
-0
31 additions, 0 deletions
tests/test_wrapperutils.py
with
31 additions
and
0 deletions
tests/test_wrapperutils.py
+
31
−
0
View file @
6a743aa1
...
@@ -584,6 +584,37 @@ def test_fileOrThing_chained_outprefix():
...
@@ -584,6 +584,37 @@ def test_fileOrThing_chained_outprefix():
assert
np
.
all
(
res
[
'
out_array
'
]
==
exparr
)
assert
np
.
all
(
res
[
'
out_array
'
]
==
exparr
)
def
test_fileOrThing_submit
():
@wutils.fileOrImage
(
'
input
'
,
'
output
'
)
def
func
(
input
,
output
,
submit
=
False
):
if
submit
:
return
'
submitted!
'
img
=
nib
.
load
(
input
)
img
=
nib
.
nifti1
.
Nifti1Image
(
np
.
asanyarray
(
img
.
dataobj
)
*
2
,
np
.
eye
(
4
))
nib
.
save
(
img
,
output
)
with
tempdir
.
tempdir
()
as
td
:
img
=
nib
.
nifti1
.
Nifti1Image
(
np
.
array
([[
1
,
2
],
[
3
,
4
]]),
np
.
eye
(
4
))
exp
=
np
.
asanyarray
(
img
.
dataobj
)
*
2
nib
.
save
(
img
,
'
input.nii.gz
'
)
result
=
func
(
img
,
wutils
.
LOAD
)
assert
np
.
all
(
np
.
asanyarray
(
result
[
'
output
'
].
dataobj
)
==
exp
)
assert
func
(
'
input.nii.gz
'
,
'
output.nii.gz
'
,
submit
=
True
)
==
'
submitted!
'
with
pytest
.
raises
(
ValueError
):
func
(
img
,
wutils
.
LOAD
,
submit
=
True
)
with
pytest
.
raises
(
ValueError
):
func
(
img
,
'
output.nii.gz
'
,
submit
=
True
)
with
pytest
.
raises
(
ValueError
):
func
(
'
input.nii.gz
'
,
wutils
.
LOAD
,
submit
=
True
)
def
test_cmdwrapper
():
def
test_cmdwrapper
():
@wutils.cmdwrapper
@wutils.cmdwrapper
def
func
(
a
,
b
):
def
func
(
a
,
b
):
...
...
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