Mercurial > hgrepos > Python > libs > ConfigMix
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 702:58dc57bed012 | 703:193a616e0b3c |
|---|---|
| 2400 self.assertRaises( | 2400 self.assertRaises( |
| 2401 KeyError, | 2401 KeyError, |
| 2402 cfg.getvar, | 2402 cfg.getvar, |
| 2403 u("intl.cache")) | 2403 u("intl.cache")) |
| 2404 | 2404 |
| 2405 def test_global_filter_wrong_syntax(self): | |
| 2406 cfg = configmix.load() | |
| 2407 try: | |
| 2408 y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|None}}") | |
| 2409 except ValueError: | |
| 2410 pass | |
| 2411 else: | |
| 2412 self.fail("`ValueError' should have been raised") | |
| 2413 | |
| 2414 def test_global_filter_None(self): | |
| 2415 cfg = configmix.load() | |
| 2416 y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|None|}}") | |
| 2417 self.assertTrue(y is None) | |
| 2418 | |
| 2419 def test_global_filter_empty(self): | |
| 2420 cfg = configmix.load() | |
| 2421 y = getattr(cfg, self.interpolate_meth)(u"{{|{{not-existing}}|Empty|}}") | |
| 2422 self.assertEqual(u(""), y) | |
| 2423 | |
| 2424 def test_global_filter_upper(self): | |
| 2425 cfg1 = { | |
| 2426 u("key-1"): u("value for key-1") | |
| 2427 } | |
| 2428 cfg = cfg = configmix.config.Configuration(cfg1) | |
| 2429 y = getattr(cfg, self.interpolate_meth)(u"{{|pre_{{key-1}}_post|upper|}}") | |
| 2430 self.assertEqual(u("PRE_VALUE FOR KEY-1_POST"), y) | |
| 2431 | |
| 2405 | 2432 |
| 2406 class T09Parser(_TParserMixin, unittest.TestCase): | 2433 class T09Parser(_TParserMixin, unittest.TestCase): |
| 2407 | 2434 |
| 2408 def setUp(self): | 2435 def setUp(self): |
| 2409 self.unquote = configmix.config.py_unquote | 2436 self.unquote = configmix.config.py_unquote |
