Пример #1
0
def validator_extra_aok():
    return FlaglistValidator(
        "prop",
        "parent",
        flags=FLAGS,
        extras=EXTRAS,
        array_ok=True,
    )
def validator_extra_aok():
    return FlaglistValidator(
        "prop",
        "parent",
        flags=["lines", "markers", "text"],
        extras=["none", "all"],
        array_ok=True,
    )
Пример #3
0
def validator_extra():
    return FlaglistValidator("prop", "parent", flags=FLAGS, extras=EXTRAS)
Пример #4
0
def validator(request):
    # Validator with or without extras
    return FlaglistValidator("prop",
                             "parent",
                             flags=FLAGS,
                             extras=request.param)
Пример #5
0
def validator(request):
    # Validator with or without extras
    return FlaglistValidator('prop',
                             'parent',
                             flags=['lines', 'markers', 'text'],
                             extras=request.param)
Пример #6
0
def validator_extra_aok():
    return FlaglistValidator('prop',
                             'parent',
                             flags=['lines', 'markers', 'text'],
                             extras=['none', 'all'],
                             array_ok=True)
def validator(request):
    # Validator with or without extras
    return FlaglistValidator("prop",
                             "parent",
                             flags=["lines", "markers", "text"],
                             extras=request.param)
Пример #8
0
def test_acceptance_extra(extra, validator_extra: FlaglistValidator):
    assert validator_extra.validate_coerce(extra) == extra
def validator_extra():
    return FlaglistValidator("prop",
                             "parent",
                             flags=["lines", "markers", "text"],
                             extras=["none", "all"])
Пример #10
0
def test_acceptance(flaglist, validator: FlaglistValidator):
    assert validator.validate_coerce(flaglist) == flaglist
Пример #11
0
def test_rejection_val(val, validator: FlaglistValidator):
    with pytest.raises(ValueError) as validation_failure:
        validator.validate_coerce(val)

    assert 'Invalid value' in str(validation_failure.value)
Пример #12
0
def test_rejection_aok_element_val(val, validator_extra_aok: FlaglistValidator):
    with pytest.raises(ValueError) as validation_failure:
        validator_extra_aok.validate_coerce(val)

    assert 'Invalid element(s)' in str(validation_failure.value)
Пример #13
0
def test_acceptance_aok_list_flaglist(val, validator_extra_aok: FlaglistValidator):
    assert np.array_equal(validator_extra_aok.validate_coerce(val),
                          np.array(val, dtype='unicode'))
Пример #14
0
def test_acceptance_aok_scalarlist_flaglist(flaglist, validator_extra_aok: FlaglistValidator):
    assert np.array_equal(validator_extra_aok.validate_coerce([flaglist]),
                          np.array([flaglist], dtype='unicode'))
Пример #15
0
def test_acceptance_aok_scalar_extra(extra, validator_extra_aok: FlaglistValidator):
    assert validator_extra_aok.validate_coerce(extra) == extra
Пример #16
0
def test_acceptance_aok_scalar_flaglist(flaglist, validator_extra_aok: FlaglistValidator):
    assert validator_extra_aok.validate_coerce(flaglist) == flaglist