code: def test_evaluation_option_always_attach_eval_metrics(self):
      # Use a custom callback that asserts that we are running the
      # configured exact number of episodes per evaluation.
      config = (
          dqn.DQNConfig()
          .environment(env="CartPole-v1")
          .evaluation(
              evaluation_interval=2,
              evaluation_duration=2,
              evaluation_duration_unit="episodes",
              evaluation_config=dqn.DQNConfig.overrides(gamma=0.98),
              always_attach_evaluation_results=True,
          )
          .reporting(min_sample_timesteps_per_iteration=100)
          .callbacks(callbacks_class=AssertEvalCallback)
      )
      for _ in framework_iterator(config, frameworks=("tf", "torch")):
          algo = config.build()
          # Should always see latest available eval results.
          r0 = algo.train()
          r1 = algo.train()
          r2 = algo.train()
          r3 = algo.train()
          algo.stop()
  
          # Eval results are not available at step 0.
          # But step 3 should still have it, even though no eval was
          # run during that step.
          self.assertTrue("evaluation" in r0)
          self.assertTrue("evaluation" in r1)
          self.assertTrue("evaluation" in r2)
          self.assertTrue("evaluation" in r3)
  
imports: import gymnasium
  import numpy
  import os
  from pathlib import Path
  from random import choice
  import time
  import unittest
  import ray
  import ray.rllib.algorithms.dqn
  from ray.rllib.algorithms.bc import BCConfig
  import ray.rllib.algorithms.ppo
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
  from ray.rllib.examples.parallel_evaluation_and_training import AssertEvalCallback
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO
  from ray.rllib.utils.test_utils import check, framework_iterator
label_desc: Use image node_id 5 for calling the TestAlgorithm obj's underlying member method code with example usage: obj.test_evaluation_option_always_attach_eval_metrics() without return types