示例#1
0
def test_get_outcome():
    wheel = Wheel()
    bb = BinBuilder()
    bb.generate_even_money_bets(wheel)
    bb.generate_column_bets(wheel)

    assert Outcome('High', 1) == wheel.get_outcome('High')
    assert Outcome('Low', 1) == wheel.get_outcome('Low')
    assert Outcome('Red', 1) == wheel.get_outcome('Red')
    assert Outcome('Black', 1) == wheel.get_outcome('Black')

    assert Outcome('Column 1', 1) == wheel.get_outcome('Column 1')
    assert Outcome('Column 2', 1) == wheel.get_outcome('Column 2')
    assert Outcome('Column 3', 1) == wheel.get_outcome('Column 3')
示例#2
0
def test_even_money_bets():
    wheel = Wheel()
    bb = BinBuilder()
    bb.generate_even_money_bets(wheel)
    # Red-Black
    reds = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36}
    blacks = set(range(1, 37)) - reds
    red_out = Outcome('Red', 1)
    black_out = Outcome('Black', 1)

    # Even-Odd
    even_out = Outcome('Even', 1)
    odd_out = Outcome('Odd', 1)

    # Hi - Lo
    hi_out = Outcome('High', 1)
    lo_out = Outcome('Low', 1)

    for i, bin in enumerate(wheel.bins):
        if i == 0 or i == 37:
            assert 0 == len(bin)
        elif i < 19:
            assert lo_out in bin
        else:
            assert hi_out in bin

        if i == 0 or i == 37:
            assert 0 == len(bin)
        elif i % 2 == 0:
            assert even_out in bin
        else:
            assert odd_out in bin

        if i == 0 or i == 37:
            assert 0 == len(bin)
        elif i in reds:
            assert red_out in bin
        else:
            assert black_out in bin