Skip to content

Commit

Permalink
TST: Add tests for non-integer StackID
Browse files Browse the repository at this point in the history
  • Loading branch information
moloney committed Nov 20, 2024
1 parent ed3c84c commit b1eb9b0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nibabel/nicom/tests/test_dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,17 @@ def test_shape(self):
# Check for error when explicitly requested StackID is missing
with pytest.raises(didw.WrapperError):
MFW(fake_mf, frame_filters=(didw.FilterMultiStack(3),))
# StackID can be a string
div_seq = ((1,), (2,), (3,), (4,))
sid_seq = ('a', 'a', 'a', 'b')
fake_mf.update(fake_shape_dependents(div_seq, sid_seq=sid_seq))
with pytest.warns(

Check warning on line 601 in nibabel/nicom/tests/test_dicomwrappers.py

View check run for this annotation

Codecov / codecov/patch

nibabel/nicom/tests/test_dicomwrappers.py#L598-L601

Added lines #L598 - L601 were not covered by tests
UserWarning,
match='A multi-stack file was passed without an explicit filter,',
):
assert MFW(fake_mf).image_shape == (32, 64, 3)
assert MFW(fake_mf, frame_filters=(didw.FilterMultiStack('a'),)).image_shape == (32, 64, 3)
assert MFW(fake_mf, frame_filters=(didw.FilterMultiStack('b'),)).image_shape == (32, 64)

Check warning on line 607 in nibabel/nicom/tests/test_dicomwrappers.py

View check run for this annotation

Codecov / codecov/patch

nibabel/nicom/tests/test_dicomwrappers.py#L605-L607

Added lines #L605 - L607 were not covered by tests
# Make some fake frame data for 4D when StackID index is 0
div_seq = ((1, 1, 1), (1, 2, 1), (1, 1, 2), (1, 2, 2), (1, 1, 3), (1, 2, 3))
fake_mf.update(fake_shape_dependents(div_seq, sid_dim=0))
Expand Down

0 comments on commit b1eb9b0

Please sign in to comment.