-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_game_tk.py
44 lines (30 loc) · 874 Bytes
/
test_game_tk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
test_game_tk 2024-01-26 3:26 p.m.
Test the game_tk widgets
Tom Legrady - [email protected]
(c) 2024 Tom Legrady - All Rights Reserved
"""
import game_tk as tltk
def test_main():
test_window()
test_alphabet()
def test_window():
win = tltk.Tk()
assert win["background"] == "#9abdf5"
win.set_bg("red")
assert win["background"] == "red"
win.set_bg("green")
assert win["background"] == "green"
win.reset()
assert win["background"] == "#9abdf5"
def test_alphabet():
win = tltk.Tk()
alpha = tltk.Alphabet(win)
assert alpha.get() == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for c in "TESTING":
alpha.hide_used_letter(c)
assert alpha.get() == "ABCD F H JKLM OPQR UVWXYZ"
alpha.init_text()
assert alpha.get() == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if __name__ == "__main__":
test_main()