From 9a2f4904ca12ac162947ee98dec855299aeb0ed0 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 16 Apr 2021 18:06:58 +0100
Subject: [PATCH] TEST: Check Image name/dataSource attributes

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

diff --git a/tests/test_image.py b/tests/test_image.py
index e2e7f213..8085cb92 100644
--- a/tests/test_image.py
+++ b/tests/test_image.py
@@ -208,6 +208,23 @@ def test_create():
             assert np.all(np.isclose(img.pixdim, (2, 3, 4)))
 
 
+def test_name_dataSource():
+    with tempdir():
+
+        expName       = 'image'
+        expDataSource = op.abspath('image.nii.gz')
+        make_image('image.nii.gz')
+
+        tests = ['image', 'image.nii.gz', op.abspath('image'),
+                 op.abspath('image.nii.gz')]
+        tests = tests + [Path(t) for t in tests]
+
+        for t in tests:
+            i = fslimage.Image(t)
+            assert i.name       == expName
+            assert i.dataSource == expDataSource
+
+
 def test_bad_create():
 
     class BadThing(object):
-- 
GitLab