mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Python: Add type annotations
This commit is contained in:
committed by
Alexander Wunschik
parent
b95a514e84
commit
83b3dc402c
@@ -50,7 +50,7 @@ letters = {
|
||||
}
|
||||
|
||||
|
||||
def print_banner():
|
||||
def print_banner() -> None:
|
||||
f = [0] * 7
|
||||
j = [0] * 9
|
||||
|
||||
@@ -77,8 +77,9 @@ def print_banner():
|
||||
g1 = 1
|
||||
mStr = input("Character (type 'ALL' if you want character being printed) ").upper()
|
||||
aStr = input("Statement ")
|
||||
# This means to prepare printer, just press Enter
|
||||
input("Set page ")
|
||||
|
||||
input("Set page ") # This means to prepare printer, just press Enter
|
||||
|
||||
for lStr in aStr:
|
||||
s = letters[lStr].copy()
|
||||
xStr = mStr
|
||||
|
||||
19
06_Banner/python/test_banner.py
Normal file
19
06_Banner/python/test_banner.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import io
|
||||
|
||||
from banner import print_banner
|
||||
|
||||
|
||||
def test_print_banner(monkeypatch) -> None:
|
||||
horizontal = "1"
|
||||
vertical = "1"
|
||||
centered = "1"
|
||||
char = "*"
|
||||
statement = "O" # only capital letters
|
||||
set_page = "2"
|
||||
monkeypatch.setattr(
|
||||
"sys.stdin",
|
||||
io.StringIO(
|
||||
f"{horizontal}\n{vertical}\n{centered}\n{char}\n{statement}\n{set_page}"
|
||||
),
|
||||
)
|
||||
print_banner()
|
||||
Reference in New Issue
Block a user