Skip to content

Commit

Permalink
Merge pull request galaxyproject#17754 from kostrykin/asserts_image/fix
Browse files Browse the repository at this point in the history
Fix bug in `assert_has_image_n_labels`
  • Loading branch information
bgruening authored Mar 16, 2024
2 parents af376f2 + fc67b20 commit 5c1d045
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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>

0 comments on commit 5c1d045

Please sign in to comment.