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 }
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 }
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": "******" } }
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 }
def test_flat_no_prefix(self): options = {"username": "******", "password": "******", "length": 12} prefix, uf_dict = unflatten_dict(options) assert prefix == None assert uf_dict == options