def test_not_complete(self): new_board = Board('x', 'o') new_board.move(0, 1, 'x') new_board.move(0, 2, 'o') has_winner, winner = new_board.is_complete() assert has_winner is False assert new_board.turn assert winner == ''
def test_o_win(self): new_board = Board('x', 'o') new_board.move(0, 1, 'x') new_board.move(0, 2, 'o') new_board.move(2, 1, 'x') new_board.move(1, 2, 'o') new_board.move(0, 0, 'x') new_board.move(2, 2, 'o') has_winner, winner = new_board.is_complete() assert has_winner is True assert not new_board.turn assert winner == 'o'
def test_x_win(self): new_board = Board('x', 'o') result = new_board.move(0, 1, 'x') assert not result result = new_board.move(0, 2, 'o') assert not result result = new_board.move(1, 1, 'x') assert not result result = new_board.move(2, 2, 'o') assert not result result = new_board.move(2, 1, 'x') assert not result has_winner, winner = new_board.is_complete() assert has_winner is True assert not new_board.turn assert winner == 'x'
def test_tie_game(self): new_board = Board('x', 'o') new_board.move(0, 0, 'x') new_board.move(0, 2, 'o') new_board.move(0, 1, 'x') new_board.move(1, 0, 'o') new_board.move(1, 1, 'x') new_board.move(2, 1, 'o') new_board.move(1, 2, 'x') new_board.move(2, 2, 'o') new_board.move(2, 0, 'x') is_complete, winner = new_board.is_complete() assert is_complete is True assert not new_board.turn assert winner == ''