Mercurial > hgrepos > Python > libs > ConfigMix
changeset 109:057d87d030f1
Test replacing lists by strings and replacing strings by lists
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Sat, 24 Mar 2018 16:04:52 +0100 |
| parents | 2196362c0467 |
| children | 29cf359ddf4d |
| files | tests/data/conf20.yml tests/data/conf21.yml tests/test.py |
| diffstat | 3 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/data/conf20.yml Sat Mar 24 15:35:10 2018 +0100 +++ b/tests/data/conf20.yml Sat Mar 24 16:04:52 2018 +0100 @@ -88,3 +88,12 @@ profile_dir: '{{tmpdir}}/profiler' #sort_by: ['time', 'calls'] #restrictions=(), + +test: + List: + - 0 + - 1 + - 2 + - 3 + + Str: a string
--- a/tests/data/conf21.yml Sat Mar 24 15:35:10 2018 +0100 +++ b/tests/data/conf21.yml Sat Mar 24 16:04:52 2018 +0100 @@ -18,3 +18,11 @@ locinfo: ro: hostname: anotherhost + +test: + List: not a list any more + + Str: + - 0 + - 1 + - 2
--- a/tests/test.py Sat Mar 24 15:35:10 2018 +0100 +++ b/tests/test.py Sat Mar 24 16:04:52 2018 +0100 @@ -121,6 +121,12 @@ u("postgresql+psycopg2://the_database_user:the-database-password@anotherhost:5432/my_database_catalog"), url) + self.assertEqual(u("not a list any more"), + cfg.getvar_s("test.List")) + + self.assertEqual(list(range(0, 3)), + cfg.getvar_s("test.Str")) + def test02_load_with_ini(self): cfg = configmix.load( os.path.join(TESTDATADIR, "conf20.yml"),
