Mercurial > hgrepos > Python > libs > ConfigMix
comparison tests/test.py @ 356:a5c792074ec9
Unittest to check "None" and "Empty" filters for existing values: they just pass through unchanged
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 24 Jun 2021 20:52:21 +0200 |
| parents | 260354e9a7f9 |
| children | 1941f0188e81 |
comparison
equal
deleted
inserted
replaced
| 355:260354e9a7f9 | 356:a5c792074ec9 |
|---|---|
| 420 def test10_Empty_filtersingle(self): | 420 def test10_Empty_filtersingle(self): |
| 421 cfg = self._load() | 421 cfg = self._load() |
| 422 x = cfg.expand_variable("{{non-existing|Empty}}") | 422 x = cfg.expand_variable("{{non-existing|Empty}}") |
| 423 self.assertEqual("", x) | 423 self.assertEqual("", x) |
| 424 | 424 |
| 425 def test11_None_filter_pass_through(self): | |
| 426 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), | |
| 427 os.path.join(TESTDATADIR, "conf21.yml"), | |
| 428 os.path.join(TESTDATADIR, "conf22.ini"), | |
| 429 os.path.join(TESTDATADIR, "conf23.json"), | |
| 430 os.path.join(TESTDATADIR, "conf24.toml")) | |
| 431 x = cfg.expand_variable("{{intl.cache.items|None}}") | |
| 432 self.assertEqual(10, x) | |
| 433 | |
| 434 def test12_Empty_filter_pass_through(self): | |
| 435 cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), | |
| 436 os.path.join(TESTDATADIR, "conf21.yml"), | |
| 437 os.path.join(TESTDATADIR, "conf22.ini"), | |
| 438 os.path.join(TESTDATADIR, "conf23.json"), | |
| 439 os.path.join(TESTDATADIR, "conf24.toml")) | |
| 440 x = cfg.expand_variable("{{intl.cache.items|Empty}}") | |
| 441 self.assertEqual(10, x) | |
| 442 | |
| 425 | 443 |
| 426 class T02LoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase): | 444 class T02LoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase): |
| 427 | 445 |
| 428 def setUp(self): | 446 def setUp(self): |
| 429 self._load = configmix.load | 447 self._load = configmix.load |
