Example #1
0
def test_require_int_too_high():
    with pytest.raises(template_filters.IntegerTooLarge):
        template_filters.require_int("1", max=0)
Example #2
0
def test_require_int_not_an_int():
    with pytest.raises(template_filters.IntegerRequired):
        template_filters.require_int("abc")
Example #3
0
def test_require_int_too_low():
    with pytest.raises(template_filters.IntegerTooSmall):
        template_filters.require_int("-1", min=0)
Example #4
0
def test_require_int():
    i = template_filters.require_int("1")
    assert i == 1
Example #5
0
def test_require_int_in_range():
    i = template_filters.require_int("1", min=0, max=5)
    assert i == 1
Example #6
0
def test_require_int_too_high():
    with pytest.raises(template_filters.IntegerTooLarge):
        template_filters.require_int("1", max=0)
Example #7
0
def test_require_int_too_low():
    with pytest.raises(template_filters.IntegerTooSmall):
        template_filters.require_int("-1", min=0)
Example #8
0
def test_require_int_not_an_int():
    with pytest.raises(template_filters.IntegerRequired):
        template_filters.require_int("abc")
Example #9
0
def test_require_int_in_range():
    i = template_filters.require_int("1", min=0, max=5)
    assert i == 1
Example #10
0
def test_require_int():
    i = template_filters.require_int("1")
    assert i == 1