mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-05 01:27:42 -08:00
Python: Add tests and type annotations
This commit is contained in:
16
07_Basketball/python/test_basketball.py
Normal file
16
07_Basketball/python/test_basketball.py
Normal 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()
|
||||
Reference in New Issue
Block a user