Skip to content

Commit 20df4c8

Browse files
committed
TEST: Reproduce gh-802
1 parent b46efa3 commit 20df4c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nibabel/tests/test_image_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,11 @@ def validate_filenames(self, imaker, params):
150150
# to_ / from_ filename
151151
fname = 'another_image' + self.standard_extension
152152
with InTemporaryDirectory():
153-
img.to_filename(fname)
154-
rt_img = img.__class__.from_filename(fname)
153+
# Validate that saving or loading a file doesn't use deprecated methods internally
154+
with clear_and_catch_warnings() as w:
155+
warnings.simplefilter('error', DeprecationWarning)
156+
img.to_filename(fname)
157+
rt_img = img.__class__.from_filename(fname)
155158
assert_array_equal(img.shape, rt_img.shape)
156159
assert_almost_equal(img.get_fdata(), rt_img.get_fdata())
157160
# get_data will be deprecated

0 commit comments

Comments
 (0)