def test_merge_filter():
    def afilter(x):
        if "rubber" not in str(x):
            return False
        return True

    src = {
        "key": "metal",
        "key2": "rubber",
        "otherdict": {
            "key3": "I shouldn't be here"
            }
        }
    dst = {}
    dpath.util.merge(dst, src, afilter=afilter)
    assert ("key2" in dst)
    assert ("key" not in dst)
    assert ("otherdict" not in dst)
dataset/ETHPy150Open akesterson/dpath-python/tests/test_util_merge.py/test_merge_filter/original