Skip to content

Commit

Permalink
fix : minor edit in __compare_assign_handler__ #347
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi authored and alirezazolanvari committed Nov 28, 2021
1 parent a388541 commit 1c1bd71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pycm/pycm_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ def __compare_assign_handler__(compare, cm_dict, class_weight, digit):
if class_weight is not None:
if not isinstance(class_weight, dict):
raise pycmCompareError(COMPARE_CLASS_WEIGHT_ERROR)
if set(class_weight.keys()) == set(compare.classes) and all(
[isfloat(x) for x in class_weight.values()]):
compare.class_weight = class_weight
if set(class_weight.keys()) == set(compare.classes):
if all([isfloat(x) for x in class_weight.values()]) and sum(class_weight.values())!=0:
compare.class_weight = class_weight
else:
raise pycmCompareError(COMPARE_CLASS_WEIGHT_ERROR)

0 comments on commit 1c1bd71

Please sign in to comment.