コード例 #1
0
    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')))
コード例 #2
0
ファイル: test_player.py プロジェクト: somiandras/blackjack
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'])
コード例 #3
0
    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')))
コード例 #4
0
    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')))
コード例 #5
0
    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')))
コード例 #6
0
    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')))