Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/machinevisiontoolbox/ImageIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 0 additions & 7 deletions tests/test_image_io_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Loading