Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov committed Nov 21, 2024
1 parent 5904c8e commit 3a30c1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/unit/algo/classification/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def fxt_hlabel_multilabel_info() -> HLabelInfo:
"Red_Joker",
"Extra_Joker",
],
label_ids=[str(i) for i in range(9)],
label_groups=[
["Heart", "Spade"],
["Heart_Queen", "Heart_King"],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/core/metrics/test_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_default_multi_class_cls_metric_callable(self, fxt_multiclass_labelinfo:
metric = MultiClassClsMetricCallable(fxt_multiclass_labelinfo)
assert isinstance(metric.accuracy, MulticlassAccuracy)

one_class_label_info = LabelInfo(label_names=["class1"], label_groups=[["class1"]])
one_class_label_info = LabelInfo(label_names=["class1"], label_groups=[["class1"]], label_ids=["0"])
assert one_class_label_info.num_classes == 1
binary_metric = MultiClassClsMetricCallable(one_class_label_info)
assert isinstance(binary_metric.accuracy, BinaryAccuracy)
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/core/types/test_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def test_seg_label_info():
# Automatically insert background label at zero index
assert SegLabelInfo.from_num_classes(3) == SegLabelInfo(
["label_0", "label_1", "label_2"],
["0", "1", "2"],
[["label_0", "label_1", "label_2"]],
)
assert SegLabelInfo.from_num_classes(1) == SegLabelInfo(["background", "label_0"], [["background", "label_0"]])
assert SegLabelInfo.from_num_classes(1) == SegLabelInfo(["background", "label_0"], ["0", "1"], [["background", "label_0"]])
assert SegLabelInfo.from_num_classes(0) == NullLabelInfo()


Expand Down

0 comments on commit 3a30c1f

Please sign in to comment.