Skip to content

Commit

Permalink
ensure correct no of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn committed Dec 3, 2023
1 parent 9a61fd4 commit ca2ebeb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ def main():
for puzzle in Puzzle.all():
date = f"{puzzle.year}/{puzzle.day:02d}"
example_dir = input_dir / date
egs = [x.name.split(".")[0] for x in example_dir.glob("*.txt")]
n_examples_expected = max([1 + int(x) for x in egs if x.isdigit()], default=0)
if len(puzzle.examples) != n_examples_expected:
print(f"{date} {n_examples_expected=} but {len(puzzle.examples)=}")
rc += 1
for i, example in enumerate(puzzle.examples):
example_file = example_dir / f"{i}.txt"
if not example_file.is_file():
try:
[example_file] = example_dir.glob(f"{i}_*.txt")
[example_file] = example_dir.glob(f"{i}.*.txt")
except ValueError:
print(f"missing example {i} {date}")
rc += 1
Expand Down

0 comments on commit ca2ebeb

Please sign in to comment.