def test_complex_merge(self): filters_to_update = { "filter-name-1": ["value1"], "filter-name-2": ["value1", "value2"], "filter-name-3": ["value1"], } filters_to_merge = { "filter-name-1": ["value2"], "filter-name-3": ["value2"], "filter-name-4": ["value1", "value2"], } merged = merge_filters(filters_to_update, filters_to_merge) assert len(merged.keys()) == 4 for key in merged.keys(): assert merged[key] == ["value1", "value2"]
def test_values_are_merged(self): filters_to_update = {"filter-name": ["value1"]} filters_to_merge = {"filter-name": ["value2"]} merged = merge_filters(filters_to_update, filters_to_merge) assert merged == {"filter-name": ["value1", "value2"]}
def test_when_filters_to_merge_is_none(self): filters_to_merge = {"filter-name": ["value1"]} merged = merge_filters(None, filters_to_merge) assert merged == filters_to_merge
def test_when_both_filters_are_none(self): merged = merge_filters(None, None) assert merged == {}
def test_when_filters_to_update_is_none(self): filters_to_update = {"filter-name": ["value1"]} merged = merge_filters(filters_to_update, None) assert merged == filters_to_update