|
48 | 48 |
|
49 | 49 | from numpy.testing import assert_almost_equal, assert_array_equal, assert_warns, assert_allclose |
50 | 50 | from nibabel.testing import (bytesio_round_trip, bytesio_filemap, assert_data_similar, |
51 | | - clear_and_catch_warnings, nullcontext) |
| 51 | + clear_and_catch_warnings, nullcontext, expires) |
52 | 52 | from ..tmpdirs import InTemporaryDirectory |
53 | 53 |
|
54 | 54 | from .test_api_validators import ValidateAPI |
@@ -170,8 +170,8 @@ def validate_no_slicing(self, imaker, params): |
170 | 170 | with pytest.raises(TypeError): |
171 | 171 | img[:] |
172 | 172 |
|
| 173 | + @expires("5.0.0") |
173 | 174 | def validate_get_data_deprecated(self, imaker, params): |
174 | | - # Check deprecated header API |
175 | 175 | img = imaker() |
176 | 176 | with pytest.deprecated_call(): |
177 | 177 | data = img.get_data() |
@@ -209,7 +209,7 @@ class DataInterfaceMixin(GetSetDtypeMixin): |
209 | 209 | Use this mixin if your image has a ``dataobj`` property that contains an |
210 | 210 | array or an array-like thing. |
211 | 211 | """ |
212 | | - meth_names = ('get_fdata', 'get_data') |
| 212 | + meth_names = ('get_fdata',) |
213 | 213 |
|
214 | 214 | def validate_data_interface(self, imaker, params): |
215 | 215 | # Check get data returns array, and caches |
@@ -304,27 +304,6 @@ def _check_proxy_interface(self, imaker, meth_name): |
304 | 304 | with maybe_deprecated(meth_name): |
305 | 305 | data_again = method() |
306 | 306 | assert data is data_again |
307 | | - # Check the interaction of caching with get_data, get_fdata. |
308 | | - # Caching for `get_data` should have no effect on caching for |
309 | | - # get_fdata, and vice versa. |
310 | | - # Modify the cached data |
311 | | - data[:] = 43 |
312 | | - # Load using the other data fetch method |
313 | | - other_name = set(self.meth_names).difference({meth_name}).pop() |
314 | | - other_method = getattr(img, other_name) |
315 | | - with maybe_deprecated(other_name): |
316 | | - other_data = other_method() |
317 | | - # We get the original data, not the modified cache |
318 | | - assert_array_equal(proxy_data, other_data) |
319 | | - assert not np.all(data == other_data) |
320 | | - # We can modify the other cache, without affecting the first |
321 | | - other_data[:] = 44 |
322 | | - with maybe_deprecated(other_name): |
323 | | - assert_array_equal(other_method(), 44) |
324 | | - with pytest.deprecated_call(): |
325 | | - assert not np.all(method() == other_method()) |
326 | | - if meth_name != 'get_fdata': |
327 | | - return |
328 | 307 | # Check that caching refreshes for new floating point type. |
329 | 308 | img.uncache() |
330 | 309 | fdata = img.get_fdata() |
@@ -558,7 +537,7 @@ def validate_to_from_bytes(self, imaker, params): |
558 | 537 | del img_b |
559 | 538 |
|
560 | 539 | @pytest.fixture(autouse=True) |
561 | | - def setup(self, httpserver, tmp_path): |
| 540 | + def setup_method(self, httpserver, tmp_path): |
562 | 541 | """Make pytest fixtures available to validate functions""" |
563 | 542 | self.httpserver = httpserver |
564 | 543 | self.tmp_path = tmp_path |
@@ -788,7 +767,7 @@ class TestMinc1API(ImageHeaderAPI): |
788 | 767 |
|
789 | 768 | class TestMinc2API(TestMinc1API): |
790 | 769 |
|
791 | | - def setup(self): |
| 770 | + def setup_method(self): |
792 | 771 | if not have_h5py: |
793 | 772 | raise unittest.SkipTest('Need h5py for these tests') |
794 | 773 |
|
|
0 commit comments