Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in assert_has_image_n_labels #17754

Merged
merged 1 commit into from
Mar 16, 2024
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
3 changes: 2 additions & 1 deletion lib/galaxy/tool_util/verify/asserts/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def cast_label(label):
def assert_has_image_n_labels(
output_bytes: bytes,
channel: Optional[Union[int, str]] = None,
labels: Optional[Union[str, List[int]]] = None,
exclude_labels: Optional[Union[str, List[int]]] = None,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
Expand All @@ -251,7 +252,7 @@ def assert_has_image_n_labels(
"""
Asserts the specified output is an image and has the specified number of unique values (e.g., uniquely labeled objects).
"""
present_labels = _get_image_labels(output_bytes, channel, exclude_labels)[1]
present_labels = _get_image_labels(output_bytes, channel, labels, exclude_labels)[1]
_assert_number(
len(present_labels),
n,
Expand Down
3 changes: 2 additions & 1 deletion test/functional/tools/validation_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
<has_image_height height="32" />
<has_image_channels channels="1" />
<has_image_n_labels n="1" exclude_labels="0" />
<has_image_n_labels n="0" exclude_labels="0,1" />
<has_image_mean_object_size mean_object_size="256" exclude_labels="0" />
</assert_contents>
</output>
Expand Down Expand Up @@ -179,4 +180,4 @@
</output>
</test>
</tests>
</tool>
</tool>
Loading