docstr: Tests, whether n-step also works for very small trajectories.
docstr_tok: ["Tests",",","whether","n-step","also","works","for","very","small","trajectories","."]
code: def test_n_step_very_short_trajectory(self):
      """Tests, whether n-step also works for very small trajectories."""
      gamma = 1.0
      obs = np.arange(0, 2)
      actions = np.random.randint(-100, 300, size=(2,))
      check_actions = actions.copy()
      rewards = [10.0, 100.0]
      next_obs = np.arange(1, 3)
      batch = SampleBatch(
          {
              SampleBatch.OBS: obs,
              SampleBatch.ACTIONS: actions,
              SampleBatch.REWARDS: rewards,
              SampleBatch.TERMINATEDS: [False, False],
              SampleBatch.TRUNCATEDS: [False, False],
              SampleBatch.NEXT_OBS: next_obs,
          }
      )
      adjust_nstep(3, gamma, batch)
      check(batch[SampleBatch.OBS], [0, 1])
      check(batch[SampleBatch.ACTIONS], check_actions)
      check(batch[SampleBatch.TERMINATEDS], [False, False])
      check(batch[SampleBatch.TRUNCATEDS], [False, False])
      check(batch[SampleBatch.REWARDS], [10.0 + gamma * 100.0, 100.0])
      check(batch[SampleBatch.NEXT_OBS], [2, 2])
  
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 6 for calling the TestPostprocessing obj's underlying member method code with example usage: obj.test_n_step_very_short_trajectory() without return types