From 613ae47573bb3956627b384215746d6ba9a243ed Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 26 Jul 2019 10:13:45 +0200 Subject: [PATCH] update tests ans version number --- tests/dict/data/choice1_requires.json | 3 +-- tests/dict/data/number1_value.json | 3 +-- .../dict/data/unicode1_leadership_default_value.json | 11 ++++------- tests/dict/data/unicode1_leadership_value.json | 2 +- tests/dict/data/unicode1_leadership_value.updates1 | 9 +++------ tests/dict/data/unicode1_leadership_value.updates3 | 3 +-- tests/dict/data/unicode1_leadership_value.updates4 | 3 +-- tests/dict/data/unicode1_leadership_value.updates5 | 3 +-- tests/dict/data/unicode1_multi_mod_value.json | 2 +- tests/dict/data/unicode1_multi_mod_value.updates1 | 3 +-- .../dict/data/unicode1_multi_not_equal_collapse.json | 8 +++----- tests/dict/data/unicode1_multi_value.json | 5 ++--- tests/dict/data/unicode1_simple_callback.json | 3 +-- tests/dict/data/unicode2_symlink.json | 3 +-- tests/test_option_owner.py | 3 ++- tests/test_option_validator.py | 2 +- tiramisu/__init__.py | 2 +- tiramisu/todict.py | 3 ++- 18 files changed, 28 insertions(+), 43 deletions(-) diff --git a/tests/dict/data/choice1_requires.json b/tests/dict/data/choice1_requires.json index 310582a..fa9d3ca 100644 --- a/tests/dict/data/choice1_requires.json +++ b/tests/dict/data/choice1_requires.json @@ -23,8 +23,7 @@ "model": { "options.choice": { "required": true, - "value": "hide", - "owner": "default" + "value": "hide" }, "options.unicode2": { "display": false, diff --git a/tests/dict/data/number1_value.json b/tests/dict/data/number1_value.json index ba272ea..8c9a6da 100644 --- a/tests/dict/data/number1_value.json +++ b/tests/dict/data/number1_value.json @@ -14,8 +14,7 @@ }, "model": { "options.integer": { - "value": 0, - "owner": "default" + "value": 0 } }, "global": { diff --git a/tests/dict/data/unicode1_leadership_default_value.json b/tests/dict/data/unicode1_leadership_default_value.json index 1869865..36f0dce 100644 --- a/tests/dict/data/unicode1_leadership_default_value.json +++ b/tests/dict/data/unicode1_leadership_default_value.json @@ -6,11 +6,11 @@ "properties": { "options.unicode.unicode": { "type": "string", + "isMulti": true, "value": [ "val1", "val2" ], - "isMulti": true, "title": "Unicode leader" }, "options.unicode.unicode1": { @@ -44,17 +44,14 @@ "value": [ "val1", "val2" - ], - "owner": "default" + ] }, "options.unicode.unicode2": { "0": { - "value": "follower2", - "owner": "default" + "value": "follower2" }, "1": { - "value": "follower2", - "owner": "default" + "value": "follower2" } } }, diff --git a/tests/dict/data/unicode1_leadership_value.json b/tests/dict/data/unicode1_leadership_value.json index 66809f6..000dee4 100644 --- a/tests/dict/data/unicode1_leadership_value.json +++ b/tests/dict/data/unicode1_leadership_value.json @@ -6,11 +6,11 @@ "properties": { "options.unicode.unicode": { "type": "string", + "isMulti": true, "value": [ "val1", "val2" ], - "isMulti": true, "title": "Unicode leader" }, "options.unicode.unicode1": { diff --git a/tests/dict/data/unicode1_leadership_value.updates1 b/tests/dict/data/unicode1_leadership_value.updates1 index 029a459..ccf9807 100644 --- a/tests/dict/data/unicode1_leadership_value.updates1 +++ b/tests/dict/data/unicode1_leadership_value.updates1 @@ -2,10 +2,7 @@ "options.unicode.unicode1", "options.unicode.unicode2", "options.unicode.unicode3"], - "model": {"options.unicode.unicode": {"owner": "default", - "required": true, + "model": {"options.unicode.unicode": {"required": true, "value": ["val1", "val2"]}, - "options.unicode.unicode2": {"0": {"owner": "default", - "value": "follower2"}, - "1": {"owner": "default", - "value": "follower2"}}}} + "options.unicode.unicode2": {"0": {"value": "follower2"}, + "1": {"value": "follower2"}}}} diff --git a/tests/dict/data/unicode1_leadership_value.updates3 b/tests/dict/data/unicode1_leadership_value.updates3 index 143fd34..4608c63 100644 --- a/tests/dict/data/unicode1_leadership_value.updates3 +++ b/tests/dict/data/unicode1_leadership_value.updates3 @@ -11,7 +11,6 @@ "owner": "user"}, "1": {"value": "test", "owner": "user"}, - "2": {"value": "follower2", - "owner": "default"}}, + "2": {"value": "follower2"}}, "options.unicode.unicode3": {"1": {"value": "super", "owner": "user"}}}} diff --git a/tests/dict/data/unicode1_leadership_value.updates4 b/tests/dict/data/unicode1_leadership_value.updates4 index bc286b8..5efa8d1 100644 --- a/tests/dict/data/unicode1_leadership_value.updates4 +++ b/tests/dict/data/unicode1_leadership_value.updates4 @@ -9,8 +9,7 @@ "value": "pas test"}, "1": {"owner": "user", "value": "test"}, - "2": {"owner": "default", - "value": "follower2"}}, + "2": {"value": "follower2"}}, "options.unicode.unicode3": {"1": {"owner": "user", "value": "super"}}}, "updates": ["options.unicode.unicode", "options.unicode.unicode2"]} diff --git a/tests/dict/data/unicode1_leadership_value.updates5 b/tests/dict/data/unicode1_leadership_value.updates5 index 127e7f6..82c0142 100644 --- a/tests/dict/data/unicode1_leadership_value.updates5 +++ b/tests/dict/data/unicode1_leadership_value.updates5 @@ -8,7 +8,6 @@ "owner": "user"}}, "options.unicode.unicode2": {"0": {"value": "pas test", "owner": "user"}, - "1": {"value": "follower2", - "owner": "default"}}, + "1": {"value": "follower2"}}, "options.unicode.unicode3": {"1": {"value": "super", "owner": "user"}}}} diff --git a/tests/dict/data/unicode1_multi_mod_value.json b/tests/dict/data/unicode1_multi_mod_value.json index 1ab7e63..ee8b726 100644 --- a/tests/dict/data/unicode1_multi_mod_value.json +++ b/tests/dict/data/unicode1_multi_mod_value.json @@ -4,11 +4,11 @@ "properties": { "options.unicode": { "type": "string", + "isMulti": true, "value": [ "a", "b" ], - "isMulti": true, "title": "String 1" } }, diff --git a/tests/dict/data/unicode1_multi_mod_value.updates1 b/tests/dict/data/unicode1_multi_mod_value.updates1 index ef1fbb2..238ae6b 100644 --- a/tests/dict/data/unicode1_multi_mod_value.updates1 +++ b/tests/dict/data/unicode1_multi_mod_value.updates1 @@ -1,4 +1,3 @@ {"updates": ["options.unicode"], - "model": {"options.unicode": {"owner": "default", - "required": true, + "model": {"options.unicode": {"required": true, "value": ["a", "b"]}}} diff --git a/tests/dict/data/unicode1_multi_not_equal_collapse.json b/tests/dict/data/unicode1_multi_not_equal_collapse.json index 1fca564..a3cb40d 100644 --- a/tests/dict/data/unicode1_multi_not_equal_collapse.json +++ b/tests/dict/data/unicode1_multi_not_equal_collapse.json @@ -24,11 +24,11 @@ }, "descr2.unicode2_multi": { "type": "string", + "isMulti": true, "value": [ "a", "b" ], - "isMulti": true, "title": "Multi unicode 2" } }, @@ -56,16 +56,14 @@ "required": true }, "descr2.unicode2": { - "value": "a", - "owner": "default" + "value": "a" }, "descr2.unicode2_multi": { "required": true, "value": [ "a", "b" - ], - "owner": "default" + ] }, "descr3.unicode3_multi": { "required": true diff --git a/tests/dict/data/unicode1_multi_value.json b/tests/dict/data/unicode1_multi_value.json index 0becba4..cd1dcbf 100644 --- a/tests/dict/data/unicode1_multi_value.json +++ b/tests/dict/data/unicode1_multi_value.json @@ -4,11 +4,11 @@ "properties": { "options.unicode": { "type": "string", + "isMulti": true, "value": [ "a", "b" ], - "isMulti": true, "title": "String 1" } }, @@ -22,8 +22,7 @@ "value": [ "a", "b" - ], - "owner": "default" + ] } }, "global": { diff --git a/tests/dict/data/unicode1_simple_callback.json b/tests/dict/data/unicode1_simple_callback.json index 0f43a4e..e3c7765 100644 --- a/tests/dict/data/unicode1_simple_callback.json +++ b/tests/dict/data/unicode1_simple_callback.json @@ -14,8 +14,7 @@ }, "model": { "options.unicode1": { - "value": "word", - "owner": "default" + "value": "word" } }, "global": { diff --git a/tests/dict/data/unicode2_symlink.json b/tests/dict/data/unicode2_symlink.json index 02e62da..720869d 100644 --- a/tests/dict/data/unicode2_symlink.json +++ b/tests/dict/data/unicode2_symlink.json @@ -18,8 +18,7 @@ }, "model": { "options.unicode1": { - "value": "test", - "owner": "default" + "value": "test" } }, "global": { diff --git a/tests/test_option_owner.py b/tests/test_option_owner.py index 1ecf214..0a41f26 100644 --- a/tests/test_option_owner.py +++ b/tests/test_option_owner.py @@ -101,7 +101,8 @@ def test_owner_is_not_a_string(config_type): assert cfg.option('dummy').value.get() is False assert cfg.option('dummy').owner.get() == owners.default assert cfg.option('dummy').owner.get() == 'default' - assert isinstance(cfg.option('dummy').owner.get(), owners.Owner) + if config_type == 'tiramisu': + assert isinstance(cfg.option('dummy').owner.get(), owners.Owner) cfg.option('dummy').value.set(True) assert cfg.option('dummy').owner.get() == 'user' diff --git a/tests/test_option_validator.py b/tests/test_option_validator.py index 0dd0daf..aaa06ad 100644 --- a/tests/test_option_validator.py +++ b/tests/test_option_validator.py @@ -1,4 +1,4 @@ -1rom .autopath import do_autopath +from .autopath import do_autopath do_autopath() from .config import config_type, get_config diff --git a/tiramisu/__init__.py b/tiramisu/__init__.py index a36879d..15c6af8 100644 --- a/tiramisu/__init__.py +++ b/tiramisu/__init__.py @@ -45,4 +45,4 @@ allfuncs.extend(all_options) del(all_options) __all__ = tuple(allfuncs) del(allfuncs) -__version__ = "3.0rc8" +__version__ = "3.0rc9" diff --git a/tiramisu/todict.py b/tiramisu/todict.py index c2c0a72..e29cbdf 100644 --- a/tiramisu/todict.py +++ b/tiramisu/todict.py @@ -742,7 +742,8 @@ class TiramisuDict: value = childapi.value.get() if value is not None and value != []: obj['value'] = value - obj['owner'] = childapi.owner.get() + if not childapi.owner.isdefault(): + obj['owner'] = childapi.owner.get() def _get_value_with_exception(self, obj,