diff --git a/src/machinevisiontoolbox/ImageIO.py b/src/machinevisiontoolbox/ImageIO.py index b73877ae..60249314 100644 --- a/src/machinevisiontoolbox/ImageIO.py +++ b/src/machinevisiontoolbox/ImageIO.py @@ -108,6 +108,11 @@ def Read( if isinstance(data, tuple): # singleton image, make it a list image_arr, name = data + if isinstance(image_arr, list): + # iread() returns (list of images, list of names) for a wildcard + raise ValueError( + "wildcard read not supported, use FileCollection instead" + ) assert isinstance(image_arr, np.ndarray) if not alpha and image_arr.ndim == 3 and image_arr.shape[2] == 4: image_arr = image_arr[:, :, :3] diff --git a/tests/test_image_io_extra.py b/tests/test_image_io_extra.py index 348a0afc..fad763e4 100644 --- a/tests/test_image_io_extra.py +++ b/tests/test_image_io_extra.py @@ -51,13 +51,6 @@ def test_wildcard_that_matches_nothing_is_refused(self): with pytest.raises(ValueError, match="wildcard"): Image.Read("no-such-images-*.png") - @pytest.mark.xfail( - strict=True, - raises=AssertionError, - reason="iread() returns (list of images, list of paths) for a wildcard, " - "which Image.Read() mistakes for a single image, so its own " - "'wildcard read not supported' ValueError is never reached", - ) def test_wildcard_that_matches_files_is_refused(self): with pytest.raises(ValueError, match="wildcard"): Image.Read(str(DATA / "stripes*.png"))