Skip to content
Snippets Groups Projects
Commit a43920b9 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Add test for recursive_update()

parent 513b600c
No related branches found
No related tags found
1 merge request!781Support for saving metadata fragments & merging into calibration_metadata.yml
......@@ -19,6 +19,7 @@ from cal_tools.tools import (
map_seq_files,
module_index_to_qm,
send_to_db,
recursive_update,
)
# AGIPD operating conditions.
......@@ -471,3 +472,15 @@ def test_module_index_to_qm():
with pytest.raises(AssertionError):
module_index_to_qm(7, 5)
def test_recursive_update():
tgt = {"a": {"b": 1}, "c": 2}
src = {"a": {"d": 3}, "e": 4}
assert recursive_update(tgt, src) is False
assert tgt == {"a": {"b": 1, "d": 3}, "c": 2, "e": 4}
tgt = {"a": {"b": 1}, "c": 2}
src = {"a": {"b": 3}, "e": 4}
assert recursive_update(tgt, src) is True
assert tgt == {"a": {"b": 1}, "c": 2, "e": 4}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment