Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pretest_test_cases to be specified via regex #1127

Open
kiritofeng opened this issue Mar 19, 2023 · 0 comments
Open

Allow pretest_test_cases to be specified via regex #1127

kiritofeng opened this issue Mar 19, 2023 · 0 comments

Comments

@kiritofeng
Copy link
Member

Should follow from a simple refactor of

def _resolve_test_cases(self):
test_cases = self.config.test_cases
# We support several ways for specifying cases. The first is a list of cases, and requires no extra work.
if test_cases is not None and isinstance(test_cases.unwrap(), list):
return test_cases
def get_with_default(name, default):
if not test_cases:
return default
return test_cases[name] or default
# If the `test_cases` node is None, we try to guess the testcase name format.
self.config['test_cases'] = self._match_test_cases(
self._problem_file_list(),
re.compile(get_with_default('input_format', DEFAULT_TEST_CASE_INPUT_PATTERN), re.IGNORECASE),
re.compile(get_with_default('output_format', DEFAULT_TEST_CASE_OUTPUT_PATTERN), re.IGNORECASE),
iter(get_with_default('case_points', itertools.repeat(self.config.points))),
)
return self.config['test_cases']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant