コード例 #1
0
    def test_merge_dicts_exists_duplicated_value_in_list(self):
        expected_return = {'kubernetes': ['value-1', 'value-2', 'value-3']}
        dict1 = {'kubernetes': ['value-1', 'value-2', 'value-3']}
        dict2 = {'kubernetes': ['value-3']}

        actual_return = merge_dicts.merge_dicts(dict1, dict2)
        self.assertEqual(expected_return, actual_return)
コード例 #2
0
    def test_merge_dicts_dict2_has_no_nested_dict(self):
        expected_return = {'kubernetes': {'sub-1': 'sub-value-1'}}
        dict1 = {'kubernetes': {'sub-1': 'sub-value-1'}}
        dict2 = {'kubernetes': {}}

        actual_return = merge_dicts.merge_dicts(dict1, dict2)
        self.assertEqual(expected_return, actual_return)
コード例 #3
0
    def test_merge_dicts_both_has_list_value(self):
        expected_return = {'kubernetes': ['value-1', 'value-2', 'value-3']}
        dict1 = {'kubernetes': ['value-1', 'value-2']}
        dict2 = {'kubernetes': ['value-3']}

        actual_return = merge_dicts.merge_dicts(dict1, dict2)
        self.assertEqual(expected_return, actual_return)
コード例 #4
0
    def test_merge_dicts_dict2_has_no_key(self):
        expected_return = {'kubernetes': 'value-1'}
        dict1 = {'kubernetes': 'value-1'}
        dict2 = {}

        actual_return = merge_dicts.merge_dicts(dict1, dict2)
        self.assertEqual(expected_return, actual_return)
コード例 #5
0
    def test_merge_dicts_exists_dict_in_list(self):
        expected_return = {
            'kubernetes': ['value-1', 'value-2', {
                'sub-1': 'sub-value-1'
            }]
        }
        dict1 = {'kubernetes': ['value-1', 'value-2']}
        dict2 = {'kubernetes': [{'sub-1': 'sub-value-1'}]}

        actual_return = merge_dicts.merge_dicts(dict1, dict2)
        self.assertEqual(expected_return, actual_return)