MCPcopy Create free account
hub / github.com/SalesforceAIResearch/perfcodegen / save_testcases

Method save_testcases

src/dataset.py:473–486  ·  view source on GitHub ↗
(self, file_path = None)

Source from the content-addressed store, hash-verified

471
472
473 def save_testcases(self, file_path = None):
474 if len(self.prompt2testcase) == 0:
475 prompts, overlong_prompts = self.get_all_prompts()
476 for i, p in enumerate(prompts + overlong_prompts):
477 self.prompt2testcase[p] = self.get_testcases(p)
478
479 if file_path != None:
480 with open(file_path, "w") as f:
481 f.write(json.dumps(self.prompt2testcase, sort_keys=True, indent=4, separators=(',', ': ')))
482 elif self.data_path != None:
483 with open(os.path.join(self.data_path, "testcases.json"), "w") as f:
484 f.write(json.dumps(self.prompt2testcase, sort_keys=True, indent=4, separators=(',', ': ')))
485 else:
486 raise ValueError("Cannot find the file path for test cases.")
487
488
489 def save_groundtruths(self, file_path = None, solution_file = None):

Callers 2

get_expected_outputsMethod · 0.80
fix_testcasesMethod · 0.80

Calls 2

get_all_promptsMethod · 0.95
get_testcasesMethod · 0.95

Tested by

no test coverage detected