def test_collect_blinds(self): initial_stack = 1000 small_blind_size = 5 big_blind_size = small_blind_size * 2 button_player = self.setup_new_player("Button", initial_stack) player2 = self.setup_new_player("SmallBlind", initial_stack) player3 = self.setup_new_player("BigBlind", initial_stack) seating = Seating([button_player, player2, player3]) deck = Deck() dealer = Dealer(deck, seating) dealer.pot = Pot() dealer.collect_blinds(small_blind_size) self.assertEqual(initial_stack, button_player.stack) self.assertEqual(initial_stack - small_blind_size, player2.stack) self.assertEqual(initial_stack - big_blind_size, player3.stack) self.assertEqual(big_blind_size + small_blind_size, dealer.pot.total_count()) dealer.move_button() dealer.pot = Pot() dealer.collect_blinds(small_blind_size) self.assertEqual(initial_stack - big_blind_size, button_player.stack) self.assertEqual(initial_stack - small_blind_size, player2.stack) self.assertEqual(initial_stack - big_blind_size - small_blind_size, player3.stack) self.assertEqual(big_blind_size + small_blind_size, dealer.pot.total_count()) self.assertTrue(button_player in dealer.pot.chips_per_player) self.assertTrue(player3 in dealer.pot.chips_per_player)
def test_collect_blinds__when_player_dont_have_enough_chips(self): initial_stack = 100 small_blind_size = 5 big_blind_size = small_blind_size * 2 button_player = self.setup_new_player("Button", 100) player2 = self.setup_new_player("SmallBlind", small_blind_size - 1) player3 = self.setup_new_player("BigBlind", big_blind_size - 1) seating = Seating([button_player, player2, player3]) deck = Deck() dealer = Dealer(deck, seating) dealer.pot = Pot() dealer.collect_blinds(small_blind_size) self.assertEqual(initial_stack, button_player.stack) self.assertEqual(0, player2.stack) self.assertEqual(0, player3.stack) self.assertEqual(13, dealer.pot.total_count()) self.assertTrue(player2 in dealer.pot.chips_per_player) self.assertTrue(player3 in dealer.pot.chips_per_player)