Skip to content

Commit 4de9785

Browse files
committed
TST: Use existing random spatial data generation fixture in PET test
Use existing random spatial data generation fixture in PET data test for the sake of consistency.
1 parent e9bb0df commit 4de9785

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/test_pet_data.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
from nifreeze.data.pet import PET, from_nii
99

1010

11-
def test_from_nii_requires_frame_time(tmp_path):
12-
data = np.zeros((2, 2, 2, 2), dtype=np.float32)
13-
img = nb.Nifti1Image(data, np.eye(4))
11+
@pytest.mark.random_uniform_spatial_data((2, 2, 2, 2), 0.0, 1.0)
12+
def test_from_nii_requires_frame_time(setup_random_uniform_spatial_data, tmp_path):
13+
data, affine = setup_random_uniform_spatial_data
14+
img = nb.Nifti1Image(data, affine)
1415
fname = tmp_path / "pet.nii.gz"
1516
img.to_filename(fname)
1617

@@ -51,9 +52,9 @@ def test_pet_set_transform_updates_motion_affines():
5152
assert aff is dataset.motion_affines[idx]
5253

5354

54-
def test_pet_load(tmp_path):
55-
data = np.zeros((2, 2, 2, 2), dtype=np.float32)
56-
affine = np.eye(4)
55+
@pytest.mark.random_uniform_spatial_data((2, 2, 2, 2), 0.0, 1.0)
56+
def test_pet_load(setup_random_uniform_spatial_data, tmp_path):
57+
data, affine = setup_random_uniform_spatial_data
5758
img = nb.Nifti1Image(data, affine)
5859
fname = tmp_path / "pet.nii.gz"
5960
img.to_filename(fname)

0 commit comments

Comments
 (0)