|
|
|
|
@ -15,6 +15,7 @@ def example_spec():
|
|
|
|
|
confspec.add_spec("float_a", FloatSpec(-4, 4, helptext="Float A"))
|
|
|
|
|
confspec.add_spec("floatlist_a", ListSpec(FloatSpec(-4, 4, "Float A")))
|
|
|
|
|
confspec.add_spec("string_a", StringSpec(helptext="String A"))
|
|
|
|
|
confspec.add_spec("string_a_blank", StringSpec(allowempty=True, helptext="String A Blank"))
|
|
|
|
|
confspec.add_spec("stringlist_a", ListSpec(StringSpec(), helptext="String List A"))
|
|
|
|
|
|
|
|
|
|
confdictspec = confspec.add_spec("dict_a", DictSpec(helptext="Dict A"))
|
|
|
|
|
@ -42,6 +43,7 @@ def example_values():
|
|
|
|
|
'float_a': 1.5,
|
|
|
|
|
'floatlist_a': [1.2, 2.1, 3.7, 2.8],
|
|
|
|
|
'string_a': 'sometext',
|
|
|
|
|
'string_a_blank': '',
|
|
|
|
|
'stringlist_a': ['somemoretext', 'yetmoretext'],
|
|
|
|
|
'dict_a': {
|
|
|
|
|
'bool_b': False,
|
|
|
|
|
@ -100,6 +102,8 @@ def test_invalid_string():
|
|
|
|
|
spec.validate(1)
|
|
|
|
|
with pytest.raises(InvalidConfigError, match="value must be a string"):
|
|
|
|
|
spec.validate(None)
|
|
|
|
|
with pytest.raises(InvalidConfigError, match="value cannot be a blank string"):
|
|
|
|
|
spec.validate("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_dict_optional():
|
|
|
|
|
|