when list, return a list
This commit is contained in:
parent
d0f6a4dd31
commit
e3be95a274
|
@ -251,6 +251,18 @@ def test_get_modified_values():
|
|||
assert to_tuple(api.value.exportation()) == (('od.g5', 'od.g6'), (None, None), ('yes', tuple()), ('user', 'user'))
|
||||
|
||||
|
||||
def test_get_modified_values_not_modif():
|
||||
g1 = StrOption('g1', '', multi=True)
|
||||
d1 = OptionDescription('od', '', [g1])
|
||||
root = OptionDescription('root', '', [d1])
|
||||
config = Config(root)
|
||||
api = getapi(config)
|
||||
assert api.option('od.g1').value.get() == []
|
||||
value = api.option('od.g1').value.get()
|
||||
value.append('val')
|
||||
assert api.option('od.g1').value.get() == []
|
||||
|
||||
|
||||
#def test_has_value():
|
||||
# g1 = IntOption('g1', '', 1)
|
||||
# g2 = StrOption('g2', '', 'héhé')
|
||||
|
|
|
@ -115,6 +115,9 @@ class Values(object):
|
|||
value,
|
||||
setting_properties,
|
||||
config_bag.properties)
|
||||
if isinstance(value, list):
|
||||
# return a copy, so value cannot be modified
|
||||
return value.copy()
|
||||
# and return it
|
||||
return value
|
||||
|
||||
|
|
Loading…
Reference in New Issue