File size: 1,098 Bytes
6fffc74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from typing import Any, Dict
from flows import utils
from .src.evaluation import testing_utils_codeforces
from .CodeTesting import CodeTesting
log = utils.get_pylogger(__name__)
# ToDo: Add a flags to control whether hidden, public or both tests should be used for evaluation
class CF_CodeTesting(CodeTesting):
REQUIRED_KEYS_CONFIG = []
REQUIRED_KEYS_KWARGS = []
def __init__(self, **kwargs):
super().__init__(**kwargs)
def _get_test_data(self, input_data: Dict):
"""This function retrieves (or generates) input-output pairs that will be used to test the implementation."""
return input_data["public_tests_individual_io"]
def _run_tests(self, input_data: Dict, test_data: Dict) -> Dict[str, Any]:
testing_results = testing_utils_codeforces.evaluate_solution_for_problem(
candidate_solution=input_data["code"],
public_tests_io=test_data
)
for test_output in testing_results["public_tests_results"]:
test_output["input"] = "\n".join(test_output["input"])
return testing_results
|