Skip to content
Open
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
6 changes: 5 additions & 1 deletion movement/io/load_bboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,12 @@ def from_file(
frame_regexp=frame_regexp,
)
else:
valid_options = ["VIA-tracks"]
raise logger.error(
ValueError(f"Unsupported source software: {source_software}")
ValueError(
f"Unsupported source software: '{source_software}'. "
f"Supported options are: {', '.join(valid_options)}"
)
)


Expand Down
12 changes: 11 additions & 1 deletion movement/io/load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,18 @@ def from_file(
)
return from_nwb_file(file, **kwargs)
else:
valid_options = [
"Anipose",
"DeepLabCut",
"LightningPose",
"NWB",
"SLEAP",
]
raise logger.error(
ValueError(f"Unsupported source software: {source_software}")
ValueError(
f"Unsupported source software: '{source_software}'. "
f"Supported options are: {', '.join(valid_options)}"
)
)


Expand Down
13 changes: 12 additions & 1 deletion tests/test_unit/test_io/test_load_bboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,25 @@ def test_from_file(
"VIA-tracks": "movement.io.load_bboxes.from_via_tracks_file",
}
if source_software == "Unknown":
with pytest.raises(ValueError, match="Unsupported source"):
with pytest.raises(ValueError, match="Unsupported source software"):
load_bboxes.from_file(
"some_file",
source_software,
fps,
use_frame_numbers_from_file=use_frame_numbers_from_file,
frame_regexp=frame_regexp,
)
try:
load_bboxes.from_file(
"some_file",
source_software,
fps,
use_frame_numbers_from_file=use_frame_numbers_from_file,
frame_regexp=frame_regexp,
)
except ValueError as e:
assert "Supported options are:" in str(e)
assert "VIA-tracks" in str(e)
else:
with patch(software_to_loader[source_software]) as mock_loader:
load_bboxes.from_file(
Expand Down
16 changes: 15 additions & 1 deletion tests/test_unit/test_io/test_load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,22 @@ def test_from_file_delegates_correctly(source_software, fps, caplog):
"NWB": "movement.io.load_poses.from_nwb_file",
}
if source_software == "Unknown":
with pytest.raises(ValueError, match="Unsupported source"):
with pytest.raises(ValueError, match="Unsupported source software"):
load_poses.from_file("some_file", source_software)
try:
load_poses.from_file("some_file", source_software)
except ValueError as e:
assert "Supported options are:" in str(e)
assert any(
src in str(e)
for src in [
"DeepLabCut",
"SLEAP",
"LightningPose",
"Anipose",
"NWB",
]
)
else:
with patch(software_to_loader[source_software]) as mock_loader:
load_poses.from_file("some_file", source_software, fps)
Expand Down