class TestBin(unittest.TestCase): def setUp(self): self.outcome_5 = Outcome("00-0-1-2-3", RoulettePayout.FiveBet) self.outcome_0 = Outcome("Number 0", RoulettePayout.StraightBet) self.outcome_00 = Outcome("Number 00", RoulettePayout.StraightBet) self.bin_0 = Bin(self.outcome_0, self.outcome_5) self.bin_00 = Bin(self.outcome_00, self.outcome_5) self.bin_add = Bin() def test_contain_outcome(self): self.assertIn(Outcome("Number 0", RoulettePayout.StraightBet), self.bin_0) def test_not_contain_outcome(self): self.assertNotIn(Outcome("Number 00", RoulettePayout.StraightBet), self.bin_0) def test_contain_all_outcomes(self): self.assertIn(Outcome("Number 0", RoulettePayout.StraightBet), self.bin_0) self.assertIn(Outcome("00-0-1-2-3", 6), self.bin_0) def test_add(self): self.bin_add.add(self.outcome_0) self.bin_add.add(self.outcome_5) self.assertIn(self.outcome_0, self.bin_add) self.assertIn(self.outcome_5, self.bin_add) def test__str__(self): self.assertEqual(str(self.bin_0), "00-0-1-2-3 (6:1), Number 0 (35:1)")
class Test(unittest.TestCase): def setUp(self): self.five = Outcome("00-0-1-2-3", 6) self.zero = Bin(Outcome("0", 35), self.five) self.zerozero = Bin(Outcome("00", 35), self.five) def test_bin(self): local_five = Outcome("00-0-1-2-3", 6) self.assertTrue(self.five in self.zero.outcomes, "%s is in %s" % (self.five, self.zero.outcomes)) self.assertTrue(local_five in self.zero.outcomes, "%s is in %s" % (local_five, self.zero.outcomes)) self.assertTrue(self.five in self.zerozero.outcomes, "%s is in %s" % (self.five, self.zerozero.outcomes)) self.assertTrue(local_five in self.zerozero.outcomes, "%s is in %s" % (local_five, self.zerozero.outcomes)) self.assertTrue(len(self.zero.outcomes) == 2, "set zero has %d members" % (len(self.zero.outcomes))) self.assertTrue(len(self.zerozero.outcomes) == 2, "set zerozero has %d members" % (len(self.zero.outcomes))) def test_add_bin(self): self.zero.add(self.five) self.assertTrue(len(self.zero.outcomes) == 2, "set zero still has %d members" % (len(self.zero.outcomes))) one = Outcome("1", 1) bin_one = Bin(one) self.assertTrue(len(bin_one.outcomes) == 1, "set bin_one has %d members" % (len(bin_one.outcomes))) bin_one.add(self.five) self.assertTrue(len(bin_one.outcomes) == 2, "set bin_one has %d members" % (len(bin_one.outcomes))) self.assertTrue(one in bin_one.outcomes, "%s is in %s" % (one, bin_one)) self.assertTrue(self.five in bin_one.outcomes, "%s is in %s" % (self.five, bin_one))
def setUp(self): self.outcome_5 = Outcome("00-0-1-2-3", RoulettePayout.FiveBet) self.outcome_0 = Outcome("Number 0", RoulettePayout.StraightBet) self.outcome_00 = Outcome("Number 00", RoulettePayout.StraightBet) self.bin_0 = Bin(self.outcome_0, self.outcome_5) self.bin_00 = Bin(self.outcome_00, self.outcome_5) self.bin_add = Bin()
def setUp(self): self.outcome1 = Outcome("Red", 2) self.outcome2 = Outcome("Red", 2) self.outcome3 = Outcome("Black", 2) self.outcome4 = Outcome("Black", 3) self.bin1 = Bin(self.outcome1) self.bin2 = Bin(self.outcome1, self.outcome2) self.bin3 = Bin(self.outcome1, self.outcome3)
def test_add_bin(self): self.zero.add(self.five) self.assertTrue(len(self.zero.outcomes) == 2, "set zero still has %d members" % (len(self.zero.outcomes))) one = Outcome("1", 1) bin_one = Bin(one) self.assertTrue(len(bin_one.outcomes) == 1, "set bin_one has %d members" % (len(bin_one.outcomes))) bin_one.add(self.five) self.assertTrue(len(bin_one.outcomes) == 2, "set bin_one has %d members" % (len(bin_one.outcomes))) self.assertTrue(one in bin_one.outcomes, "%s is in %s" % (one, bin_one)) self.assertTrue(self.five in bin_one.outcomes, "%s is in %s" % (self.five, bin_one))
def setUp(self): self.sampleOutcomeOne = Outcome("1", 1) self.sampleOutcomeTwo = Outcome("Red", 17) self.outcomeOne = Outcome("0", 35) self.outcomeTwo = Outcome("00-0-1-2-3", 6) self.binOne = Bin(self.sampleOutcomeOne, self.sampleOutcomeTwo) self.binTwo = Bin(self.outcomeOne, self.outcomeTwo) self.rng = NonRandom() self.rng.setSeed(3) self.wheel = createWheel(self.rng)
def test_add(): outcome1 = Outcome("red", 1) outcome2 = Outcome("1", 1) outcome3 = Outcome("Odd", 5) new_outcome = Outcome("five bet", 50) bin = Bin(outcome1, outcome2, outcome3) assert outcome1 in bin.outcomes assert outcome2 in bin.outcomes assert outcome3 in bin.outcomes bin.add(new_outcome) assert new_outcome in bin.outcomes
def __init__(self, rng=None): self.bins = tuple(Bin() for i in range(38)) self.rng = rng or random.Random() self.all_outcomes = {} self._buildBins()
def test_binConstruction(self): bin = Bin(self.outcomeOne, self.outcomeTwo, self.outcomeThree) print(bin.__str__()) self.assertIsNotNone(bin)
def setUp(self): self.five = Outcome("00-0-1-2-3", 6) self.zero = Bin(Outcome("0", 35), self.five) self.zerozero = Bin(Outcome("00", 35), self.five)
def __init__(self, rng): self.bins = tuple(Bin() for i in range(38)) self.rng = rng if rng is not None else Random.random() self.all_outcomes = {}