Mercurial > hgrepos > Python > libs > ConfigMix
comparison tests/test.py @ 198:0b855758ba08
An additional TOML-related unittest (types)
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 03 May 2019 22:26:06 +0200 |
| parents | 13527d70e9e3 |
| children | f5011eec3b6e |
comparison
equal
deleted
inserted
replaced
| 197:7865f28038a4 | 198:0b855758ba08 |
|---|---|
| 74 def test01_ini_types(self): | 74 def test01_ini_types(self): |
| 75 cfg = configmix.ini.load(os.path.join(TESTDATADIR, "conf1.ini")) | 75 cfg = configmix.ini.load(os.path.join(TESTDATADIR, "conf1.ini")) |
| 76 self.__check_types(cfg) | 76 self.__check_types(cfg) |
| 77 self.__check_comment(cfg) | 77 self.__check_comment(cfg) |
| 78 | 78 |
| 79 def test01_toml_types(self): | |
| 80 cfg = configmix.toml.load(os.path.join(TESTDATADIR, "conf1.toml")) | |
| 81 self.__check_types(cfg) | |
| 82 self.__check_comment(cfg) | |
| 83 | |
| 79 def test02_py_types(self): | 84 def test02_py_types(self): |
| 80 cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf1.py")) | 85 cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf1.py")) |
| 81 self.__check_types(cfg) | 86 self.__check_types(cfg) |
| 82 self.__check_no_comment(cfg) | 87 self.__check_no_comment(cfg) |
| 83 | 88 |
| 272 | 277 |
| 273 def test05_comments(self): | 278 def test05_comments(self): |
| 274 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), | 279 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), |
| 275 os.path.join(TESTDATADIR, "conf21.yml"), | 280 os.path.join(TESTDATADIR, "conf21.yml"), |
| 276 os.path.join(TESTDATADIR, "conf22.ini"), | 281 os.path.join(TESTDATADIR, "conf22.ini"), |
| 277 os.path.join(TESTDATADIR, "conf23.json")) | 282 os.path.join(TESTDATADIR, "conf23.json"), |
| 283 os.path.join(TESTDATADIR, "conf24.toml")) | |
| 278 | 284 |
| 279 def _c(name): | 285 def _c(name): |
| 280 def _f(): | 286 def _f(): |
| 281 cfg.getvar_s(name) | 287 cfg.getvar_s(name) |
| 282 return _f | 288 return _f |
| 289 | 295 |
| 290 def test06_check_all_comments(self): | 296 def test06_check_all_comments(self): |
| 291 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), | 297 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), |
| 292 os.path.join(TESTDATADIR, "conf21.yml"), | 298 os.path.join(TESTDATADIR, "conf21.yml"), |
| 293 os.path.join(TESTDATADIR, "conf22.ini"), | 299 os.path.join(TESTDATADIR, "conf22.ini"), |
| 294 os.path.join(TESTDATADIR, "conf23.json")) | 300 os.path.join(TESTDATADIR, "conf23.json"), |
| 301 os.path.join(TESTDATADIR, "conf24.toml")) | |
| 295 | 302 |
| 296 def _check(d): | 303 def _check(d): |
| 297 for k, v in d.items(): | 304 for k, v in d.items(): |
| 298 self.assertFalse(configmix._is_comment(k)) | 305 self.assertFalse(configmix._is_comment(k)) |
| 299 if isinstance(v, dict): | 306 if isinstance(v, dict): |
