Skip to content

Commit de8785b

Browse files
committed
TEST: Purge final get_data() calls from some tests
1 parent 7fd0b80 commit de8785b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

nipype/interfaces/freesurfer/tests/test_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ def test_concatenate(tmpdir):
3232
# Test default behavior
3333
res = model.Concatenate(in_files=[in1, in2]).run()
3434
assert res.outputs.concatenated_file == tmpdir.join("concat_output.nii.gz").strpath
35-
assert np.allclose(nb.load("concat_output.nii.gz").get_data(), out_data)
35+
assert np.allclose(nb.load("concat_output.nii.gz").get_fdata(), out_data)
3636

3737
# Test specified concatenated_file
3838
res = model.Concatenate(in_files=[in1, in2], concatenated_file=out).run()
3939
assert res.outputs.concatenated_file == tmpdir.join(out).strpath
40-
assert np.allclose(nb.load(out, mmap=NUMPY_MMAP).get_data(), out_data)
40+
assert np.allclose(nb.load(out, mmap=NUMPY_MMAP).get_fdata(), out_data)
4141

4242
# Test in workflow
4343
wf = pe.Workflow("test_concatenate", base_dir=tmpdir.strpath)
@@ -47,12 +47,12 @@ def test_concatenate(tmpdir):
4747
wf.add_nodes([concat])
4848
wf.run()
4949
assert np.allclose(
50-
nb.load(tmpdir.join("test_concatenate", "concat", out).strpath).get_data(),
50+
nb.load(tmpdir.join("test_concatenate", "concat", out).strpath).get_fdata(),
5151
out_data,
5252
)
5353

5454
# Test a simple statistic
5555
res = model.Concatenate(
5656
in_files=[in1, in2], concatenated_file=out, stats="mean"
5757
).run()
58-
assert np.allclose(nb.load(out, mmap=NUMPY_MMAP).get_data(), mean_data)
58+
assert np.allclose(nb.load(out, mmap=NUMPY_MMAP).get_fdata(), mean_data)

nipype/interfaces/tests/test_image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ def test_reorientation_backport():
5050

5151
# Reorientation changes affine and data array
5252
assert not np.allclose(img.affine, reoriented_a.affine)
53-
assert not (flips_only and np.allclose(img.get_data(), reoriented_a.get_data()))
53+
assert not (
54+
flips_only and np.allclose(img.get_fdata(), reoriented_a.get_fdata())
55+
)
5456
# Dimension info changes iff axes are reordered
5557
assert flips_only == np.array_equal(
5658
img.header.get_dim_info(), reoriented_a.header.get_dim_info()
5759
)
5860

5961
# Both approaches produce equivalent images
6062
assert np.allclose(reoriented_a.affine, reoriented_b.affine)
61-
assert np.array_equal(reoriented_a.get_data(), reoriented_b.get_data())
63+
assert np.array_equal(reoriented_a.get_fdata(), reoriented_b.get_fdata())
6264
assert np.array_equal(
6365
reoriented_a.header.get_dim_info(), reoriented_b.header.get_dim_info()
6466
)

0 commit comments

Comments
 (0)