comparison tests/test.py @ 412:816327e178b0

Provide coercing methods for the jailed configuration: getintXXX(), getboolXXX(), getfloatXXX() and friends. This is done be refactoring Configuration and putting the coercing methods into a common mixin.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 20 Nov 2021 13:52:08 +0100
parents 1bec7f5fafe8
children 2abde0d3c735
comparison
equal deleted inserted replaced
411:3c95faa91dad 412:816327e178b0
1429 jcfg2) 1429 jcfg2)
1430 1430
1431 # base is not because rebind() failed 1431 # base is not because rebind() failed
1432 self.assertTrue(cfg is jcfg1.base) 1432 self.assertTrue(cfg is jcfg1.base)
1433 1433
1434 def test_getbool(self):
1435 cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py"))
1436 jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2"))
1437
1438 self.assertFalse(jcfg.getboolvar_s(u"key6"))
1439 self.assertEqual(u"off", jcfg.getvarl_s(u"key6"))
1440 self.assertTrue(jcfg.getvar_s(u"key6"))
1441
1434 1442
1435 if __name__ == "__main__": 1443 if __name__ == "__main__":
1436 unittest.main() 1444 unittest.main()