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
f03d3780
Commit
f03d3780
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test abspath
parent
4ab83ccb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_scripts/test_fsl_abspath.py
+45
-0
45 additions, 0 deletions
tests/test_scripts/test_fsl_abspath.py
with
45 additions
and
0 deletions
tests/test_scripts/test_fsl_abspath.py
0 → 100644
+
45
−
0
View file @
f03d3780
#!/usr/bin/env python
#
# test_fsl_abspath.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
os.path
as
op
import
fsl.scripts.fsl_abspath
as
fsl_abspath
from
tests
import
tempdir
,
CaptureStdout
def
test_usage
():
assert
fsl_abspath
.
main
([])
!=
0
def
test_fsl_abspath
():
# fsl_abspath just calls os.path.realpath
with
tempdir
()
as
td
:
oneup
=
op
.
dirname
(
td
)
# (input, expected)
tests
=
[
(
'
file
'
,
f
'
{
td
}
/file
'
),
(
'
./file
'
,
f
'
{
td
}
/file
'
),
(
'
../file
'
,
f
'
{
oneup
}
/file
'
),
(
'
/file
'
,
'
/file
'
),
(
'
/one/two/file
'
,
'
/one/two/file
'
),
]
for
input
,
expected
in
tests
:
cap
=
CaptureStdout
()
with
cap
:
ret
=
fsl_abspath
.
main
([
input
])
assert
ret
==
0
assert
cap
.
stdout
.
strip
()
==
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