diff --git a/bin/tools.py b/bin/tools.py index d1de3ca7..3c0c258f 100755 --- a/bin/tools.py +++ b/bin/tools.py @@ -448,9 +448,7 @@ def build_parser(): input_answer_group.add_argument( '--input', '-i', action='store_true', help='Only validate input.' ) - input_answer_group.add_argument( - '--answer', action='store_true', help='Only validate answer.' - ) + input_answer_group.add_argument('--answer', action='store_true', help='Only validate answer.') input_answer_group.add_argument( '--invalid', action='store_true', help='Only check invalid files for validity.' ) diff --git a/bin/validate.py b/bin/validate.py index 5004efc6..5cdfc93d 100644 --- a/bin/validate.py +++ b/bin/validate.py @@ -100,7 +100,12 @@ def _run_helper(self, testcase, constraints, args): cwd = testcase.in_path.with_suffix('.feedbackdir') else: name = self.tmpdir.relative_to(self.problem.tmpdir) - cwd = self.problem.tmpdir / 'tool_runs' / name / testcase.short_path.with_suffix('.feedbackdir') + cwd = ( + self.problem.tmpdir + / 'tool_runs' + / name + / testcase.short_path.with_suffix('.feedbackdir') + ) cwd.mkdir(parents=True, exist_ok=True) arglist = [] if args is not None: diff --git a/doc/validation.md b/doc/validation.md index f2e96c57..37859d28 100644 --- a/doc/validation.md +++ b/doc/validation.md @@ -171,5 +171,3 @@ For interactive problems (`validation: custom interactive`), the invocation is the same as above, but `stdin` is a pipe that feeds team output into the validator instead of a file. Similarly, `stdout` is connected to a pipe that forwards to the submission's `stdin`. - - diff --git a/skel/testing_tool.py b/skel/testing_tool.py index c493130d..6a1ae7ea 100644 --- a/skel/testing_tool.py +++ b/skel/testing_tool.py @@ -58,9 +58,7 @@ def read(p): return line -parser = argparse.ArgumentParser( - description="Testing tool for problem Ducky Debugging." -) +parser = argparse.ArgumentParser(description="Testing tool for problem XXX.") # TODO update name parser.add_argument( "-f", dest="inputfile", @@ -117,12 +115,8 @@ def type(x, y): assert 1 <= x2 and x2 <= w, "Point not in bounds" assert 1 <= y2 and y2 <= h, "Point not in bounds" assert (x1, y1) != (x2, y2) - assert ( - type(x1, y1) == "horizon" - ), "First point does not lie on the horizon." - assert ( - type(x2, y2) == "horizon" - ), "First point does not lie on the horizon." + assert type(x1, y1) == "horizon", "First point does not lie on the horizon." + assert type(x2, y2) == "horizon", "First point does not lie on the horizon." break else: assert False, "Line does not start with question or exclamation mark." diff --git a/support/schemas/generators.cue b/support/schemas/generators.cue index f3617783..aad46fee 100644 --- a/support/schemas/generators.cue +++ b/support/schemas/generators.cue @@ -7,7 +7,7 @@ package problemformat import "struct" // A command invokes a generator, like "tree --n 5". -// The regex restricts occurrences of curly-bracked expressions +// The regex restricts occurrences of curly-bracketed expressions // to things like "tree --random --seed {seed:5}" command: !="" & (=~"^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$") @@ -16,7 +16,7 @@ command: !="" & (=~"^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$") let basename = "([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]|[A-Za-z0-9])" name: =~"^\(basename)$" -// Filenames are somewhat like names, but can also contain '.' +// Filenames are somewhat like names, but can also contain '.' // and have length at least 2, such as "good-solution_02.py" // but not "huge_" or "a". let filename = "[A-Za-z0-9][A-Za-z0-9_.-]*[A-Za-z0-9]" diff --git a/support/schemas/testdata.cue b/support/schemas/testdata.cue index 33c78773..162dd06f 100644 --- a/support/schemas/testdata.cue +++ b/support/schemas/testdata.cue @@ -17,7 +17,7 @@ import "strconv" reject_score: *"0" | #score range: *"-inf +inf" | string // Verify that the scores and ranges make sense: - _range_syntax: strings.Split(range, " ") & [#score, #score] // space-separated scores + _range_syntax: strings.Split(range, " ") & [#score, #score] // space-separated scores _lo: strconv.ParseFloat(strings.Split(range, " ")[0], 64) // parses to float (including '-inf') _hi: strconv.ParseFloat(strings.Split(range, " ")[1], 64) _wa: strconv.ParseFloat(reject_score, 64) @@ -25,13 +25,13 @@ import "strconv" _order: true & _lo <= _wa & _wa <= _ac & _ac <= _hi } // matches "1", "06", "21", ".4", "-1.2", but not 'inf' -#score: =~ "^-?([0-9]+|[0-9]*.[0-9]+)$" +#score: =~ "^-?([0-9]+|[0-9]*.[0-9]+)$" // Default grader // -------------- #default_grader_flags: this={ - string + string _as_struct: { for w in strings.Split(this, " ") { (w): _ } } // convert to struct and ... _as_struct: #valid_default_grader_fields // ... validate its fields } @@ -45,4 +45,4 @@ import "strconv" } #verdict_aggregation_mode: {first_error: _ } | *{worst_error: _ } | {always_accept: _ } -#score_aggregation_mode: {min: _ } | {max: _ } | *{sum: _ } | {avg: _ } \ No newline at end of file +#score_aggregation_mode: {min: _ } | {max: _ } | *{sum: _ } | {avg: _ }