ver Mar8th
fixed a task and a metric
This commit is contained in:
@@ -194,7 +194,7 @@ def compare_table(result: str, expected: str = None, **options) -> float:
|
||||
# sheet_idx1: as sheet_idx0
|
||||
# rules: list of dict, each dict is like
|
||||
# { "range": ["A1:B6", "C2:E5"],
|
||||
# "type": "includes" | "includes_by" | "fuzzy_match" | "exact_match", # 0 includes 1, 0 includes_by 1
|
||||
# "type": "includes" | "included_by" | "fuzzy_match" | "exact_match", # 0 includes 1, 0 includes_by 1
|
||||
# "threshold": 85, // for fuzzy match
|
||||
# "ignore_case": true | false,
|
||||
# "ignore_chars": " ()", # filtered out
|
||||
@@ -232,9 +232,9 @@ def compare_table(result: str, expected: str = None, **options) -> float:
|
||||
value2 = value2.lower()
|
||||
|
||||
if rl["type"]=="includes":
|
||||
metric: bool = value1 in value2
|
||||
elif rl["type"]=="includes_by":
|
||||
metric: bool = value2 in value1
|
||||
elif rl["type"]=="included_by":
|
||||
metric: bool = value1 in value2
|
||||
elif rl["type"]=="fuzzy_match":
|
||||
metric: bool = fuzz.ratio(value1, value2) >= rl.get("threshold", 85.)
|
||||
elif rl["type"]=="exact_match":
|
||||
|
||||
Reference in New Issue
Block a user