works on sqlalchemy storage
This commit is contained in:
@ -7,6 +7,8 @@ from tiramisu.option import BoolOption, IntOption, StrOption, OptionDescription,
|
||||
import weakref
|
||||
|
||||
|
||||
IS_DEREFABLE = True
|
||||
|
||||
def test_deref_storage():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
@ -44,16 +46,23 @@ def test_deref_config():
|
||||
|
||||
|
||||
def test_deref_option():
|
||||
global IS_DEREFABLE
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
w = weakref.ref(b)
|
||||
del(b)
|
||||
assert w() is not None
|
||||
try:
|
||||
assert w() is not None
|
||||
except AssertionError:
|
||||
IS_DEREFABLE = False
|
||||
return
|
||||
del(o)
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_optiondescription():
|
||||
if not IS_DEREFABLE:
|
||||
return
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
w = weakref.ref(o)
|
||||
@ -64,6 +73,8 @@ def test_deref_optiondescription():
|
||||
|
||||
|
||||
def test_deref_option_cache():
|
||||
if not IS_DEREFABLE:
|
||||
return
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
o.impl_build_cache_option()
|
||||
@ -86,6 +97,8 @@ def test_deref_optiondescription_cache():
|
||||
|
||||
|
||||
def test_deref_option_config():
|
||||
if not IS_DEREFABLE:
|
||||
return
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
c = Config(o)
|
||||
|
@ -27,7 +27,7 @@ def return_dynval(suffix, value='val'):
|
||||
|
||||
|
||||
def return_list2(suffix):
|
||||
return [suffix, 'val2']
|
||||
return [str(suffix), 'val2']
|
||||
|
||||
|
||||
def return_list(val=None):
|
||||
|
@ -17,6 +17,7 @@ def test_symlink_option():
|
||||
descr = OptionDescription("opt", "",
|
||||
[linkopt, OptionDescription("s1", "", [boolopt])])
|
||||
config = Config(descr)
|
||||
assert config.s1.b is False
|
||||
setattr(config, "s1.b", True)
|
||||
setattr(config, "s1.b", False)
|
||||
assert config.s1.b is False
|
||||
|
Reference in New Issue
Block a user