Commit 8d3c5348 authored by Emmanuel Papillon's avatar Emmanuel Papillon Committed by Sebastien Petitdemange
Browse files

Fix a bug on config : object references was not correctly re-assigned

when these references was in a list inside a sub-dict
parent e0d727a6
......@@ -84,7 +84,7 @@ def _parse_dict(config, item_cfg_node, referenced_objects, subdict, placeholder)
if childref:
referenced_objects[name] = value
elif isinstance(value, list):
return_list = _parse_list(config, value, placeholder)
if return_list:
......@@ -145,4 +145,4 @@ def replace_reference_by_object(
_parse_dict(config, subdict, subref, value, placeholder)
if subref:
referenced_objects[name] = subref
......@@ -230,3 +230,11 @@ def test_bliss_import_error(beacon):
with pytest.raises(ModuleNotFoundError) as excinfo:
assert "CONFIG COULD NOT FIND CLASS" not in str(excinfo.value)
def test_references_list_inside_subdict(beacon):
node = {"myname": {"mymotors": ["$roby", "$robz"]}}
replace_reference_by_object(beacon, node, dict())
motor_list = node["myname"]["mymotors"]
assert motor_list[0] == beacon.get("roby")
assert motor_list[1] == beacon.get("robz")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment