class_docstr: Base class for testing Profet tasks.
class_docstr_tok: ["Base","class","for","testing","Profet","tasks","."]
docstr: Test that calling the task with the `with_grad` returns the gradient at that point.
docstr_tok: ["Test","that","calling","the","task","with","the","`","with_grad","`","returns","the","gradient","at","that","point","."]
code: def test_call_with_gradients(
      self,
      profet_train_config: MetaModelConfig,
      profet_input_dir: Path,
      checkpoint_dir: Path,
      step_size: float,
  ):
      """Test that calling the task with the `with_grad` returns the gradient at that point."""
      task = self.Task(
          input_dir=profet_input_dir,
          checkpoint_dir=checkpoint_dir,
          model_config=profet_train_config,
          with_grad=True,
      )
  
      first_trial = sample(task)
      results = task(**first_trial.params)
  
      assert results[0]["type"] == "objective"
      first_objective = results[0]["value"]
      assert results[1]["type"] == "gradient"
      first_gradient = results[1]["value"]
      assert first_gradient is not None
  
imports: from dataclasses import asdict, replace
  from logging import getLogger
  from pathlib import Path
  from typing import ClassVar, Type
  import numpy
  import pytest
  from _pytest.tmpdir import TempPathFactory
  from orion.algo.space import Space
  from typing import List, Union, overload
  from pytest_mock import MockerFixture
  from orion.benchmark.task.profet.profet_task import MetaModelConfig, ProfetTask
  from orion.core.worker.trial import Trial
  from .conftest import REAL_PROFET_DATA_DIR, is_nonempty_dir
label_desc: Use image node_id 11 for calling the ProfetTaskTests obj's underlying member method code with example usage: obj.test_call_with_gradients(profet_train_config, profet_input_dir, checkpoint_dir, step_size) without return types