2424from .. import minc1
2525from ..minc1 import Minc1File , Minc1Image , MincHeader
2626
27- from nose .tools import (assert_true , assert_equal , assert_false , assert_raises )
28- from numpy .testing import assert_array_equal
2927from ..tmpdirs import InTemporaryDirectory
30- from ..testing import data_path
28+ from ..testing import (assert_true , assert_equal , assert_false , assert_raises , assert_warns ,
29+ assert_array_equal , data_path , clear_and_catch_warnings )
3130
3231from . import test_spatialimages as tsi
3332from .test_fileslice import slicer_samples
@@ -106,7 +105,8 @@ def test_old_namespace():
106105 # Check warnings raised
107106 arr = np .arange (24 ).reshape ((2 , 3 , 4 ))
108107 aff = np .diag ([2 , 3 , 4 , 1 ])
109- with warnings .catch_warnings (record = True ) as warns :
108+ with clear_and_catch_warnings () as warns :
109+ warnings .simplefilter ('always' , DeprecationWarning )
110110 # Top level import.
111111 # This import does not trigger an import of the minc.py module, because
112112 # it's the proxy object.
@@ -122,7 +122,9 @@ def test_old_namespace():
122122 # depending on whether the minc.py module is already imported in this
123123 # test run.
124124 if not previous_import :
125- assert_equal (warns .pop (0 ).category , FutureWarning )
125+ assert_equal (warns .pop (0 ).category , DeprecationWarning )
126+
127+ with clear_and_catch_warnings () as warns :
126128 from .. import Minc1Image , MincImage
127129 assert_equal (warns , [])
128130 # The import from old module is the same as that from new
@@ -132,17 +134,17 @@ def test_old_namespace():
132134 assert_equal (warns , [])
133135 # Create object using old name
134136 mimg = MincImage (arr , aff )
135- assert_array_equal (mimg .get_data (), arr )
136137 # Call to create object created warning
137138 assert_equal (warns .pop (0 ).category , FutureWarning )
139+ assert_array_equal (mimg .get_data (), arr )
138140 # Another old name
139141 from ..minc1 import MincFile , Minc1File
140142 assert_false (MincFile is Minc1File )
141143 assert_equal (warns , [])
142144 mf = MincFile (netcdf_file (EG_FNAME ))
143- assert_equal (mf .get_data_shape (), (10 , 20 , 20 ))
144145 # Call to create object created warning
145146 assert_equal (warns .pop (0 ).category , FutureWarning )
147+ assert_equal (mf .get_data_shape (), (10 , 20 , 20 ))
146148
147149
148150class _TestMincFile (object ):
0 commit comments