Пример #1
0
 def test_unknown_types(self):
     conf, missing = _parse_config(yaml.safe_load(SUB_WITH_UNKNOWN))
     self.assertDictEqual(
         conf,
         {
             "one": "two",
             "buckle": "my :foo:",
             "three": 4,
             "shut": {
                 "the": 3.14
             }
         },
     )
     self.assertSetEqual(missing, set())
Пример #2
0
 def test_shallow_substitution(self):
     conf, _ = _parse_config(yaml.safe_load(SUB_SHALLOW))
     self.assertDictEqual(
         conf,
         {
             "dict": {
                 "one": "two",
                 "three": "four"
             },
             "list": [{
                 "a": "b",
                 "b": "c"
             }, {
                 "a": "d",
                 "b": "e"
             }],
             "one": ":foo:",
         },
     )
Пример #3
0
 def test_no_substitution(self):
     conf, _ = _parse_config(yaml.safe_load(NO_SUB))
     self.assertDictEqual(
         conf,
         {
             "dict": {
                 "one": "two",
                 "three": "four"
             },
             "list": [{
                 "a": "b",
                 "b": "c"
             }, {
                 "a": "d",
                 "b": "e"
             }],
             "one": "foo",
         },
     )
Пример #4
0
 def test_multi_substitution(self):
     conf, _ = _parse_config(yaml.safe_load(SUB_MULTI))
     self.assertDictEqual(
         conf,
         {
             "dict": {
                 "one": " :foo:-{$}Xx:bar:",
                 "three": "four"
             },
             "list": [{
                 "a": "b",
                 "b": ":foo:"
             }, {
                 "a": "d",
                 "b": "e"
             }],
             "one": "foo",
         },
     )
Пример #5
0
 def test_missing_none(self):
     conf, missing = _parse_config(yaml.safe_load(SUB_MULTI))
     self.assertDictEqual(
         conf,
         {
             "dict": {
                 "one": " :foo:-{$}Xx:bar:",
                 "three": "four"
             },
             "list": [{
                 "a": "b",
                 "b": ":foo:"
             }, {
                 "a": "d",
                 "b": "e"
             }],
             "one": "foo",
         },
     )
     self.assertSetEqual(missing, set())
Пример #6
0
 def test_missing_all(self):
     conf, missing = _parse_config(yaml.safe_load(SUB_MULTI))
     self.assertDictEqual(
         conf,
         {
             "dict": {
                 "one": " -{$}Xx",
                 "three": "four"
             },
             "list": [{
                 "a": "b",
                 "b": ""
             }, {
                 "a": "d",
                 "b": "e"
             }],
             "one": "foo",
         },
     )
     self.assertSetEqual(missing, {"BAR", "FOO"})