Fix minor bugs of get_terminal output caused by a11y tree depth

This commit is contained in:
Timothyxxx
2024-01-30 18:48:00 +08:00
parent 8885ea0aef
commit d5d9fc56de
2 changed files with 11 additions and 4 deletions

View File

@@ -17,10 +17,16 @@ from .utils import _match_record, _match_value_to_rule
def check_include_exclude(result: str, rules: Dict[str, List[str]]) -> float:
if result is None:
return 0.
print(result, rules)
include = rules.get("include", [])
exclude = rules.get("exclude", [])
return all(r in result for r in include) and all(r not in result for r in exclude)
if all(r in result for r in include) and all(r not in result for r in exclude):
return 1.
else:
return 0.
def exact_match(result, rules) -> float: