예제 #1
0
 def test_create_board(self):
     b = xoxo3.Board()
     d = b.create_board()
     assert d == [" "] * 9
예제 #2
0
 def test_play_again(self):
     b = xoxo3.Board()
     xoxo3.input = lambda pl_again: "Y"
     assert b.play_again() == "Y"
예제 #3
0
 def test_input(self):
     b = xoxo3.Board()
     player = "X"
     xoxo3.input = lambda choice: "3"
     assert b.input(player) == 3
예제 #4
0
 def test_is_tie(self, test_input, expected):
     b = xoxo3.Board()
     assert b.is_tie(test_input) == expected
예제 #5
0
 def test_is_winner(self, test_input, expected):
     b = xoxo3.Board()
     assert b.is_winner('x', test_input) == expected
예제 #6
0
 def test_who_first(self):
     b = xoxo3.Board()
     who_f = "X"
     xoxo3.input = lambda who_f: "X"
     assert b.who_first() == "X"
예제 #7
0
 def test_update_cell(self):
     b = xoxo3.Board()
     player = "x"
     c = b.create_board()
     xoxo3.input = lambda choice: "3"
     assert b.update_cell(3, player, c) == [" ", " ", " ", "x", " ", " ", " ", " ", " "]
예제 #8
0
 def test_display(self):
     b = xoxo3.Board()
     d = b.__init__()
     c = b.create_board()
     assert b.display(c) is 0