Exemplo n.º 1
0
def test_constant_valid_1():
    """Should be ok"""

    test_constant = Constant(value=1)

    test_constant.validate(1)

    assert test_constant.default == 1
Exemplo n.º 2
0
def test_constant_valid_1():
    """Should be ok"""

    test_constant = Constant(value=1)

    test_constant.validate(1)

    assert test_constant.default == 1
Exemplo n.º 3
0
def test_constant_invalid_1():
    """2 is invalid"""

    test_constant = Constant(value=1)

    with assert_raises(InvalidPropertyError) as cm:
        test_constant.validate(2)

    assert cm.exception.error == 'invalid'
Exemplo n.º 4
0
def test_constant_invalid_1():
    """2 is invalid"""

    test_constant = Constant(value=1)

    with assert_raises(InvalidPropertyError) as cm:
        test_constant.validate(2)

    assert cm.exception.error == 'invalid'