def set_atut_manually(self, player_q): from game.game_board import GameBoard print('Player', player_q[-1].number, 'chooses atut now!') if GameBoard.display_mode: chosen_card = ask_for_card([ ColoredCard(0, 'red'), ColoredCard(0, 'green'), ColoredCard(0, 'blue'), ColoredCard(0, 'yellow') ]) self.atut = chosen_card else: self.atut = ColoredCard(0, 'red')
def play(self): """ Execute the Stich. """ for i in self.player_q: i: Player print('*************************************') print("It is now the turn of Player:", i.number) print("Cards Currently on the board: {", end="") self.print_cards_in_play() print("}") while True: chosen_card = ask_for_card(i.hand) if self.check_if_playable(chosen_card, i): break else: print('You are not allowed to play this card right now!') i.play_card(chosen_card, self.cards_in_play) self.check_stich_winner()
def test_card_wrong_input_number_high(self): user_input = 100 with patch('builtins.input', return_value=user_input): result = ask_for_card(self.hand) self.assertRaises(IndexError)
def test_card_wrong_input_number_negative(self): user_input = -15 with patch('builtins.input', return_value=user_input): result = ask_for_card(self.hand) self.assertRaises(ValueError)
def test_card_input(self): user_input = 20 with patch('builtins.input', return_value=user_input): result = ask_for_card(self.hand) self.assertEqual(result, self.hand[19])