add vscode examples
This commit is contained in:
@@ -1,5 +1,44 @@
|
||||
from typing import Dict
|
||||
import json
|
||||
|
||||
def check_json_keybindings(actual: str, expected: str, **options) -> float:
|
||||
"""
|
||||
Args:
|
||||
actual (str): path to result text file
|
||||
expected (str): expected dict{}
|
||||
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
|
||||
with open(actual) as f:
|
||||
data = json.load(f)
|
||||
|
||||
if expected in data:
|
||||
return 1.0
|
||||
else:
|
||||
return 0.0
|
||||
|
||||
def check_json_settings(actual: str, expected: str, **options) -> float:
|
||||
"""
|
||||
Args:
|
||||
actual (str): path to result text file
|
||||
expected (str): expected dict{}
|
||||
|
||||
Return:
|
||||
float: the score
|
||||
"""
|
||||
|
||||
with open(actual) as f:
|
||||
data = json.load(f)
|
||||
|
||||
expect = set(expected.items())
|
||||
json = set(data.items())
|
||||
|
||||
if expect.issubset(json):
|
||||
return 1.0
|
||||
else:
|
||||
return 0.0
|
||||
|
||||
def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user