From e3e8ca90cf308cb550c5d459751bad67778b5103 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 17 Jan 2018 18:32:09 +0000
Subject: [PATCH] Expanded mghimage unit test

---
 tests/test_mghimage.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/test_mghimage.py b/tests/test_mghimage.py
index d42078c11..bdbcd7344 100644
--- a/tests/test_mghimage.py
+++ b/tests/test_mghimage.py
@@ -31,8 +31,16 @@ def test_MGHImage():
     datadir  = op.join(op.dirname(__file__), 'testdata')
     testfile = op.join(datadir, 'example.mgz')
 
+    # Load from a file
     img      = fslmgh.MGHImage(testfile)
     nbimg    = nib.load(testfile)
 
     assert np.all(np.isclose(img[:],            nbimg.get_data()))
     assert np.all(np.isclose(img.voxToWorldMat, nbimg.affine))
+    assert img.mghImageFile == testfile
+
+    # Load from an in-memory nibabel object
+    img = fslmgh.MGHImage(nbimg)
+    assert np.all(np.isclose(img[:],            nbimg.get_data()))
+    assert np.all(np.isclose(img.voxToWorldMat, nbimg.affine))
+    assert img.mghImageFile is None
-- 
GitLab