def test_action_basic_strategy_low_bankroll_split_soft(self): player = Player({'bankroll': 0, 'game_settings': PlayerTest.game_settings}) hand = build_hand('soft_pair') hand.bet = 1 self.assertEqual(PlayerAction.HIT, player.action(hand, Card('5', 5, 'clubs')))
class TestPlayer(unittest.TestCase): def setUp(self): self.player = Player() @unittest.mock.patch('blackjack.player.Player.Q') def test_action(self, mock_Q): player_cards = ['As', 'Qh'] house_cards = ['Kd'] action = self.player.action(player_cards, house_cards) self.assertIn(action, ['stand', 'hit'])
def test_action_basic_strategy_soft(self): player = Player({'game_settings': PlayerTest.game_settings}) hand = build_hand('soft') self.assertEqual(PlayerAction.HIT, player.action(hand, Card('K', 10, 'clubs')))
def test_action_basic_strategy_double_down_with_three_cards(self): player = Player({'game_settings': PlayerTest.game_settings}) hand = build_hand('three_card_11') self.assertEqual(PlayerAction.HIT, player.action(hand, Card('K', 10, 'clubs')))
def test_action_basic_strategy_double_down(self): player = Player({'game_settings': PlayerTest.game_settings}) hand = build_hand('double_down') self.assertEqual(PlayerAction.DOUBLE_DOWN, player.action(hand, Card('5', 5, 'clubs')))
def test_action_basic_strategy_blackjack(self): player = Player({'game_settings': PlayerTest.game_settings}) hand = build_hand('blackjack') self.assertEqual(PlayerAction.STAND, player.action(hand, Card('K', 10, 'clubs')))