None and [] are both possible
This commit is contained in:
@ -25,7 +25,6 @@ def make_description():
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
#____________________________________________________________
|
||||
# change with __setattr__
|
||||
def test_attribute_access():
|
||||
@ -36,7 +35,13 @@ def test_attribute_access():
|
||||
# let's try to change it again
|
||||
config.string = "foo"
|
||||
assert config.string == "foo"
|
||||
# raises(ConflictConfigError, 'config.string = "bar"')
|
||||
|
||||
def test_setitem():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = ["foo", "eggs"]
|
||||
|
||||
|
||||
def test_reset():
|
||||
"if value is None, resets to default owner"
|
||||
@ -50,6 +55,20 @@ def test_reset():
|
||||
assert config.string == 'string'
|
||||
assert config._cfgimpl_value_owners['string'] == 'default'
|
||||
|
||||
def test_reset_with_multi():
|
||||
s = StrOption("string", "", default=["string"], default_multi="string" , multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = []
|
||||
assert config.string == ["string"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['default']
|
||||
config.string = ["eggs", "spam", "foo"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['user', 'user', 'user']
|
||||
config.string = []
|
||||
assert config.string == ["string"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['default']
|
||||
raises(ConfigError, "config.string = None")
|
||||
|
||||
def test_idontexist():
|
||||
descr = make_description()
|
||||
cfg = Config(descr)
|
||||
|
Reference in New Issue
Block a user