|
9 | 9 | from __future__ import division, print_function, absolute_import
|
10 | 10 |
|
11 | 11 | import os
|
| 12 | +import warnings |
12 | 13 |
|
13 | 14 | import numpy as np
|
14 | 15 |
|
|
21 | 22 |
|
22 | 23 | from numpy.testing import assert_array_equal, assert_array_almost_equal
|
23 | 24 |
|
24 |
| -from ..testing import data_path, suppress_warnings |
| 25 | +from ..testing import data_path, suppress_warnings, clear_and_catch_warnings |
25 | 26 | from ..tmpdirs import InTemporaryDirectory
|
26 | 27 |
|
27 | 28 | from .test_wrapstruct import _TestWrapStructBase
|
@@ -261,7 +262,20 @@ def test_data_regression(self):
|
261 | 262 | assert_equal(data.min(), vals['min'])
|
262 | 263 | assert_array_almost_equal(data.mean(), vals['mean'])
|
263 | 264 |
|
264 |
| - def test_mlist_regreesion(self): |
| 265 | + def test_mlist_regression(self): |
265 | 266 | # Test mlist is as same as for nibabel 1.3.0
|
266 | 267 | assert_array_equal(self.img.get_mlist(),
|
267 | 268 | [[16842758, 3, 3011, 1]])
|
| 269 | + |
| 270 | + |
| 271 | +def test_from_filespec_deprecation(): |
| 272 | + # Check from_filespec raises Deprecation |
| 273 | + with clear_and_catch_warnings() as w: |
| 274 | + warnings.simplefilter('always', DeprecationWarning) |
| 275 | + # No warning for standard load |
| 276 | + img_loaded = EcatImage.load(ecat_file) |
| 277 | + assert_equal(len(w), 0) |
| 278 | + # Warning for from_filespec |
| 279 | + img_speced = EcatImage.from_filespec(ecat_file) |
| 280 | + assert_equal(len(w), 1) |
| 281 | + assert_array_equal(img_loaded.get_data(), img_speced.get_data()) |
0 commit comments