def make_round_mock(): round_ = Round(2) round_.start() player = round_.current_player round_mock = MagicMock(wraps=round_) round_mock.current_player = round_mock.state.current_player = player type(round_mock).living_players = PropertyMock( side_effect=lambda: round_.living_players) round_mock.players = round_.players for p in round_mock.players: p.round = round_mock return round_mock
def started_round(new_round: Round): new_round.start() return new_round
def autoplay_round(game_round: Round): if not game_round.started: game_round.start() while not game_round.ended: play_random_move(game_round.current_player)