예제 #1
0
 def test_Pot_new_side_pot(self):
     """Test Pot.new_side_pot() method"""
     player_one = Player(name="One")
     player_two = Player(name="Two")
     player_three = Player(name="Three")
     player_four = Player(name="Four")
     contending_players = [player_one, player_two, player_three, player_four]
     pot = Pot(contending_players)
     player_one.bet = 100
     player_two.bet = 0
     player_three.bet = 120
     player_four.bet = 90
     pot.new_side_pot()
     # Should have dropped player_two since .bet == 0
     self.assertListEqual(pot.contending_players,
                          [player_one, player_three, player_four])
예제 #2
0
 def test_Pot_pull_bets(self):
     """Test Pot.pull_bets() method"""
     player_one = Player(name="One")
     player_two = Player(name="Two")
     player_three = Player(name="Three")
     player_four = Player(name="Four")
     contending_players = [player_one, player_two, player_three, player_four]
     pot = Pot(contending_players)
     player_one.bet = 100
     player_two.bet = 10
     player_three.bet = 120
     player_four.bet = 90
     pot.pull_bets(maximum_pull=50)
     self.assertEqual(pot.amount, 160)
     self.assertEqual(player_one.bet, 50)
     self.assertEqual(player_two.bet, 0)
     self.assertEqual(player_three.bet, 70)
     self.assertEqual(player_four.bet, 40)
     pot.fold_player(player_one)  # Should still pull from this player
     pot.pull_bets()  # Should pull everything
     self.assertEqual(pot.amount, 320)
     for player in contending_players:
         self.assertEqual(player.bet, 0,
                          "%s bet == %d != 0" % (player, player.bet))