Esempio n. 1
0
	def test_addStreet(self):
		p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
		p.addStreet(1)
		p.addBet('a', 10)
		p.addBet('b', 10)
		p.addBet('c', 10)
		p.addStreet(2)
		p.addBet('b', 10)
		p.addBet('c', 10)
		p.addStreet(3)
		p.addBet('c', 10)
				
		self.assertEqual(len(p.streets), 3)
		
		street1 = p.slice(p.streets[1])
		self.assertEqual(street1.total(), 30)
		
		street2 = p.slice(p.streets[2], p.streets[1])
		self.assertEqual(street2.total(), 20)
		
		street3 = p.slice(p.streets[3], p.streets[2])
		self.assertEqual(street3.total(), 10)
				
		self.assertEqual(p.streets, {1:10, 2:20, 3:30})
		self.assertEqual(p.streetOrder, [1, 2, 3])
Esempio n. 2
0
 def test_toCall(self):
     p = Pot.fromPlayers((('a', 10), ('b', 50), ('c', 100)))
     p.addStreet(1)
     p.addBet('a', 10)
     self.assertEqual(p.toCall('b'), 10)
     p.addBet('b', 40)
     self.assertEqual(p.toCall('c'), 40)
Esempio n. 3
0
	def test_toCall(self):
		p = Pot.fromPlayers((('a', 10), ('b', 50), ('c', 100)))
		p.addStreet(1)
		p.addBet('a', 10)
		self.assertEqual(p.toCall('b'), 10)
		p.addBet('b', 40)
		self.assertEqual(p.toCall('c'), 40)
Esempio n. 4
0
    def test_addStreet(self):
        p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
        p.addStreet(1)
        p.addBet('a', 10)
        p.addBet('b', 10)
        p.addBet('c', 10)
        p.addStreet(2)
        p.addBet('b', 10)
        p.addBet('c', 10)
        p.addStreet(3)
        p.addBet('c', 10)

        self.assertEqual(len(p.streets), 3)

        street1 = p.slice(p.streets[1])
        self.assertEqual(street1.total(), 30)

        street2 = p.slice(p.streets[2], p.streets[1])
        self.assertEqual(street2.total(), 20)

        street3 = p.slice(p.streets[3], p.streets[2])
        self.assertEqual(street3.total(), 10)

        self.assertEqual(p.streets, {1: 10, 2: 20, 3: 30})
        self.assertEqual(p.streetOrder, [1, 2, 3])
