-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
41 lines (31 loc) · 955 Bytes
/
Copy pathtests.py
File metadata and controls
41 lines (31 loc) · 955 Bytes
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
import unittest
import logic
class TestLogic(unittest.TestCase):
def test_get_winner(self):
"""
Test if get_winner() function works as expected.
"""
board = [
['X', None, 'O'],
[None, 'X', None],
[None, 'O', 'X'],
]
self.assertEqual(logic.get_winner(board), 'X')
def test_empty_board(self):
"""
Test if empty_board() function works as expected.
"""
correct_board = [
[None, None, None],
[None, None, None],
[None, None, None],
]
self.assertEqual(logic.empty_board(), correct_board)
def test_other_player(self):
"""
Test if other_player() function works as expected.
"""
self.assertEqual(logic.other_player("X"), "O")
self.assertEqual(logic.other_player("O"), "X")
if __name__ == '__main__':
unittest.main()