docstr: Tests, whether n-step adjustments of trajectories work.
docstr_tok: ["Tests",",","whether","n-step","adjustments","of","trajectories","work","."]
code: def test_n_step_3(self):
      """Tests, whether n-step adjustments of trajectories work."""
      # n-step = 3
      gamma = 0.9
      obs = [1, 2, 3, 4, 5, 6, 7]
      actions = ["ac1", "ac2", "ac1", "ac1", "ac1", "ac2", "ac1"]
      rewards = [10.0, 0.0, 100.0, 100.0, 100.0, 100.0, 100.0]
      terminateds = [0, 0, 0, 0, 0, 0, 1]
      truncateds = [0, 0, 0, 0, 0, 0, 0]
      next_obs = [2, 3, 4, 5, 6, 7, 8]
      batch = SampleBatch(
          {
              SampleBatch.OBS: obs,
              SampleBatch.ACTIONS: actions,
              SampleBatch.REWARDS: rewards,
              SampleBatch.TERMINATEDS: terminateds,
              SampleBatch.TRUNCATEDS: truncateds,
              SampleBatch.NEXT_OBS: next_obs,
          }
      )
      adjust_nstep(3, gamma, batch)
      check(batch[SampleBatch.OBS], [1, 2, 3, 4, 5, 6, 7])
      check(
          batch[SampleBatch.ACTIONS],
          ["ac1", "ac2", "ac1", "ac1", "ac1", "ac2", "ac1"],
      )
      check(batch[SampleBatch.NEXT_OBS], [4, 5, 6, 7, 8, 8, 8])
      check(batch[SampleBatch.TERMINATEDS], [0, 0, 0, 0, 1, 1, 1])
      check(batch[SampleBatch.TRUNCATEDS], [0, 0, 0, 0, 0, 0, 0])
      check(
          batch[SampleBatch.REWARDS],
          [91.0, 171.0, 271.0, 271.0, 271.0, 190.0, 100.0],
      )
  
file_path: ray/rllib/evaluation/tests/test_postprocessing.py
imports: import numpy
  import unittest
  import ray
  from ray.rllib.evaluation.postprocessing import adjust_nstep, discount_cumsum
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.test_utils import check
label_desc: Use image node_id 3 for calling the TestPostprocessing obj's underlying member method code with example usage: obj.test_n_step_3() without return types