示例#1
0
 def test_flat_multi_prefix(self):
     options = {
         "morpho.options.username": "******",
         "morpho.options.password": "******",
         "morpho.options.length": 23
     }
     prefix, uf_dict = unflatten_dict(options)
     assert prefix == "morpho.options"
     assert uf_dict == {
         "username": "******",
         "password": "******",
         "length": 23
     }
示例#2
0
 def test_flat_prefix(self):
     options = {
         "morpho.username": "******",
         "morpho.password": "******",
         "morpho.length": 13
     }
     prefix, uf_dict = unflatten_dict(options)
     assert prefix == "morpho"
     assert uf_dict == {
         "username": "******",
         "password": "******",
         "length": 13
     }
示例#3
0
 def test_nested_no_prefix(self):
     options = {
         "debug": False,
         "credentials.username": "******",
         "credentials.password": "******"
     }
     prefix, dictionary = unflatten_dict(options)
     assert prefix == None
     assert dictionary == {
         "debug": False,
         "credentials": {
             "username": "******",
             "password": "******"
         }
     }
示例#4
0
 def test_nested_multi_prefix(self):
     options = {
         "morpho.debug": True,
         "morpho.credentials.account.username": "******",
         "morpho.credentials.type": "hash",
         "morpho.not": True
     }
     prefix, dictionary = unflatten_dict(options)
     assert prefix == "morpho"
     assert dictionary == {
         "debug": True,
         "credentials": {
             "account": {
                 "username": "******"
             },
             "type": "hash"
         },
         "not": True
     }
示例#5
0
    def test_flat_no_prefix(self):
        options = {"username": "******", "password": "******", "length": 12}

        prefix, uf_dict = unflatten_dict(options)
        assert prefix == None
        assert uf_dict == options