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
d7b766ba
Commit
d7b766ba
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test invalid identifiers
parent
9efdc615
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
+38
-0
38 additions, 0 deletions
tests/test_wrapperutils.py
with
38 additions
and
0 deletions
tests/test_wrapperutils.py
+
38
−
0
View file @
d7b766ba
...
@@ -586,6 +586,44 @@ def test_fileOrThing_results():
...
@@ -586,6 +586,44 @@ def test_fileOrThing_results():
for
i
in
range
(
3
):
for
i
in
range
(
3
):
assert
(
np
.
loadtxt
(
'
outpref_{}.txt
'
.
format
(
i
))
==
exp
[
i
+
1
]).
all
()
assert
(
np
.
loadtxt
(
'
outpref_{}.txt
'
.
format
(
i
))
==
exp
[
i
+
1
]).
all
()
result
=
func
(
input
,
wutils
.
LOAD
,
wutils
.
LOAD
)
assert
len
(
result
)
==
4
def
test_FileOrThing_invalid_identifiers
():
# unlikely to ever happen, but let's test arguments with
# names that are not valid python identifiers
@wutils.fileOrArray
(
'
in val
'
,
'
2out
'
)
def
func
(
**
kwargs
):
infile
=
kwargs
[
'
in val
'
]
outfile
=
kwargs
[
'
2out
'
]
input
=
np
.
loadtxt
(
infile
)
np
.
savetxt
(
outfile
,
input
*
2
)
return
(
'
return
'
,
'
value
'
)
input
=
np
.
random
.
randint
(
1
,
10
,
(
3
,
3
))
infile
=
'
input.txt
'
exp
=
input
*
2
with
tempdir
.
tempdir
():
np
.
savetxt
(
infile
,
input
)
res
=
func
(
**
{
'
in val
'
:
infile
,
'
2out
'
:
'
output.txt
'
})
assert
res
.
stdout
==
(
'
return
'
,
'
value
'
)
assert
(
np
.
loadtxt
(
'
output.txt
'
)
==
exp
).
all
()
res
=
func
(
**
{
'
in val
'
:
input
,
'
2out
'
:
'
output.txt
'
})
assert
res
.
stdout
==
(
'
return
'
,
'
value
'
)
assert
(
np
.
loadtxt
(
'
output.txt
'
)
==
exp
).
all
()
res
=
func
(
**
{
'
in val
'
:
input
,
'
2out
'
:
wutils
.
LOAD
})
assert
res
.
stdout
==
(
'
return
'
,
'
value
'
)
assert
(
res
[
'
2out
'
]
==
exp
).
all
()
def
test_chained_fileOrImageAndArray
():
def
test_chained_fileOrImageAndArray
():
...
...
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