# HG changeset patch # User Franz Glasner # Date 1556915166 -7200 # Node ID 0b855758ba082a47e40443e59e38bbe119610a5e # Parent 7865f28038a4e82a7b265edc7b23d566b80d03ca An additional TOML-related unittest (types) diff -r 7865f28038a4 -r 0b855758ba08 CHANGES.txt --- a/CHANGES.txt Fri May 03 22:01:23 2019 +0200 +++ b/CHANGES.txt Fri May 03 22:26:06 2019 +0200 @@ -55,7 +55,8 @@ .. change:: :tags: feature - Handle TOML style configuration files also. + Added support for TOML style configuration files. This needs + the external package :py:mod:`toml` (from "uiri/toml"). .. changelog:: @@ -65,7 +66,7 @@ .. change:: :tags: breaking, feature - Reimplement :py:func:`configmix.safe_merge` do to a deepcopy of all + Reimplemented :py:func:`configmix.safe_merge` do to a deepcopy of all source configurations when merging. Previously is was sort of a shallow copy. diff -r 7865f28038a4 -r 0b855758ba08 tests/data/conf1.toml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/data/conf1.toml Fri May 03 22:26:06 2019 +0200 @@ -0,0 +1,11 @@ +# -*- coding: utf-8; -*- + +__comment1 = "Comment 1" +key1 = "the value" +key2 = 2 +key3 = 5.7 +key4 = true +key5 = false +key6 = 0o377 +__comment2 = "Comment no 2" +key7 = "Umlaute: ÄÖÜäöüß" diff -r 7865f28038a4 -r 0b855758ba08 tests/test.py --- a/tests/test.py Fri May 03 22:01:23 2019 +0200 +++ b/tests/test.py Fri May 03 22:26:06 2019 +0200 @@ -76,6 +76,11 @@ self.__check_types(cfg) self.__check_comment(cfg) + def test01_toml_types(self): + cfg = configmix.toml.load(os.path.join(TESTDATADIR, "conf1.toml")) + self.__check_types(cfg) + self.__check_comment(cfg) + def test02_py_types(self): cfg = configmix.py.load(os.path.join(TESTDATADIR, "conf1.py")) self.__check_types(cfg) @@ -274,7 +279,8 @@ cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), os.path.join(TESTDATADIR, "conf21.yml"), os.path.join(TESTDATADIR, "conf22.ini"), - os.path.join(TESTDATADIR, "conf23.json")) + os.path.join(TESTDATADIR, "conf23.json"), + os.path.join(TESTDATADIR, "conf24.toml")) def _c(name): def _f(): @@ -291,7 +297,8 @@ cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"), os.path.join(TESTDATADIR, "conf21.yml"), os.path.join(TESTDATADIR, "conf22.ini"), - os.path.join(TESTDATADIR, "conf23.json")) + os.path.join(TESTDATADIR, "conf23.json"), + os.path.join(TESTDATADIR, "conf24.toml")) def _check(d): for k, v in d.items():