Finish loading the vscode examples v1; Improve on the infra: Add accessibility tree into the observation; Add activate window function, etc
This commit is contained in:
@@ -10,6 +10,8 @@ def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
if not actual:
|
||||
return 0.
|
||||
|
||||
with open(actual) as f1:
|
||||
actual_text = f1.read()
|
||||
@@ -22,6 +24,9 @@ def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
|
||||
|
||||
def compare_config(actual: str, rules: Dict, **options) -> float:
|
||||
if not actual:
|
||||
return 0.
|
||||
|
||||
with open(actual) as f1:
|
||||
actual_text = f1.read()
|
||||
|
||||
@@ -39,9 +44,24 @@ def compare_answer(actual: str, rules: Dict, **options) -> float:
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
if not actual:
|
||||
return 0.
|
||||
|
||||
if actual == rules['expect']:
|
||||
return 1.0
|
||||
|
||||
# TODO: can use text embedding to get non-zero return
|
||||
return 0.0
|
||||
|
||||
|
||||
def is_extension_installed(actual: str, rules: Dict, **options):
|
||||
if rules['type'] == 'contain':
|
||||
if rules['expected'] in actual:
|
||||
return 1.0
|
||||
return 0.0
|
||||
elif rules['type'] == 'not_contain':
|
||||
if rules['expected'] not in actual:
|
||||
return 1.0
|
||||
return 0.0
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user