Esempio n. 1
0
    def test_dimension_addition_forward_already_existing(self, trials):
        """Test :meth:`orion.core.evc.adapters.DimensionAddition.forward`
        with valid param and incompatible trials because param already exists
        """
        new_param = Trial.Param(name="normal_prior", type="integer", value=1)
        dimension_addition_adapter = DimensionAddition(new_param)

        with pytest.raises(RuntimeError) as exc_info:
            dimension_addition_adapter.forward(trials)
        assert "Provided trial does not have a compatible configuration" in str(
            exc_info.value)
Esempio n. 2
0
    def test_dimension_addition_forward(self, trials):
        """Test :meth:`orion.core.evc.adapters.DimensionAddition.forward`
        with valid param and trials
        """
        new_param = Trial.Param(name="second_normal_prior",
                                type="integer",
                                value=1)
        dimension_addition_adapter = DimensionAddition(new_param)

        adapted_trials = dimension_addition_adapter.forward(trials)

        assert adapted_trials[0]._params[-1] == new_param
        assert adapted_trials[4]._params[-1] == new_param
        assert adapted_trials[-1]._params[-1] == new_param