def testMerge2(self): a = {'a': 2} b = {'b': 3} expected = {'a': 2, 'b': 3} c = merge_dictionaries(a, b) self.assertEqual(expected, c) c = merge_dictionaries(b, a) self.assertEqual(expected, c)
def testMerge1(self): a = {} b = {} expected = {} c = merge_dictionaries(a, b) self.assertEqual(expected, c) c = merge_dictionaries(b, a) self.assertEqual(expected, c)
def testMerge6(self): a = {'a': 2} b = {'b': [3, 4]} try: merge_dictionaries(a, b) self.assertTrue(False, "Should have thrown an exception.") except Exception: pass try: merge_dictionaries(b, a) self.assertTrue(False, "Should have thrown an exception.") except Exception: pass
def testMerge3(self): a = {'a': 2, 'foo': {'1': 'g', '2': 'h'}} b = {'b': 3, 'foo': {'3': 'i', '4': 'j'}} expected = { 'a': 2, 'b': 3, 'foo': { '1': 'g', '2': 'h', '3': 'i', '4': 'j' } } c = merge_dictionaries(a, b) self.assertEqual(expected, c) c = merge_dictionaries(b, a) self.assertEqual(expected, c)
def combine_push_healths(self, push_health_1, push_health_2): combined = merge_dictionaries(push_health_1, push_health_2, ignored_dicts=PUSH_HEALTH_IGNORED_DICTS, ignored_keys=PUSH_HEALTH_IGNORED_KEYS) return combined