def test_merge(): assert merge(factory=lambda: defaultdict(int))({1: 1}) == {1: 1} assert merge({1: 1}) == {1: 1} assert merge({1: 1}, factory=lambda: defaultdict(int)) == {1: 1}
def dump_json(path, *dicts): data = merge(*dicts) with open(path, 'w') as f: json.dump(data, f) return path
def dmerge(*args): if all(is_mapping, *args): return Munch(tz.merge(*args)) else: return tz.last(*args)