Example #1
0
    def test_simple_pot(self):
        """ Test simple 2 player, 1 round pot. """
        potmgr = PotManager()
        potmgr.add({10: self.players[:2]})
        pots = potmgr.pots

        self.assertEquals(1, len(pots))
        self.assertEquals(2, len(pots[0].players))
        self.assertEquals(set(self.players[:2]), set(pots[0].players))
        self.assertEquals(20, pots[0].amount)
Example #2
0
    def test_one_allin(self):
        """ Test 2 player, one allin. """
        potmgr = PotManager()
        potmgr.add({10: self.players[:2]})
        self.players[0].allin = True
        potmgr.add({10: self.players[:2]})
        pots = potmgr.pots

        self.assertEquals(1, len(pots))
        self.assertEquals(2, len(pots[0].players))
        self.assertEquals(set(self.players[:2]), set(pots[0].players))
        self.assertEquals(40, pots[0].amount)
Example #3
0
    def test_two_allin_split_pot(self):
        """ Test 2 players pushing in in different rounds. """
        potmgr = PotManager()
        self.players[2].allin = True
        potmgr.add({15: self.players[:3]})
        self.players[1].allin = True
        potmgr.add({10: self.players[:2]})
        pots = potmgr.pots

        self.assertEquals(2, len(pots))
        self.assertTrue(pots[1].is_main_pot)
        self.assertFalse(pots[0].is_main_pot)
        self.assertEquals(2, len(pots[0].players))
        self.assertEquals(3, len(pots[1].players))
        self.assertEquals(set(self.players[:2]), set(pots[0].players))
        self.assertEquals(set(self.players[:3]), set(pots[1].players))
        self.assertEquals(20, pots[0].amount)
        self.assertEquals(45, pots[1].amount)
Example #4
0
    def test_two_allin_split_more_complicated(self):
        """ Test 2 players pushing in in different rounds, betting continues.

        Pots are:
           0 : 15 15 15
           1 : 16 16
           1 : 10 10
        """
        potmgr = PotManager()
        self.players[2].allin = True
        potmgr.add({15: [self.players[2]], 31: self.players[:2]})
        self.players[1].allin = True
        potmgr.add({10: self.players[:2]})
        pots = potmgr.pots

        self.assertEquals(2, len(pots))
        self.assertEquals(2, len(pots[0].players))
        self.assertEquals(3, len(pots[1].players))
        self.assertEquals(set(self.players[:2]), set(pots[0].players))
        self.assertEquals(set(self.players[:3]), set(pots[1].players))
        self.assertEquals((31 - 15) * 2 + 20, pots[0].amount)
        self.assertEquals(45, pots[1].amount)