mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Python: Add tests and type annotations
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
from awari import print_with_tab
|
||||
import io
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
import pytest
|
||||
|
||||
from awari import print_with_tab, main
|
||||
|
||||
|
||||
def test_print_with_tab():
|
||||
def test_print_with_tab() -> None:
|
||||
print_with_tab(3, "Hello")
|
||||
|
||||
|
||||
def test_main(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setattr("sys.stdin", io.StringIO("1\n2\n3\n4\n5\n6"))
|
||||
with pytest.raises(EOFError):
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user