Exemplo n.º 1
0
def test_validate_greater_than_max():
    minValue = 2.0
    maxValue = 4.0
    f = FloatType(minValue=minValue, maxValue=maxValue)

    with pytest.raises(ValidationError):
        f.validate(5.0)
Exemplo n.º 2
0
def test_validate_less_than_min():
    minValue = 2.0
    maxValue = 4.0
    f = FloatType(minValue=minValue, maxValue=maxValue)

    with pytest.raises(ValidationError):
        f.validate(1.0)
Exemplo n.º 3
0
def test_ctor():
    minValue = 2.0
    maxValue = 4.0
    f = FloatType(minValue=minValue, maxValue=maxValue)

    assert f.minValue == minValue
    assert f.maxValue == maxValue
Exemplo n.º 4
0
def test_ctor_maxvalue_not_int():
    with pytest.raises(DefinitionError):
        FloatType(maxValue="test")
Exemplo n.º 5
0
def test_validate_not_float():
    with pytest.raises(ValidationError):
        FloatType().validate("test")
Exemplo n.º 6
0
def test_ctor_defaults():
    f = FloatType()

    assert f.minValue == None
    assert f.maxValue == None
Exemplo n.º 7
0
def test_ctor_maxvalue_less_than_minvalue():
    with pytest.raises(DefinitionError):
        FloatType(minValue=2.0, maxValue=1.0)