test_mod => test_mode2

This commit is contained in:
Emmanuel Garette 2019-03-28 07:53:29 +01:00
parent f47cc02d3e
commit 9da87804c2
2 changed files with 10 additions and 3 deletions

View File

@ -31,6 +31,7 @@ def error_to_str(dico):
return dico return dico
# config.option().value.dict()
def test_dict(): def test_dict():
debug = False debug = False
# debug = True # debug = True
@ -52,6 +53,7 @@ def test_dict():
assert error_to_str(dico) == error_to_str(config.value.dict()) assert error_to_str(dico) == error_to_str(config.value.dict())
# config.option().value.get()
def test_get(): def test_get():
debug = False debug = False
# debug = True # debug = True
@ -78,6 +80,7 @@ def test_get():
assert value == config.option(key).value.get() assert value == config.option(key).value.get()
# config.option().owner.get()
def test_owner(): def test_owner():
debug = False debug = False
# debug = True # debug = True
@ -106,6 +109,7 @@ def test_owner():
assert value == {'null': config.option(key).owner.get()} assert value == {'null': config.option(key).owner.get()}
# config.option().property.get()
def test_prop(): def test_prop():
debug = False debug = False
# debug = True # debug = True
@ -140,10 +144,13 @@ def test_prop():
assert value == props assert value == props
# config.option().property.get(True)
def test_prop2(): def test_prop2():
debug = False debug = False
# debug = True # debug = True
for filename in list_data(): for filename in list_data():
if debug:
print(filename)
with open(filename, 'r') as fh: with open(filename, 'r') as fh:
json = loads(fh.read()) json = loads(fh.read())
config = Config(json) config = Config(json)
@ -186,7 +193,7 @@ def test_info():
def test_mod(): def test_mod():
debug = False debug = False
debug = True # debug = True
i = 0 i = 0
while True: while True:
i += 1 i += 1
@ -227,7 +234,7 @@ def test_mod():
assert dico1 == config.value.dict() assert dico1 == config.value.dict()
def test_mod(): def test_mod2():
debug = False debug = False
# debug = True # debug = True
i = 0 i = 0

View File

@ -244,7 +244,7 @@ class TiramisuOptionValue(_Value):
self._display_warnings(self.path, value, self.schema['type'], self.schema['name']) self._display_warnings(self.path, value, self.schema['type'], self.schema['name'])
return value return value
if self.index is not None: if self.index is not None:
raise APIError(_('index must be only with a follower option, not for "{}"').format(self.path)) raise APIError(_('index must only be set with a follower option, not for "{}"').format(self.path))
value = self.config.get_value(self.path) value = self.config.get_value(self.path)
self._display_warnings(self.path, value, self.schema['type'], self.schema['name']) self._display_warnings(self.path, value, self.schema['type'], self.schema['name'])
return value return value