Ejemplo n.º 1
0
    def test_recursive_update_create_list(self):
        # Arrange
        target = dict(key1 = 42, key2 = dict(key21 = 21))
        source = dict(key2 = dict(key22 = [3]))

        # Act
        recursive_update(target, source)

        # Assert
        self.assertDictEqual(target, dict(key1 = 42, key2 = dict(key21 = 21, key22 = [3])))
Ejemplo n.º 2
0
    def test_recursive_update_extend_lists_with_target_type_mismatch(self):
        # Arrange
        target = dict(key1 = 42, key2 = dict(key21 = 84))
        source = dict(key2 = dict(key21 = [1]))

        # Act
        recursive_update(target, source)

        # Assert
        self.assertDictEqual(target, dict(key1 = 42, key2 = dict(key21 = [1])))
Ejemplo n.º 3
0
    def test_recursive_update_extend_lists(self):
        # Arrange
        target = dict(key1 = 42, key2 = dict(key21 = [1, 2]))
        source = dict(key2 = dict(key21 = [3]))

        # Act
        recursive_update(target, source)

        # Assert
        self.assertDictEqual(target, dict(key1 = 42, key2 = dict(key21 = [1,2,3])))
Ejemplo n.º 4
0
    def test_recursive_update_simple(self):
        # Arrange
        target = dict(key1 = 42, key2 = dict(key21 = 10.5))
        source = dict(key2 = dict(key22 = 21))

        # Act
        recursive_update(target, source)

        # Assert
        self.assertDictEqual(target, dict(key1 = 42, key2 = dict(key21 = 10.5, key22 = 21)))
Ejemplo n.º 5
0
    def test_recursive_update_with_source_type_mismatch(self):
        # Arrange
        target = dict(key1 = 42, key2 = dict(key21 = 10.5))
        source = dict(key2 = 84)

        # Act
        recursive_update(target, source)

        # Assert
        self.assertDictEqual(target, dict(key1 = 42, key2 = 84))