Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 122:21d92ff8cf31
Begin the handling of JSON-style configuration files
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Wed, 04 Apr 2018 09:45:29 +0200 |
| parents | ba5970a2dcef |
| children | 5b62d2c0e5a8 |
line wrap: on
line diff
--- a/tests/test.py Fri Mar 30 08:48:25 2018 +0200 +++ b/tests/test.py Wed Apr 04 09:45:29 2018 +0200 @@ -14,6 +14,7 @@ import configmix import configmix.ini import configmix.yaml +import configmix.json import configmix.py from configmix.compat import u @@ -67,29 +68,33 @@ cfg = configmix.yaml.safe_load(f) self.__check_types(cfg) - def test04_py_export_all(self): + def test04_json_types(self): + cfg = configmix.json.load(os.path.join(TESTDATADIR, "conf1.json")) + self.__check_types(cfg) + + def test05_py_export_all(self): # When __all__ is given only it's keys are exported cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf2.py")) self.assertEqual(u("the next value"), cfg.get("key1")) self.assertTrue(isinstance(cfg.get("key1"), type(u('')))) self.assertTrue(cfg.get("key2") is None) - def test05_py_hide_private(self): + def test06_py_hide_private(self): # When no __all__ is given all symbols with leading "_" are hidden cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf3.py")) self.assertEqual(u("the next value "), cfg.get("key1")) self.assertTrue(isinstance(cfg.get("key1"), type(u('')))) self.assertTrue(cfg.get("_key2") is None) - def test06_ini_tree(self): + def test07_ini_tree(self): cfg = configmix.ini.load(os.path.join(TESTDATADIR, "conf10.ini")) self.__check_tree(cfg) - def test07_py_tree(self): + def test08_py_tree(self): cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf10.py")) self.__check_tree(cfg) - def test08_yaml_tree(self): + def test09_yaml_tree(self): with io.open(os.path.join(TESTDATADIR, "conf10.yml"), "rt", encoding="utf-8") as f: cfg = configmix.yaml.safe_load(f)
