예제 #1
0
def test_nullable():
    props.Regex("[az]+", nullable=True).load(None)
예제 #2
0
def test_validates():
    props.Regex("[az]+").load("abc")
예제 #3
0
def test_default():
    assert props.Regex("[az]+", default="abcde").load(None) == "abcde"
예제 #4
0
def test_invalid_string():
    with pytest.raises(props.PropertyValidationError):
        props.Regex("[az]+").load("ABC")
예제 #5
0
def test_wrong_type():
    with pytest.raises(props.PropertyValidationError):
        props.Regex("[az]+").load(12345)
예제 #6
0
def test_not_nullable():
    with pytest.raises(props.PropertyValidationError):
        props.Regex("[az]+").load(None)