Fix bug in assert_has_image_n_labels

This commit is contained in:
Leonid Kostrykin
2024-03-15 14:16:06 +01:00
parent fd328ca328
commit fc67b20444
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -241,6 +241,7 @@ def _get_image_labels(
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,
@@ -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,
+2 -1
View File
@@ -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>
@@ -179,4 +180,4 @@
</output>
</test>
</tests>
</tool>
</tool>