From 6716cc5dc234801e3a73217b9e2fd269138ec067 Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Wed, 5 Sep 2018 13:12:04 -0500 Subject: [PATCH] Add one test case to the TestMergeDictUnit for same key dict merge add one test case to the TestMergeDictUnit for same key dict merge Change-Id: Ia17de71ac3337acc8cf4ecc9e101c81409e50b44 --- tests/test_dictutils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_dictutils.py b/tests/test_dictutils.py index 0fb5a30017..56d9b567ab 100644 --- a/tests/test_dictutils.py +++ b/tests/test_dictutils.py @@ -44,6 +44,15 @@ class TestMergeDictUnit(unittest.TestCase): self.assertIn('key2', new.keys()) self.assertIn('key2.1', new['key2'].keys()) + def test_merging_nested_dicts_with_same_key(self): + base = {'same_key': {'inside_key1': 'inside_key1'}} + target = {'same_key': {'inside_key2': 'inside_key2'}} + + new = du.merge_dict(base, target) + + self.assertIn('inside_key1', new['same_key'].keys()) + self.assertIn('inside_key2', new['same_key'].keys()) + class TestAppendIfUnit(unittest.TestCase): def test_appending_not_present(self):