Skip to content
Snippets Groups Projects
Commit 4be0af41 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: test bad json

parent e7341f65
No related branches found
No related tags found
No related merge requests found
...@@ -1414,11 +1414,23 @@ def test_loadMeta_nonBids(): ...@@ -1414,11 +1414,23 @@ def test_loadMeta_nonBids():
with open(op.join('data', 'dataset_description.json'), 'wt') as f: with open(op.join('data', 'dataset_description.json'), 'wt') as f:
pass pass
img = fslimage.Image(imgfile, loadMeta=True) img = fslimage.Image(imgfile, loadMeta=True)
assert list(img.metaKeys()) == [] 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(): def test_loadMetadata():
with tempdir(): with tempdir():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment