Mercurial > hgrepos > Python > libs > ConfigMix
changeset 371:873b9d2ecb0b
Unittests for ".getfirstvar_s()"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 11 Jul 2021 16:39:19 +0200 |
| parents | 18622d265602 |
| children | ac3e3cd6faae |
| files | tests/test.py |
| diffstat | 1 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test.py Sun Jul 11 14:26:42 2021 +0200 +++ b/tests/test.py Sun Jul 11 16:39:19 2021 +0200 @@ -490,6 +490,30 @@ "intl.fallback", default=None)) + def test21_getfirstvar_s_existing(self): + cfg = self._load( + os.path.join(TESTDATADIR, "conf20.yml"), + os.path.join(TESTDATADIR, "conf21.yml")) + self.assertEqual( + os.getcwd()+"/locale", + cfg.getfirstvar_s("intl.non.existing", "intl.localedir")) + self.assertEqual( + os.getcwd()+"/locale", + cfg.getfirstvar_s("intl.localedir", "intl.non.existing")) + + def test22_getfirstvar_s_non_existing(self): + cfg = self._load( + os.path.join(TESTDATADIR, "conf20.yml"), + os.path.join(TESTDATADIR, "conf21.yml")) + self.assertIsNone( + cfg.getfirstvar_s("intl.non.existing", "intl.non.existing2", + default=None)) + self.assertRaises( + KeyError, + cfg.getfirstvar_s, + "intl.non.existing", + "intl.non.existing2") + class T02LoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase):
