Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
25afaeba
Commit
25afaeba
authored
Mar 29, 2020
by
Paul McCarthy
🚵
Browse files
TEST: test bad json
parent
b6cf8d8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_image.py
View file @
25afaeba
...
...
@@ -1414,11 +1414,23 @@ def test_loadMeta_nonBids():
with
open
(
op
.
join
(
'data'
,
'dataset_description.json'
),
'wt'
)
as
f
:
pass
img
=
fslimage
.
Image
(
imgfile
,
loadMeta
=
True
)
assert
list
(
img
.
metaKeys
())
==
[]
def
test_loadMeta_badJSON
():
with
tempdir
():
make_image
(
'image.nii.gz'
)
# spurious comma after b:2
with
open
(
'image.json'
,
'wt'
)
as
f
:
f
.
write
(
'{"a" : 1, "b" : 2,}'
)
# bad json should not cause failure
img
=
fslimage
.
Image
(
'image.nii.gz'
,
loadMeta
=
True
)
assert
list
(
img
.
metaKeys
())
==
[]
def
test_loadMetadata
():
with
tempdir
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment