-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwip.py
50 lines (35 loc) · 1.11 KB
/
wip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import re
import sys
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from icecream import ic
from parse import parse
# --> Puzzle solution
def solve(input_data):
return 0
# --> Test driven development helpers
# Test any examples given in the problem
sample_input = Path("input-sample.txt").read_text().strip()
EXAMPLES = [
(sample_input, 0),
]
@pytest.mark.parametrize("sample_data,sample_solution", EXAMPLES, ids=("sample",))
def test_samples(sample_data, sample_solution) -> None:
assert solve(sample_data) == sample_solution
# --> Setup and run
if __name__ == "__main__":
# Run the test examples with icecream debug-trace turned on
ic.enable()
ex = pytest.main([__file__, "--capture=tee-sys", "-v"])
if ex not in {pytest.ExitCode.OK, pytest.ExitCode.NO_TESTS_COLLECTED}:
print(f"tests FAILED ({ex})")
sys.exit(1)
else:
print("tests PASSED")
# Actual input data generally has more iterations, turn off log
ic.disable()
my_input = Path("input.txt").read_text().strip()
result = solve(my_input)
print(result)