How to use the orion.core.evc.adapters.CodeChange function in orion

To help you get started, we’ve selected a few orion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Epistimio / orion / tests / unittests / core / evc / test_adapters.py View on Github external
def test_code_change_init(self):
        """Test initialization of :class:`orion.core.evc.adapters.CodeChange`
        with valid change types
        """
        code_change_adapter = CodeChange(CodeChange.NOEFFECT)
        assert code_change_adapter.change_type == CodeChange.NOEFFECT

        code_change_adapter = CodeChange(CodeChange.BREAK)
        assert code_change_adapter.change_type == CodeChange.BREAK
github Epistimio / orion / tests / unittests / core / evc / test_adapters.py View on Github external
def test_code_change_init(self):
        """Test initialization of :class:`orion.core.evc.adapters.CodeChange`
        with valid change types
        """
        code_change_adapter = CodeChange(CodeChange.NOEFFECT)
        assert code_change_adapter.change_type == CodeChange.NOEFFECT

        code_change_adapter = CodeChange(CodeChange.BREAK)
        assert code_change_adapter.change_type == CodeChange.BREAK
github Epistimio / orion / tests / unittests / core / evc / test_adapters.py View on Github external
def test_code_change_backward_break(self, trials):
        """Test :meth:`orion.core.evc.adapters.CodeChange.backward` with change type BREAK"""
        code_change_adapter = CodeChange(CodeChange.BREAK)

        adapted_trials = code_change_adapter.backward(trials)

        assert len(adapted_trials) == 0
github Epistimio / orion / tests / unittests / core / test_branch_config.py View on Github external
def test_code_change(self, parent_config, changed_code_config):
        """Test if giving a proper change-type solves the code conflict"""
        conflicts = detect_conflicts(parent_config, changed_code_config)
        branch_builder = ExperimentBranchBuilder(conflicts, {'manual_resolution': True})

        assert len(conflicts.get()) == 2
        assert len(conflicts.get_resolved()) == 1

        branch_builder.set_code_change_type(evc.adapters.CodeChange.types[0])

        assert len(conflicts.get()) == 2
        assert len(conflicts.get_resolved()) == 2

        conflict = conflicts.get_resolved()[0]
        assert conflict.is_resolved
        assert isinstance(conflict, CodeConflict)
github Epistimio / orion / tests / unittests / core / evc / test_adapters.py View on Github external
def test_code_change_forward_break(self, trials):
        """Test :meth:`orion.core.evc.adapters.CodeChange.forward` with change type BREAK"""
        code_change_adapter = CodeChange(CodeChange.BREAK)

        adapted_trials = code_change_adapter.forward(trials)

        assert len(adapted_trials) == 0
github Epistimio / orion / tests / unittests / core / evc / test_conflicts.py View on Github external
def test_try_resolve(self, code_conflict):
        """Verify that resolution is achievable with valid code change-type input"""
        assert not code_conflict.is_resolved
        resolution = code_conflict.try_resolve(evc.adapters.CodeChange.UNSURE)
        assert isinstance(resolution, code_conflict.CodeResolution)
        assert code_conflict.is_resolved
        assert resolution.conflict is code_conflict
        assert resolution.type == evc.adapters.CodeChange.UNSURE
github Epistimio / orion / tests / unittests / core / evc / test_conflicts.py View on Github external
def test_try_resolve_twice(self, code_conflict):
        """Verify that conflict cannot be resolved twice"""
        assert not code_conflict.is_resolved
        assert isinstance(code_conflict.try_resolve(evc.adapters.CodeChange.BREAK),
                          code_conflict.CodeResolution)
        assert code_conflict.is_resolved
        assert code_conflict.try_resolve() is None
github Epistimio / orion / tests / unittests / core / evc / test_adapters.py View on Github external
def test_code_change_backward_noeffect(self, trials):
        """Test :meth:`orion.core.evc.adapters.CodeChange.backward` with change type NOEFFECT"""
        code_change_adapter = CodeChange(CodeChange.NOEFFECT)

        adapted_trials = code_change_adapter.backward(trials)

        assert len(adapted_trials) == len(trials)

        assert adapted_trials[0] is trials[0]
        assert adapted_trials[-1] is trials[-1]
github Epistimio / orion / src / orion / core / evc / conflicts.py View on Github external
def get_adapters(self):
            """Return CodeChange adapter"""
            return [adapters.CodeChange(self.type)]