def test_make_invalid_move1(self): game = Game(self.player1, self.player2) gb = game.game_board game.current_player = self.player1 gb.update_board(game.who_is_moving(), 2) game.toggle_player() gb.update_board(game.who_is_moving(), 2) self.assertFalse(gb.is_space_free(2))
def test_make_valid_move2(self): game = Game(self.player1, self.player2) gb = game.game_board game.who_plays_first() gb.update_board(game.who_is_moving(), 1) game.toggle_player() gb.update_board(game.who_is_moving(), 2) game.toggle_player() gb.update_board(game.who_is_moving(), 3) game.toggle_player() gb.update_board(game.who_is_moving(), 4) game.toggle_player() gb.update_board(game.who_is_moving(), 5) game.toggle_player() gb.update_board(game.who_is_moving(), 6) game.toggle_player() gb.update_board(game.who_is_moving(), 7) game.toggle_player() gb.update_board(game.who_is_moving(), 8) game.toggle_player() self.assertFalse(gb.is_board_full()) gb.update_board(game.who_is_moving(), 9) game.toggle_player() self.assertTrue(gb.is_board_full())
def test_toggle_player(self): game = Game(self.player1, self.player2) previous_player = game.current_player game.toggle_player() current_player = game.current_player self.assertFalse(current_player == previous_player)