예제 #1
0
def data_array_validator(request):
    return DataArrayValidator("prop", "parent")
예제 #2
0
def data_array_validator(request):
    return DataArrayValidator('prop', 'parent')
예제 #3
0
def validator():
    return DataArrayValidator("prop", "parent")
예제 #4
0
def validator():
    return DataArrayValidator('prop', 'parent')
예제 #5
0
def test_rejection(val, validator: DataArrayValidator):
    with pytest.raises(ValueError) as validation_failure:
        validator.validate_coerce(val)

    assert 'Invalid value' in str(validation_failure.value)
예제 #6
0
def test_validator_acceptance_homogeneous(val, validator: DataArrayValidator):
    coerce_val = validator.validate_coerce(val)
    assert isinstance(coerce_val, np.ndarray)
    assert np.array_equal(validator.present(coerce_val), val)
예제 #7
0
def test_validator_acceptance_simple(val, validator: DataArrayValidator):
    coerce_val = validator.validate_coerce(val)
    assert isinstance(coerce_val, list)
    assert validator.present(coerce_val) == tuple(val)