1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

renames dict_combine to dict_merge in network_common (#26073)

This commit is contained in:
Peter Sprygada 2017-06-25 18:46:41 -04:00 committed by GitHub
parent 15beaed6bc
commit b12ca95824
2 changed files with 5 additions and 5 deletions

View file

@ -227,7 +227,7 @@ def dict_diff(base, comparable):
return updates
def dict_combine(base, other):
def dict_merge(base, other):
""" Return a new dict object that combines base and other
This will create a new dict object that is a combination of the key/value
@ -250,7 +250,7 @@ def dict_combine(base, other):
if key in other:
item = other.get(key)
if item is not None:
combined[key] = dict_combine(value, other[key])
combined[key] = dict_merge(value, other[key])
else:
combined[key] = item
else:

View file

@ -24,7 +24,7 @@ __metaclass__ = type
from ansible.compat.tests import unittest
from ansible.module_utils.network_common import to_list, sort_list
from ansible.module_utils.network_common import dict_diff, dict_combine
from ansible.module_utils.network_common import dict_diff, dict_merge
class TestModuleUtilsNetworkCommon(unittest.TestCase):
@ -87,7 +87,7 @@ class TestModuleUtilsNetworkCommon(unittest.TestCase):
self.assertTrue(result['b3'])
self.assertTrue(result['b4'])
def test_dict_combine(self):
def test_dict_merge(self):
base = dict(obj2=dict(), b1=True, b2=False, b3=False,
one=1, two=2, three=3, obj1=dict(key1=1, key2=2),
l1=[1, 3], l2=[1, 2, 3], l4=[4],
@ -98,7 +98,7 @@ class TestModuleUtilsNetworkCommon(unittest.TestCase):
l1=[2, 1], l2=[3, 2, 1], l3=[1],
nested=dict(n1=dict(n2=2, n3=3)))
result = dict_combine(base, other)
result = dict_merge(base, other)
# string assertions
self.assertIn('one', result)