2021-01-11 02:04:31 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from solution import main
|
|
|
|
|
|
|
|
|
|
|
|
HERE = Path(__file__).absolute().parent
|
|
|
|
|
|
|
|
|
|
|
|
def test_solution(capsys):
|
|
|
|
with (HERE / "test-input").open() as infile:
|
|
|
|
sys.stdin = infile
|
|
|
|
main()
|
|
|
|
|
|
|
|
expected_output = (HERE / "test-output").read_text().splitlines()
|
|
|
|
assert expected_output == [
|
2021-01-11 14:19:36 +00:00
|
|
|
l for l in capsys.readouterr().out.splitlines() if l.startswith("counts_sum")
|
2021-01-11 02:04:31 +00:00
|
|
|
]
|