43 lines
2.1 KiB
Python
43 lines
2.1 KiB
Python
|
import autopath
|
||
|
from py.test import raises
|
||
|
|
||
|
from tool import reverse_from_paths
|
||
|
|
||
|
#def make_description():
|
||
|
# gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||
|
# gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||
|
# objspaceoption = ChoiceOption('objspace', 'Object space',
|
||
|
# ['std', 'thunk'], 'std')
|
||
|
# booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||
|
# intoption = IntOption('int', 'Test int option', default=0)
|
||
|
# floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||
|
# stroption = StrOption('str', 'Test string option', default="abc")
|
||
|
# boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||
|
# wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||
|
# wantframework_option = BoolOption('wantframework', 'Test requires',
|
||
|
# default=False)
|
||
|
#
|
||
|
# gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||
|
# descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
||
|
# wantref_option, stroption,
|
||
|
# wantframework_option,
|
||
|
# intoption, boolop])
|
||
|
# return descr
|
||
|
|
||
|
def test_rebuild():
|
||
|
# pouvoir faire une comparaison avec equal
|
||
|
d = {"s1.s2.s3.s4.a": True, "int": 43, "s2.b":True, "s3.c": True, "s3.d":[1,2,3]}
|
||
|
cfg = reverse_from_paths(d)
|
||
|
assert cfg.s1.s2.s3.s4.a == True
|
||
|
assert cfg.int == 43
|
||
|
assert cfg.s2.b == True
|
||
|
assert cfg.s3.c == True
|
||
|
assert cfg.s3.d == [1,2,3]
|
||
|
|
||
|
# assert config.getpaths() == ['gc.name', 'gc.dummy', 'gc.float', 'bool',
|
||
|
# 'objspace', 'wantref', 'str', 'wantframework',
|
||
|
# 'int', 'boolop']
|
||
|
|
||
|
# assert config.getpaths(include_groups=False) == ['gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||
|
# assert config.getpaths(include_groups=True) == ['gc', 'gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|