Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 467:9fcdc42a0457
len-support for jailed configurations: implement a proper __len__() method
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 15 Dec 2021 22:59:05 +0100 |
| parents | 5de1a6f213a5 |
| children | 5a88c514d4e0 |
line wrap: on
line diff
--- a/tests/test.py Wed Dec 15 09:34:16 2021 +0100 +++ b/tests/test.py Wed Dec 15 22:59:05 2021 +0100 @@ -1738,21 +1738,25 @@ cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2", u"key7")) self.assertFalse(jcfg) + self.assertEqual(0, len(jcfg)) def test_boolean_context_list_true(self): cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2", u"key8")) self.assertTrue(jcfg) + self.assertEqual(3, len(jcfg)) def test_boolean_context_dict_false(self): cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2", u"key9")) self.assertFalse(jcfg) + self.assertEqual(0, len(jcfg)) def test_boolean_context_dict_true(self): cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py")) jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2")) self.assertTrue(jcfg) + self.assertEqual(6, len(jcfg)) def test_list_by_index(self): cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py"))
