def test_merge_empty(self): DataBag._data = {'foo': 1} DataBag.merge('bar', [2, 3]) assert DataBag._data == {'foo': 1}
def test_merge_lists(self): DataBag._data = {'foo': {'bar': ['a', 'b', 'c']}} DataBag.merge('foo.bar', ['a', 'd', 'e']) assert DataBag._data['foo']['bar'] == ['a', 'b', 'c', 'a', 'd', 'e']
def test_merge_invalid(self): DataBag._data = {'foo': 1} DataBag.merge('foo', [2, 3]) assert DataBag._data['foo'] == 1
def test_merge_dicts(self): DataBag._data = {'foo': {'bar': {'a': 1, 'b': 2}}} DataBag.merge('foo.bar', {'a': 42, 'c': 3}) assert DataBag._data['foo']['bar']['a'] is 42 assert DataBag._data['foo']['bar']['b'] is 2 assert DataBag._data['foo']['bar']['c'] is 3