def play_hand(self): while not self.hand_over: current_round = Round(players=self.remaining_players, start_player_index=self.__get_round_starting_index()) current_round.play_round() self.__remove_players_with_no_cards() self.rounds.append(current_round)
def test_when_class_has_previous_turn_then_last_turn_is_the_previous_turn( self, mocked_turn): cards = [PresidentCard(HEARTS, '3')] mocked_turn.cards_played.return_value = cards players = [ StandardPlayer('Player1'), StandardPlayer('Player2'), ] game_round = Round(players=players, start_player_index=0) game_round.turns = [mocked_turn] self.assertEqual(cards, game_round.last_played)
def test_when_class_has_previous_turn_then_last_player_is_the_previous_turn_player( self, mocked_turn): player1 = StandardPlayer('Player1') mocked_turn.player.return_value = [player1] players = [ player1, StandardPlayer('Player2'), ] game_round = Round(players=players, start_player_index=0) game_round.turns = [mocked_turn] self.assertEqual(player1.name, game_round.last_player.name)
def test_when_class_has_no_previous_turn_then_last_played_is_None(self): players = [ StandardPlayer('Player1'), StandardPlayer('Player2'), ] game_round = Round(players=players, start_player_index=0) self.assertEqual(None, game_round.last_played)
def test_when_class_is_constructed_then_class_variables_are_instantiated( self): players = [ StandardPlayer('Player1'), StandardPlayer('Player2'), ] game_round = Round(players=players, start_player_index=0) self.assertEqual(0, len(game_round.turns)) self.assertNotEqual(None, game_round.player_cycle)