Exemple #1
0
def test_fudge():
    nb, sides, modifier = RollParser.parse('df')
    assert (nb, sides, modifier) == (4, 'F', 0)

    nb, sides, modifier = RollParser.parse('2df')
    assert (nb, sides, modifier) == (2, 'F', 0)

    nb, sides, modifier = RollParser.parse('dF')
    assert (nb, sides, modifier) == (4, 'F', 0)

    nb, sides, modifier = RollParser.parse('2dF')
    assert (nb, sides, modifier) == (2, 'F', 0)
Exemple #2
0
def test_fudge():
    nb, sides, modifier = RollParser.parse('df')
    assert (nb, sides, modifier) == (4, 'F', 0)

    nb, sides, modifier = RollParser.parse('2df')
    assert (nb, sides, modifier) == (2, 'F', 0)

    nb, sides, modifier = RollParser.parse('dF')
    assert (nb, sides, modifier) == (4, 'F', 0)

    nb, sides, modifier = RollParser.parse('2dF')
    assert (nb, sides, modifier) == (2, 'F', 0)
Exemple #3
0
def test_tools_hellish():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse(u'2d6°')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('2dA')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('2')
Exemple #4
0
def test_tools_hellish():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse(u'2d6°')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('2dA')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('2')
Exemple #5
0
def test_tools():
    nb, sides, modifier = RollParser.parse('2d6')
    assert (nb, sides, modifier) == (2, 6, 0)

    nb, sides, modifier = RollParser.parse('2d')
    assert (nb, sides, modifier) == (2, 6, 0)

    nb, sides, modifier = RollParser.parse('2d1')
    assert (nb, sides, modifier) == (2, 1, 0)

    nb, sides, modifier = RollParser.parse('d6')
    assert (nb, sides, modifier) == (1, 6, 0)

    nb, sides, modifier = RollParser.parse('2d6+3')
    assert (nb, sides, modifier) == (2, 6, 3)

    nb, sides, modifier = RollParser.parse('2d6-1')
    assert (nb, sides, modifier) == (2, 6, -1)

    nb, sides, modifier = RollParser.parse('2d6+0')
    assert (nb, sides, modifier) == (2, 6, 0)
Exemple #6
0
def test_tools():
    nb, sides, modifier = RollParser.parse('2d6')
    assert (nb, sides, modifier) == (2, 6, 0)

    nb, sides, modifier = RollParser.parse('2d')
    assert (nb, sides, modifier) == (2, 6, 0)

    nb, sides, modifier = RollParser.parse('d6')
    assert (nb, sides, modifier) == (1, 6, 0)

    nb, sides, modifier = RollParser.parse('2d6+3')
    assert (nb, sides, modifier) == (2, 6, 3)

    nb, sides, modifier = RollParser.parse('2d6-1')
    assert (nb, sides, modifier) == (2, 6, -1)

    nb, sides, modifier = RollParser.parse('2d6+0')
    assert (nb, sides, modifier) == (2, 6, 0)
Exemple #7
0
def test_tools_tricks():
    nb, sides, modifier = RollParser.parse('0d6')
    assert (nb, sides, modifier) == (0, 6, 0)

    nb, sides, modifier = RollParser.parse('0d0')
    assert (nb, sides, modifier) == (0, 0, 0)
def test_too_many_sides():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('1d{}'.format(MAX_SIDES+1))
def test_d1():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('1d1')
def test_too_many_dice():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('{}d6'.format(MAX_DICE_NUMBER+1))
def test_0d():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('0d6')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('0d0')
Exemple #12
0
def test_too_many_sides():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('1d{}'.format(MAX_SIDES + 1))
Exemple #13
0
def test_d1():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('1d1')
Exemple #14
0
def test_too_many_dice():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('{}d6'.format(MAX_DICE_NUMBER + 1))
Exemple #15
0
def test_0d():
    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('0d6')

    with pytest.raises(BadlyFormedExpression):
        RollParser.parse('0d0')