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}
Esempio n. 2
0
def dump_json(path, *dicts):
    data = merge(*dicts)

    with open(path, 'w') as f:
        json.dump(data, f)
    return path
Esempio n. 3
0
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}
Esempio n. 4
0
 def dmerge(*args):
     if all(is_mapping, *args):
         return Munch(tz.merge(*args))
     else:
         return tz.last(*args)