Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make timeout int
Browse files Browse the repository at this point in the history
mzuenni committed Feb 1, 2025
1 parent 33119de commit c4c75ad
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/generate.py
Original file line number Diff line number Diff line change
@@ -718,7 +718,7 @@ def validate_ans(t, problem, testcase, meta_yaml, bar):
and problem.limits.output * 1024 * 1024 < 2 * size
): # we already warn if the limit is exceeded
bar.warn(
f'.ans file is close to output limit (set limits.output to at least {(2*size + 1024 * 1024 - 1) // 1024 // 1024}MiB in problem.yaml)'
f'.ans file is {size / 1024 / 1024:.3f}MiB, which is close to output limit (set limits.output to at least {(2*size + 1024 * 1024 - 1) // 1024 // 1024}MiB in problem.yaml)'
)

answer_validator_hashes = {
8 changes: 4 additions & 4 deletions bin/verdicts.py
Original file line number Diff line number Diff line change
@@ -145,9 +145,9 @@ class Verdicts:
available (and returns the topmost inferred testgroup).
Verdicts (registered and inferred) are accessed with __getitem__
>>> V = Verdicts(["a/b/1", "a/b/2", "a/c/1", "a/d/1", "b/3"], timeout=1.0)
>>> V.set('a/b/1', 'ACCEPTED', 1.0)
>>> V.set('a/b/2', 'AC', 1.0) # returns 'a/b' because that verdict will be set as well
>>> V = Verdicts(["a/b/1", "a/b/2", "a/c/1", "a/d/1", "b/3"], timeout=1)
>>> V.set('a/b/1', 'ACCEPTED', 0.9)
>>> V.set('a/b/2', 'AC', 0.9) # returns 'a/b' because that verdict will be set as well
>>> print(V['a/b'], V['.'])
ACCEPTED None
@@ -167,7 +167,7 @@ class Verdicts:
def __init__(
self,
testcases_list: list[testcase.Testcase],
timeout: int = 1,
timeout: int,
run_until: RunUntil = RunUntil.FIRST_ERROR,
):
testcases: set[str] = set(t.name for t in testcases_list)
8 changes: 4 additions & 4 deletions test/test_verdicts.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ def __init__(self, name):

class TestVerdicts:
def test_inherited_inference(self):
verds = verdicts.Verdicts(PATHS, 1.0)
verds = verdicts.Verdicts(PATHS, 1)
verds.set("secret/a/1", AC, 0.5)
verds.set("secret/a/2", AC, 0.5)
verds.set("secret/a/3", AC, 0.5)
@@ -23,7 +23,7 @@ def test_inherited_inference(self):
assert verds["."] == AC

def test_first_error(self):
verds = verdicts.Verdicts(PATHS, 1.0)
verds = verdicts.Verdicts(PATHS, 1)
assert all(verds.run_is_needed(f"secret/a/{i}") for i in range(1, 3))
verds.set("secret/a/1", AC, 0.5)
verds.set("secret/a/3", WA, 0.5)
@@ -42,7 +42,7 @@ def test_efficiency(self):
# This means that this test_efficiency() runs in quadratic time.
size = 1000
many_paths = [MockTestcase(f"a/{i}") for i in range(size)]
verds = verdicts.Verdicts(many_paths, 1.0)
verds = verdicts.Verdicts(many_paths, 1)
evens = range(0, size, 2)
odds = range(1, size, 2)
for i in reversed(evens):
@@ -52,7 +52,7 @@ def test_efficiency(self):

def test_parent_overwrite(self):
# If implemented badly, will overwrite verdict at `secret/a' (and crash)
verds = verdicts.Verdicts(PATHS, 1.0)
verds = verdicts.Verdicts(PATHS, 1)
verds.set("secret/a/1", WA, 0.5)
assert verds["secret/a"] == WA
verds.set("secret/a/2", WA, 0.5) # should not try to write 'secret/a' again

0 comments on commit c4c75ad

Please sign in to comment.