Fix issue with looping in list merging

The last_dest_idx variable should always have been
tracking the last index in the source list. The
original intention, implemented incorrectly, was
to just append any items which source has no item
at that index.
This commit is contained in:
Tom Byers
2021-01-26 12:16:08 +00:00
parent 1059cf4d81
commit 67392e97ee
2 changed files with 4 additions and 2 deletions

View File

@@ -630,6 +630,8 @@ def test_get_sample_template_returns_template(template_type):
([{"b": "c"}], [{"b": "e"}], [{"b": "e"}]),
# if nested dicts in lists have different keys, additive behaviour
([{"b": "c"}], [{"d": {"e": "f"}}], [{"b": "c", "d": {"e": "f"}}]),
# if dicts in destination list but not source, they just get added to end of source
([{"a": "b"}], [{"a": "b"}, {"a": "b"}, {"c": "d"}], [{"a": "b"}, {"a": "b"}, {"c": "d"}]),
# merge a dict with a null object returns that dict (does not work the other way round)
({"a": {"b": "c"}}, None, {"a": {"b": "c"}}),
# double nested dicts, new adds new Boolean key: value, additive behaviour