Fix one bug in Chrome getter
This commit is contained in:
@@ -20,7 +20,7 @@ from lxml.cssselect import CSSSelector
|
||||
from lxml.etree import _Element
|
||||
from rapidfuzz import fuzz
|
||||
|
||||
from .utils import _match_record, _match_value_to_rule
|
||||
from desktop_env.evaluators.metrics.utils import _match_record, _match_value_to_rule
|
||||
|
||||
logger = logging.getLogger("desktopenv.metric.general")
|
||||
|
||||
@@ -321,11 +321,11 @@ def check_direct_json_object(result, rules) -> float:
|
||||
expected_json = rules["expected"]
|
||||
|
||||
for key in expected_json.keys():
|
||||
if isinstance(expected_json.get(key), List):
|
||||
if isinstance(expected_json.get(key), list):
|
||||
flag = 0
|
||||
expected_value_list = expected_json.get(key)
|
||||
for each_expected_value in expected_value_list:
|
||||
if each_expected_value in result.get(key):
|
||||
if isinstance(result.get(key), list) and each_expected_value in result.get(key):
|
||||
flag = 1
|
||||
break
|
||||
if flag == 0:
|
||||
@@ -484,3 +484,15 @@ def compare_python_pure_text(py_file_path, gold_file_path):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(check_direct_json_object([], rules={
|
||||
"relativeTime": {
|
||||
"from": "5th next month"
|
||||
},
|
||||
"expected": {
|
||||
"start": "SEA",
|
||||
"end": "NYC",
|
||||
"time": "{DoW}, {Month} {DayD}, {Year}",
|
||||
"category": "Miles"
|
||||
}}))
|
||||
Reference in New Issue
Block a user