Skip to content

Commit 3857e43

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 3857e43

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

test/test_pet_data.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
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.parametrize(
12+
"setup_random_uniform_spatial_data",
13+
[
14+
(2, 2, 2, 2, 0.0, 1.0),
15+
],
16+
)
17+
def test_from_nii_requires_frame_time(setup_random_uniform_spatial_data, tmp_path):
18+
data, affine = setup_random_uniform_spatial_data
19+
img = nb.Nifti1Image(data, affine)
1420
fname = tmp_path / "pet.nii.gz"
1521
img.to_filename(fname)
1622

@@ -51,9 +57,14 @@ def test_pet_set_transform_updates_motion_affines():
5157
assert aff is dataset.motion_affines[idx]
5258

5359

54-
def test_pet_load(tmp_path):
55-
data = np.zeros((2, 2, 2, 2), dtype=np.float32)
56-
affine = np.eye(4)
60+
@pytest.mark.parametrize(
61+
"setup_random_uniform_spatial_data",
62+
[
63+
(2, 2, 2, 2, 0.0, 1.0),
64+
],
65+
)
66+
def test_pet_load(setup_random_uniform_spatial_data, tmp_path):
67+
data, affine = setup_random_uniform_spatial_data
5768
img = nb.Nifti1Image(data, affine)
5869
fname = tmp_path / "pet.nii.gz"
5970
img.to_filename(fname)

0 commit comments

Comments
 (0)