예제 #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)
예제 #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)
예제 #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
예제 #4
0
def test_ctor_maxvalue_not_int():
    with pytest.raises(DefinitionError):
        FloatType(maxValue="test")
예제 #5
0
def test_validate_not_float():
    with pytest.raises(ValidationError):
        FloatType().validate("test")
예제 #6
0
def test_ctor_defaults():
    f = FloatType()

    assert f.minValue == None
    assert f.maxValue == None
예제 #7
0
def test_ctor_maxvalue_less_than_minvalue():
    with pytest.raises(DefinitionError):
        FloatType(minValue=2.0, maxValue=1.0)