def test_when_play_turn_then_players_play_is_called(self, mocked_player): mocked_player.play_turn.return_value = [] turn = Turn(player=mocked_player) turn.play_turn() mocked_player.play_turn.assert_called()
def test_when_player_plays_cards_then_player_passed_is_false( self, mocked_player): mocked_player.play_turn.return_value = [PresidentCard(HEARTS, '3')] turn = Turn(player=mocked_player) turn.play_turn() self.assertEqual(False, turn.player_passed)
def test_when_player_plays_no_cards_then_player_passed_is_true( self, mocked_player): mocked_player.play_turn.return_value = [] turn = Turn(player=mocked_player) turn.play_turn() self.assertEqual(True, turn.player_passed)
def test_when_player_plays_cards_then_cards_played_is_updated_to_cards( self, mocked_player): cards_played = [ PresidentCard(HEARTS, '3'), PresidentCard(SPADES, '3'), ] mocked_player.play_turn.return_value = cards_played turn = Turn(player=mocked_player) turn.play_turn() self.assertListEqual(cards_played, turn.cards_played)
def play_round(self): while not self.round_over: # self.__print_board() # self.__print_last_play() active_player = self.player_cycle.active_player current_turn = Turn(active_player) current_turn.play_turn() if current_turn.player_passed: self.player_cycle.remove_active_player() if not current_turn.player_passed: game_settings.validate_cards(current_turn.cards_played, self.last_played) self.turns.append(current_turn) if active_player.has_no_cards: self.player_cycle.remove_active_player() next(self.player_cycle)