mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-19 00:06:04 -08:00
Bullfight (Python): Refactoring
* Add Unit Test * Add Type Annotations * Use variable/function names
This commit is contained in:
16
17_Bullfight/python/test_bullfight.py
Normal file
16
17_Bullfight/python/test_bullfight.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import io
|
||||
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from bullfight import main
|
||||
|
||||
|
||||
def test_main(monkeypatch: MonkeyPatch) -> None:
|
||||
instructions = "Y"
|
||||
kill_bull = "YES"
|
||||
kill_method = "0"
|
||||
run_from_ring = "YES"
|
||||
monkeypatch.setattr(
|
||||
"sys.stdin",
|
||||
io.StringIO(f"{instructions}\n{kill_bull}\n{kill_method}\n{run_from_ring}\n"),
|
||||
)
|
||||
main()
|
||||
Reference in New Issue
Block a user