Python: Add tests and type annotations

This commit is contained in:
Martin Thoma
2022-03-22 11:55:13 +01:00
parent 97bf59b328
commit bf4ac6c3ca
11 changed files with 456 additions and 209 deletions

View File

@@ -0,0 +1,16 @@
import io
import pytest
from _pytest.monkeypatch import MonkeyPatch
from _pytest.capture import CaptureFixture
from basketball import Basketball
def test_basketball(monkeypatch: MonkeyPatch, capsys: CaptureFixture[str]) -> None:
monkeypatch.setattr(
"sys.stdin",
io.StringIO("\n1\n6\n1\n2\n1\n2\n1\n2\n1\n2\n3\n4\n5\n4"),
)
with pytest.raises(EOFError):
Basketball()