Exemple #1
0
    def test_bet_strategy_static(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.STATIC
        }

        strategy = BetStrategy(settings)
        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())
Exemple #2
0
    def test_bet_limit_game(self):
        limit = 25

        settings = {
            'game_settings': GameSettings(min_bet=limit * 2, max_bet=limit)
        }

        strategy = BetStrategy(settings)
        self.assertEqual(limit, strategy.bet())
Exemple #3
0
    def test_bet_limit_player(self):
        limit = 0

        settings = {
            'bet_limit': limit,
            'game_settings': BetStrategyTest.game_settings
        }

        strategy = BetStrategy(settings)
        self.assertEqual(limit, strategy.bet())
Exemple #4
0
    def test_bet_strategy_streak_no_streak_rates(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.STREAK
        }

        strategy = BetStrategy(settings)

        with self.assertRaises(ValueError):
            strategy.bet()
Exemple #5
0
    def test_bet_strategy_streak_no_streak(self):
        streak_rates = {-2: 2, -1: 1, 0: 1, 1: 2, 2: 3}

        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.STREAK,
            'streak_rates': streak_rates
        }

        strategy = BetStrategy(settings)
        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())
Exemple #6
0
    def test_bet_strategy_series_reset_on_lose(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.SERIES,
            'series': [1, 2, 3]
        }

        strategy = BetStrategy(settings)

        strategy.last_hand = Hand()
        strategy.last_hand.result = HandResult.LOSE

        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())
Exemple #7
0
    def test_bet_strategy_parlay(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.PARLAY
        }

        strategy = BetStrategy(settings)
        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())

        strategy.last_hand = Hand()
        strategy.last_hand.result = HandResult.WIN
        strategy.last_hand.winnings = BetStrategyTest.game_settings.min_bet
        self.assertEqual(BetStrategyTest.game_settings.min_bet * 2, strategy.bet())
Exemple #8
0
    def test_bet_strategy_streak_win_streak(self):
        streak_rates = {-2: 2, -1: 1, 0: 1, 1: 2, 2: 3}

        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.STREAK,
            'streak_rates': streak_rates
        }

        strategy = BetStrategy(settings)

        streak_count = 2

        for _ in range(streak_count):
            strategy.last_hand = Hand()
            strategy.last_hand.result = HandResult.WIN

        self.assertEqual(BetStrategyTest.game_settings.min_bet * streak_rates[streak_count], strategy.bet())
Exemple #9
0
    def test_bet_strategy_series(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.SERIES
        }

        strategy = BetStrategy(settings)
        with self.assertRaises(ValueError):
            strategy.bet()

        settings['series'] = [1, 2, 3]
        strategy = BetStrategy(settings)

        for multiplier in settings['series']:
            self.assertEqual(BetStrategyTest.game_settings.min_bet * multiplier, strategy.bet())

        strategy.last_hand = Hand()
        strategy.last_hand.result = HandResult.WIN

        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())
Exemple #10
0
    def test_bet_strategy_martingale(self):
        settings = {
            'game_settings': BetStrategyTest.game_settings,
            'strategy_type': BetStrategyType.MARTINGALE
        }

        strategy = BetStrategy(settings)
        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())

        strategy.last_hand = Hand()
        strategy.last_hand.result = HandResult.PUSH
        self.assertEqual(BetStrategyTest.game_settings.min_bet, strategy.bet())

        strategy.last_hand.result = HandResult.LOSE
        self.assertEqual(BetStrategyTest.game_settings.min_bet * 2, strategy.bet())