code: def test_trial_with_callable():
      domain = Domain(
          {"x": [-1.0, 1.0], "y": [-2, 2], "z": {1, 2, 3, 4}}
      )
      trial = Trial(
          objective=foo,
          domain=domain,
          optimiser="random_search",
          database_path=None,
          seed=7,
          metrics=["score"],
      )
      n_steps = 10
      batch_size = 2
      trial.run(n_steps, batch_size=batch_size, n_parallel=batch_size)
  
      rs = RandomSearch(domain=domain, seed=7)
      rep = Table(domain, metrics=["score"])
      for i in range(n_steps):
          samples = rs.run_step(batch_size=batch_size, minimise=False)
          results = [
              foo(
                  *s.as_namedtuple(),
              )
              for s in samples
          ]
          for sample_eval in zip(samples, results):
              rep.log(sample_eval)
  
      assert len(trial.optimiser.history) == n_steps * batch_size
      assert str(rep.format(order="ascending")) == str(
          trial.reporter.format(order="ascending")
      )
  
file_path: hypertunity/hypertunity/tests/test_trial.py
imports: import pytest
  from hypertunity import Domain, Trial
  from hypertunity.optimisation import RandomSearch
  from hypertunity.reports import Table
  from hypertunity.scheduling import Job
  from hypertunity.scheduling.tests.test_scheduler import run_jobs
label_desc: Use image node_id 2 for calling a global function with example usage: test_trial_with_callable() without return types