to_dict improvment and add display_name parameter to change impl_get_display_name function

This commit is contained in:
2019-07-26 08:54:01 +02:00
parent 35ef218c9c
commit 34d71901d0
9 changed files with 167 additions and 99 deletions

View File

@ -565,7 +565,7 @@ def test_mandatory_warnings_validate_empty():
cfg = Config(descr)
cfg.option('str').value.set('')
cfg.property.read_only()
assert list(cfg.value.mandatory()) == ['str', 'str1', 'str3', 'unicode1']
assert list(cfg.value.mandatory()) == ['str', 'str1', 'str3']
def test_mandatory_warnings_requires():

View File

@ -180,10 +180,17 @@ def test_consistency_not_equal_many_opts(config_type):
#
cfg.option('a').value.set(1)
raises(ValueError, "cfg.option('b').value.set(1)")
assert cfg.option('b').value.get() == None
#
cfg.option('b').value.set(2)
raises(ValueError, "cfg.option('f').value.set(2)")
assert cfg.option('f').value.get() is None
assert cfg.option('a').value.get() == 1
assert cfg.option('b').value.get() == 2
raises(ValueError, "cfg.option('f').value.set(1)")
assert cfg.option('f').value.get() is None
assert cfg.option('a').value.get() == 1
assert cfg.option('b').value.get() == 2
#
cfg.option('d').value.set(3)
raises(ValueError, "cfg.option('f').value.set(3)")

View File

@ -1,4 +1,4 @@
from .autopath import do_autopath
1rom .autopath import do_autopath
do_autopath()
from .config import config_type, get_config
@ -127,6 +127,14 @@ def test_validator(config_type):
cfg.option('opt2').value.set('val')
assert len(w) == 1
assert str(w[0].message) == msg
with warnings.catch_warnings(record=True) as w:
cfg.option('opt2').value.get()
assert len(w) == 1
assert str(w[0].message) == msg
with warnings.catch_warnings(record=True) as w:
cfg.option('opt2').value.get()
assert len(w) == 1
assert str(w[0].message) == msg
def test_validator_params(config_type):