def test_merge_left_into_right_nested_LR_empty_R_nested_dict(self): left_dict = { 'A': 1, 'B': 2, 'C': 3, 'D': { 'J': -100, 'K': -200, 'L': -300 } } right_dict = { 'A': -999, 'C': -999, 'D': {}, 'X': 100, 'Y': 200, 'Z': 300 } correct_result = { 'A': 1, 'B': 2, 'C': 3, 'D': { 'J': -100, 'K': -200, 'L': -300 }, 'X': 100, 'Y': 200, 'Z': 300 } self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))
def test_merge_left_into_right_non_distinct_LR(self): left_dict = {'A': 1, 'B': 2, 'C': 3} right_dict = {'A': -999, 'C': -999, 'X': 100, 'Y': 200, 'Z': 300} correct_result = {'A': 1, 'B': 2, 'C': 3, 'X': 100, 'Y': 200, 'Z': 300} self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))
def test_merge_left_into_right_unique_element_in_L(self): left_dict = {'NEW': 999} right_dict = {'X': 100, 'Y': 200, 'Z': 300} correct_result = {'NEW': 999, 'X': 100, 'Y': 200, 'Z': 300} self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))
def test_merge_left_into_right_emptyR(self): left_dict = {'A': 1, 'B': 2, 'C': 3} right_dict = {} correct_result = {'A': 1, 'B': 2, 'C': 3} self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))
def test_merge_left_into_right_emptyL(self): left_dict = {} right_dict = {'X': 100, 'Y': 200, 'Z': 300} correct_result = {'X': 100, 'Y': 200, 'Z': 300} self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))
def test_merge_left_into_right_emptyL_emptyR(self): left_dict = {} right_dict = {} correct_result = {} self.assertEqual( correct_result, merge_left_into_right(left_dict=left_dict, right_dict=right_dict))