mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Python: Add test for 9 / 10 / 11 / 12
This commit is contained in:
17
10_Blackjack/python/test_blackjack.py
Normal file
17
10_Blackjack/python/test_blackjack.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import io
|
||||
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from _pytest.capture import CaptureFixture
|
||||
|
||||
from blackjack import main
|
||||
|
||||
|
||||
def test_blackjack(monkeypatch: MonkeyPatch, capsys: CaptureFixture[str]) -> None:
|
||||
nb_players = 1
|
||||
instructions = "y"
|
||||
bet = 100
|
||||
monkeypatch.setattr(
|
||||
"sys.stdin",
|
||||
io.StringIO(f"{nb_players}\n{instructions}\n\n{bet}\ns\nn\n"),
|
||||
)
|
||||
main()
|
||||
Reference in New Issue
Block a user