Пример #1
0
    def test_list(self):
        a = [dict(x=1)]
        b = [dict(y=2)]

        c = utils.merge_params(a, b)

        assert c == [{"x": 1, "y": 2}]
Пример #2
0
    def test_hierarchy(self):
        a = dict(a=dict(x=1))
        b = dict(a=dict(y=2))

        c = utils.merge_params(a, b)

        assert c == {"a": {"x": 1, "y": 2}}
Пример #3
0
    def test_basic(self):
        a = dict(x=1)
        b = dict(y=2)

        c = utils.merge_params(a, b)

        assert c == {"x": 1, "y": 2}
Пример #4
0
    def test_different_lengths(self):
        a = [dict(x=1)]
        b = []

        with pytest.raises(ValueError):
            c = utils.merge_params(a, b)
Пример #5
0
    def test_repeated_leafs(self):
        a = dict(a=dict(x=1))
        b = dict(a=dict(x=2))

        with pytest.raises(ValueError):
            c = utils.merge_params(a, b)