attribute in Option now starts with '_'
add ValidateError add consistancies in Option remove byattr in find
This commit is contained in:
@ -160,9 +160,9 @@ def test_find_in_config():
|
||||
assert conf.find_first(bytype=BoolOption, byname='dummy') == conf.unwrap_from_path('gc.dummy')
|
||||
assert conf.find(byvalue=False, byname='dummy') == [conf.unwrap_from_path('gc.dummy')]
|
||||
assert conf.find_first(byvalue=False, byname='dummy') == conf.unwrap_from_path('gc.dummy')
|
||||
# byattrs
|
||||
assert conf.find_first(byattrs= dict(default=2.3)) == conf.unwrap_from_path('gc.float')
|
||||
assert conf.find_first(byvalue=False, byname='dummy', byattrs=dict(default=False)) == conf.unwrap_from_path('gc.dummy')
|
||||
## byattrs
|
||||
#assert conf.find_first(byattrs= dict(default=2.3)) == conf.unwrap_from_path('gc.float')
|
||||
#assert conf.find_first(byvalue=False, byname='dummy', byattrs=dict(default=False)) == conf.unwrap_from_path('gc.dummy')
|
||||
|
||||
def test_does_not_find_in_config():
|
||||
descr = make_description()
|
||||
|
@ -69,7 +69,7 @@ def test_reset_with_multi():
|
||||
config.unwrap_from_path("string").reset(config)
|
||||
# assert config.string == ["string"]
|
||||
assert config.cfgimpl_get_values().getowner(s) == 'default'
|
||||
raises(ConfigError, "config.string = None")
|
||||
raises(ValidateError, "config.string = None")
|
||||
|
||||
def test_default_with_multi():
|
||||
"default with multi is a list"
|
||||
@ -230,7 +230,7 @@ def test_multi_with_bool():
|
||||
s = BoolOption("bool", "", default=[False], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert descr.bool.multi == True
|
||||
assert descr.bool.is_multi() == True
|
||||
config.bool = [True, False]
|
||||
assert config.cfgimpl_get_values()[s] == [True, False]
|
||||
assert config.bool == [True, False]
|
||||
@ -239,8 +239,8 @@ def test_multi_with_bool_two():
|
||||
s = BoolOption("bool", "", default=[False], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert descr.bool.multi == True
|
||||
raises(ConfigError, "config.bool = True")
|
||||
assert descr.bool.is_multi() == True
|
||||
raises(ValidateError, "config.bool = True")
|
||||
|
||||
def test_choice_access_with_multi():
|
||||
ch = ChoiceOption("t1", "", ("a", "b"), default=["a"], multi=True)
|
||||
|
Reference in New Issue
Block a user