Skip to content

Commit b1eb9b0

Browse files
committed
TST: Add tests for non-integer StackID
1 parent ed3c84c commit b1eb9b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

nibabel/nicom/tests/test_dicomwrappers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,17 @@ def test_shape(self):
594594
# Check for error when explicitly requested StackID is missing
595595
with pytest.raises(didw.WrapperError):
596596
MFW(fake_mf, frame_filters=(didw.FilterMultiStack(3),))
597+
# StackID can be a string
598+
div_seq = ((1,), (2,), (3,), (4,))
599+
sid_seq = ('a', 'a', 'a', 'b')
600+
fake_mf.update(fake_shape_dependents(div_seq, sid_seq=sid_seq))
601+
with pytest.warns(
602+
UserWarning,
603+
match='A multi-stack file was passed without an explicit filter,',
604+
):
605+
assert MFW(fake_mf).image_shape == (32, 64, 3)
606+
assert MFW(fake_mf, frame_filters=(didw.FilterMultiStack('a'),)).image_shape == (32, 64, 3)
607+
assert MFW(fake_mf, frame_filters=(didw.FilterMultiStack('b'),)).image_shape == (32, 64)
597608
# Make some fake frame data for 4D when StackID index is 0
598609
div_seq = ((1, 1, 1), (1, 2, 1), (1, 1, 2), (1, 2, 2), (1, 1, 3), (1, 2, 3))
599610
fake_mf.update(fake_shape_dependents(div_seq, sid_dim=0))

0 commit comments

Comments
 (0)