Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 703:193a616e0b3c
Begin implementation of filter-only expansions (recursive with respect to expansion)
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 14 Aug 2023 09:31:27 +0200 |
| parents | 3a9d661d33b5 |
| children | 0485a033c95d |
line wrap: on
line diff
--- a/tests/test.py Sun Aug 13 16:14:39 2023 +0200 +++ b/tests/test.py Mon Aug 14 09:31:27 2023 +0200 @@ -2402,6 +2402,33 @@ cfg.getvar, u("intl.cache")) + def test_global_filter_wrong_syntax(self): + cfg = configmix.load() + try: + y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|None}}") + except ValueError: + pass + else: + self.fail("`ValueError' should have been raised") + + def test_global_filter_None(self): + cfg = configmix.load() + y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|None|}}") + self.assertTrue(y is None) + + def test_global_filter_empty(self): + cfg = configmix.load() + y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|Empty|}}") + self.assertEqual(u(""), y) + + def test_global_filter_upper(self): + cfg1 = { + u("key-1"): u("value for key-1") + } + cfg = cfg = configmix.config.Configuration(cfg1) + y = getattr(cfg, self.interpolate_meth)(u"{{|pre_{{key-1}}_post|upper|}}") + self.assertEqual(u("PRE_VALUE FOR KEY-1_POST"), y) + class T09Parser(_TParserMixin, unittest.TestCase):
