From 2923b1ec21a6305ed508ede1fd7ee9bb17e108b4 Mon Sep 17 00:00:00 2001 From: Matistjati Date: Mon, 16 Jun 2025 02:04:09 +0200 Subject: [PATCH 1/3] Better message if judge answer file gets judge error --- problemtools/verifyproblem.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/problemtools/verifyproblem.py b/problemtools/verifyproblem.py index 5f76b76a..090d2d5b 100644 --- a/problemtools/verifyproblem.py +++ b/problemtools/verifyproblem.py @@ -285,10 +285,13 @@ def check(self, context: Context) -> bool: if not self._problem.is_interactive(): val_res = self._problem.output_validators.validate(self, self.ansfile) if val_res.verdict != 'AC': + ans_path = Path(self.ansfile) + testcase_relative_data = Path(*ans_path.parts[ans_path.parts.index("data"):]) + if self.is_in_sample_group(): - self.error(f'judge answer file got {val_res}') + self.error(f'judge answer file got {val_res} on testcase {testcase_relative_data}') else: - self.warning(f'judge answer file got {val_res}') + self.warning(f'judge answer file got {val_res} on testcase {testcase_relative_data}') self._check_symlinks() return self._check_res From d01efc047bb56c88bf77b8f5997bc1a3539f4ac4 Mon Sep 17 00:00:00 2001 From: Matistjati Date: Mon, 16 Jun 2025 02:13:29 +0200 Subject: [PATCH 2/3] Robuster finding judge error tc path --- problemtools/verifyproblem.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/problemtools/verifyproblem.py b/problemtools/verifyproblem.py index 090d2d5b..2a67254d 100644 --- a/problemtools/verifyproblem.py +++ b/problemtools/verifyproblem.py @@ -285,8 +285,9 @@ def check(self, context: Context) -> bool: if not self._problem.is_interactive(): val_res = self._problem.output_validators.validate(self, self.ansfile) if val_res.verdict != 'AC': - ans_path = Path(self.ansfile) - testcase_relative_data = Path(*ans_path.parts[ans_path.parts.index("data"):]) + parts = Path(self.ansfile).parts + idx = len(parts) - 1 - parts[::-1].index('data') # Last occurrence of "data" + testcase_relative_data = Path(*parts[idx:]) if self.is_in_sample_group(): self.error(f'judge answer file got {val_res} on testcase {testcase_relative_data}') From 758a7bc0ded7699caf1433a9d63293b9dfb72559 Mon Sep 17 00:00:00 2001 From: Matistjati Date: Mon, 16 Jun 2025 19:13:41 +0200 Subject: [PATCH 3/3] Cleaner testcase path extraction --- problemtools/verifyproblem.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/problemtools/verifyproblem.py b/problemtools/verifyproblem.py index 2a67254d..726e0bb2 100644 --- a/problemtools/verifyproblem.py +++ b/problemtools/verifyproblem.py @@ -285,14 +285,10 @@ def check(self, context: Context) -> bool: if not self._problem.is_interactive(): val_res = self._problem.output_validators.validate(self, self.ansfile) if val_res.verdict != 'AC': - parts = Path(self.ansfile).parts - idx = len(parts) - 1 - parts[::-1].index('data') # Last occurrence of "data" - testcase_relative_data = Path(*parts[idx:]) - if self.is_in_sample_group(): - self.error(f'judge answer file got {val_res} on testcase {testcase_relative_data}') + self.error(f'judge answer file got {val_res} on testcase {self.strip_path_prefix(self.ansfile)}') else: - self.warning(f'judge answer file got {val_res} on testcase {testcase_relative_data}') + self.warning(f'judge answer file got {val_res} on testcase {self.strip_path_prefix(self.ansfile)}') self._check_symlinks() return self._check_res