diff --git a/tests/test_cal_tools.py b/tests/test_cal_tools.py index 7343c6f5b673514c01de002964668e0f140a0f72..edf08193a951c8372a67287fc8f4cb9545a2b9da 100644 --- a/tests/test_cal_tools.py +++ b/tests/test_cal_tools.py @@ -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}