Esempio n. 5
0
 def test_addExtraBet(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     p.addStreet(1)
     p.addBet('a', 5)
     p.addExtraBet('a', 2)
     self.assertEqual(p.total(), 7)
     self.assertEqual(sum(p.bets), 5)
     self.assertEqual(sum(p.extraBets), 2)
Esempio n. 6
0
	def test_addExtraBet(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		p.addBet('a', 5)
		p.addExtraBet('a', 2)
		self.assertEqual(p.total(), 7)
		self.assertEqual(sum(p.bets), 5)
		self.assertEqual(sum(p.extraBets), 2)
Esempio n. 7
0
	def test_addBet_all_In(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		p.addBet('a', 10)
		self.assertEqual(p.playersAll_In, {'a': 10})
		self.assertEqual(p.playersAll_InOrder, ['a'])
		
		p.addBet('b', 10)
		self.assertEqual(p.playersAll_In, {'a': 10, 'b': 10})
		self.assertEqual(p.playersAll_InOrder, ['a', 'b'])
Esempio n. 8
0
    def test_addBet_all_In(self):
        p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
        p.addStreet(1)
        p.addBet('a', 10)
        self.assertEqual(p.playersAll_In, {'a': 10})
        self.assertEqual(p.playersAll_InOrder, ['a'])

        p.addBet('b', 10)
        self.assertEqual(p.playersAll_In, {'a': 10, 'b': 10})
        self.assertEqual(p.playersAll_InOrder, ['a', 'b'])
Esempio n. 9
0
 def test_potEmpty(self):
     p = Pot.fromPlayers((('a', 0), ('b', 0), ('c', 0)))
     self.assertEqual(p.total(), 0)
     self.assertEqual(p.height(), 0)
     self.assertEqual(sum(p.bets), 0)
     self.assertEqual(sum(p.extraBets), 0)
     self.assertEqual(len(p.sidePots), 1)
     self.assertEqual(p.players, ['a', 'b', 'c'])
     self.failIf(p.streets)
     self.failIf(p.streetOrder)
     self.failIf(p.playersAll_In)
     self.failIf(p.playersAll_InOrder)
Esempio n. 10
0
	def test_addBet(self):
		p = Pot.fromPlayers((('a', 100), ('b', 200), ('c', 300)))
		p.addStreet(1)
		p.addBet('a', 10)
		self.assertEqual(p.total(), 10)
		self.assertEqual(p.height(), 10)
		self.assertEqual(p.streets[1], 10)
		self.assertEqual(sum(p.bets), 10)
		self.assertEqual(sum(p.extraBets), 0)
		self.assertEqual(len(p.sidePots), 1)
		self.failIf(p.playersAll_In)
		self.failIf(p.playersAll_InOrder)
Esempio n. 11
0
	def test_potEmpty(self):
		p = Pot.fromPlayers((('a', 0), ('b', 0), ('c', 0)))
		self.assertEqual(p.total(), 0)
		self.assertEqual(p.height(), 0)
		self.assertEqual(sum(p.bets), 0)
		self.assertEqual(sum(p.extraBets), 0)
		self.assertEqual(len(p.sidePots), 1)
		self.assertEqual(p.players, ['a', 'b', 'c'])
		self.failIf(p.streets)
		self.failIf(p.streetOrder)
		self.failIf(p.playersAll_In)
		self.failIf(p.playersAll_InOrder)
Esempio n. 12
0
 def test_addBet(self):
     p = Pot.fromPlayers((('a', 100), ('b', 200), ('c', 300)))
     p.addStreet(1)
     p.addBet('a', 10)
     self.assertEqual(p.total(), 10)
     self.assertEqual(p.height(), 10)
     self.assertEqual(p.streets[1], 10)
     self.assertEqual(sum(p.bets), 10)
     self.assertEqual(sum(p.extraBets), 0)
     self.assertEqual(len(p.sidePots), 1)
     self.failIf(p.playersAll_In)
     self.failIf(p.playersAll_InOrder)
Esempio n. 13
0
	def test_sidePots(self):
		p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
		p.addStreet(1)
		p.addBet('a', 10)
		self.assertEqual(len(p.sidePots), 1)
		p.addBet('b', 20)
		self.assertEqual(len(p.sidePots), 2)
		p.addBet('c', 30)
		self.assertEqual(len(p.sidePots), 3)
		
		pot1 = p.slice(p.sidePots[0])
		self.assertEqual(pot1.height(), 10)
		self.assertEqual(pot1.total(), 30)
		
		pot2 = p.slice(p.sidePots[1], p.sidePots[0])
		self.assertEqual(pot2.height(), 10)
		self.assertEqual(pot2.total(), 20)
		
		pot3 = p.slice(p.sidePots[2], p.sidePots[1])
		self.assertEqual(pot3.height(), 10)
		self.assertEqual(pot3.total(), 10)
		
		self.assertEqual(p.playersAll_In, {'a': 10, 'b': 20, 'c': 30})
		self.assertEqual(p.playersAll_InOrder, ['a', 'b', 'c'])
Esempio n. 14
0
    def test_sidePots(self):
        p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
        p.addStreet(1)
        p.addBet('a', 10)
        self.assertEqual(len(p.sidePots), 1)
        p.addBet('b', 20)
        self.assertEqual(len(p.sidePots), 2)
        p.addBet('c', 30)
        self.assertEqual(len(p.sidePots), 3)

        pot1 = p.slice(p.sidePots[0])
        self.assertEqual(pot1.height(), 10)
        self.assertEqual(pot1.total(), 30)

        pot2 = p.slice(p.sidePots[1], p.sidePots[0])
        self.assertEqual(pot2.height(), 10)
        self.assertEqual(pot2.total(), 20)

        pot3 = p.slice(p.sidePots[2], p.sidePots[1])
        self.assertEqual(pot3.height(), 10)
        self.assertEqual(pot3.total(), 10)

        self.assertEqual(p.playersAll_In, {'a': 10, 'b': 20, 'c': 30})
        self.assertEqual(p.playersAll_InOrder, ['a', 'b', 'c'])
Esempio n. 15
0
 def test_addExtraBet_noStreetInPot(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 16
0
	def test_addExtraBet_betSizeNonPositive(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		p.addBet('a', 5)
		self.assertRaises(ValueError, p.addExtraBet, 'a', 0)
Esempio n. 17
0
	def test_addExtraBet_extraBetGreaterRegularBet(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
		p.addBet('a', 2)
		self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 18
0
	def test_addExtraBet_onlyFirstStreetAllowed(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		p.addStreet(2)
		self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 19
0
	def test_addExtraBet_insufficientStack(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		p.addStreet(1)
		p.addBet('a', 5)
		self.assertRaises(ValueError, p.addExtraBet, 'a', 20)
Esempio n. 20
0
 def test_addExtraBet_onlyFirstStreetAllowed(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     p.addStreet(1)
     p.addStreet(2)
     self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 21
0
	def test_addExtraBet_noStreetInPot(self):
		p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
		self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 22
0
 def test_addExtraBet_insufficientStack(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     p.addStreet(1)
     p.addBet('a', 5)
     self.assertRaises(ValueError, p.addExtraBet, 'a', 20)
Esempio n. 23
0
 def test_addExtraBet_betSizeNonPositive(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     p.addStreet(1)
     p.addBet('a', 5)
     self.assertRaises(ValueError, p.addExtraBet, 'a', 0)
Esempio n. 24
0
 def test_addExtraBet_extraBetGreaterRegularBet(self):
     p = Pot.fromPlayers((('a', 10), ('b', 10), ('c', 10)))
     p.addStreet(1)
     self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
     p.addBet('a', 2)
     self.assertRaises(ValueError, p.addExtraBet, 'a', 5)
Esempio n. 25
0
	def test_addStreet_duplicateStreet(self):
		p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
		p.addStreet(1)
		self.assertRaises(ValueError, p.addStreet, 1)
Esempio n. 26
0
 def test_addStreet_duplicateStreet(self):
     p = Pot.fromPlayers((('a', 10), ('b', 20), ('c', 30)))
     p.addStreet(1)
     self.assertRaises(ValueError, p.addStreet, 1)