class_docstr: Test Trial object and class.
docstr: Test that invalid objectives cannot be set
docstr_tok: ["Test","that","invalid","objectives","can","not","be","set"]
code: def test_invalid_result(self, trial_config):
      """Test that invalid objectives cannot be set"""
      t = Trial(**trial_config)
  
      # Make sure valid ones pass
      t.results = [
          Trial.Result(name="asfda", type="constraint", value=None),
          Trial.Result(name="asfdb", type="objective", value=1e-5),
      ]
  
      # No results at all
      with pytest.raises(ValueError) as exc:
          t.results = []
      assert "No objective found" in str(exc.value)
  
      # No objectives
      with pytest.raises(ValueError) as exc:
          t.results = [
              Trial.Result(name="asfda", type="constraint", value=None)
          ]
      assert "No objective found" in str(exc.value)
  
      # Bad objective type
      with pytest.raises(ValueError) as exc:
          t.results = [
              Trial.Result(name="asfda", type="constraint", value=None),
              Trial.Result(name="asfdb", type="objective", value=None),
          ]
      assert "Results must contain" in str(exc.value)
  
imports: import copy
  import datetime
  import os
  import warnings
  import bson
  import numpy
  import pytest
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 16 for calling the TestTrial obj's underlying member method code with example usage: obj.test_invalid_result(trial_config) without return types