def test_max_3():
    d1 = DiceSet(0, 3, 11)
    assert d1.max() == 0
def test_max_1():
    d1 = DiceSet(4, 3)
    assert d1.max() == 12
def test_max_2():
    d1 = DiceSet(4, 3, 11)
    assert d1.max() == 132
예제 #4
0
def test_weighted_dice_set_add_9():
    wds1 = WeightedDiceSet(4, 3, weights=[1, 3, 2])
    ds2 = DiceSet(3, 3)
    wds3 = ds2 + wds1
    assert wds3.weights == [2, 4, 3]
def test_repr_2():
    d1 = DiceSet(4, 3, 11)
    assert repr(d1) == "dice.DiceSet(4, 3, 11)"
def test_min_3():
    d1 = DiceSet(0, 3, 11)
    assert d1.min() == 0
def test_range_1():
    d1 = DiceSet(4, 3)
    assert d1.range() == [4, 5, 6, 7, 8, 9, 10, 11, 12]
def test_init_3():
    d1 = DiceSet(4, 6)
    assert d1.sides == 6
def test_init_4():
    d1 = DiceSet(4, 6)
    assert d1.base == 1
def test_init_1():
    with pytest.raises(TypeError):
        d1 = DiceSet()
def test_init_2():
    d1 = DiceSet(4, 6)
    assert d1.number == 4
def test_count_attempts_3():
    df = DiceSet(4, 3, 2)
    with pytest.raises(ValueError):
        df.count_attempts(11)
def test_count_attempts_2():
    df = DiceSet(4, 3)
    with pytest.raises(ValueError):
        df.count_attempts(3)
예제 #14
0
def test_weighted_dice_set_add_11():
    wds1 = WeightedDiceSet(4, 3, weights=[1, 3, 2])
    ds2 = DiceSet(3, 4, base=2)
    with pytest.raises(TypeError):
        wds3 = ds2 + wds1
def test_min_1():
    d1 = DiceSet(4, 3)
    assert d1.min() == 4
def test_init_5():
    d1 = DiceSet(4, 6, 4)
    assert d1.base == 4
def test_min_2():
    d1 = DiceSet(4, 3, 11)
    assert d1.min() == 44
def test_init_6():
    with pytest.raises(TypeError):
        d1 = DiceSet(14, 6, 4, 0)
def test_min_4():
    d1 = DiceSet(4, 8)
    assert d1.min() == 4
def test_str_2():
    d1 = DiceSet(4, 3)
    assert str(d1) == "DiceSet of 4 dice with 3 sides, base numbering 1"
def test_range_2():
    d1 = DiceSet(2, 3, 2)
    assert d1.range() == [4, 6, 8, 10, 12]
예제 #22
0
def test_weighted_dice_set_add_8():
    wds1 = WeightedDiceSet(4, 3, weights=[1, 3, 2])
    ds2 = DiceSet(3, 3)
    wds3 = ds2 + wds1
    assert wds3.number == 7