class_docstr: Test Trial object and class.
docstr: Check property `Trial.gradient`.
docstr_tok: ["Check","property","`","Trial.gradient","`","."]
code: def test_gradient_property(self):
      """Check property `Trial.gradient`."""
      base_trial = {"results": []}
  
      # 0 result exist
      trial = Trial(**base_trial)
      assert trial.gradient is None
  
      # 0 result of type 'gradient' exist
      base_trial["results"].append(
          {"name": "a", "type": "objective", "value": 10}
      )
      trial = Trial(**base_trial)
  
      assert trial.gradient is None
  
      # 1 result of type 'gradient' exist
      expected = Trial.Result(name="b", type="gradient", value=5)
  
      base_trial["results"].append(
          {"name": "b", "type": "gradient", "value": 5}
      )
      trial = Trial(**base_trial)
  
      assert trial.gradient == expected
  
      # >1 gradient result
      base_trial["results"].append(
          {"name": "c", "type": "gradient", "value": [12, 15]}
      )
      trial = Trial(**base_trial)
  
      assert trial.gradient == expected
  
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 18 for calling the TestTrial obj's underlying member method code with example usage: obj.test_gradient_property() without return types