From a302be8fbcf5a61fa9ed4309473d25f60b91e894 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Tue, 4 Feb 2020 15:23:52 +0000
Subject: [PATCH] TEST: regression

---
 tests/test_image.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/test_image.py b/tests/test_image.py
index e12c6acb7..06801c11f 100644
--- a/tests/test_image.py
+++ b/tests/test_image.py
@@ -1401,6 +1401,25 @@ def test_loadMeta():
         assert img.getMeta('b') == 2
 
 
+def test_loadMeta_nonBids():
+    with tempdir():
+
+        # non-bids file in a BIDS-like directory
+        imgfile  = op.join('data', 'sub-01', 'anat', 'sub-01_T1w_nonbids.nii.gz')
+
+        os.makedirs(op.dirname(imgfile))
+
+        make_image(imgfile)
+
+        with open(op.join('data', 'dataset_description.json'), 'wt') as f:
+            pass
+
+
+        img = fslimage.Image(imgfile, loadMeta=True)
+        assert list(img.metaKeys()) == []
+
+
+
 def test_loadMetadata():
     with tempdir():
         make_image('image.nii.gz')
-- 
GitLab