code: def test_change_last_time_step(self):
      t = trajectory.Trajectory()
      t.add_time_step(observation=1, done=False)
      t.add_time_step(observation=1, done=True)
      self.assertTrue(t.is_active)
  
      num_ts_old = t.num_time_steps
      self.assertEqual(2, num_ts_old)
  
      # Assert on what the last time-step is currently.
      ts = t.last_time_step
      self.assertEqual(1, ts.observation)
      self.assertTrue(ts.done)
      self.assertEqual(None, ts.action)
  
      # Change the last time-step.
      t.change_last_time_step(done=False, action=5)
  
      # Assert that it changed.
      ts = t.last_time_step
      self.assertEqual(
          1, ts.observation
      )  # unchanged, since we didn't change it.
      self.assertFalse(ts.done)  # was True earlier
      self.assertEqual(5, ts.action)  # was None earlier
  
      # Assert on the number of steps remaining the same as before.
      self.assertEqual(num_ts_old, t.num_time_steps)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import numpy
  from tensor2tensor.envs import time_step
  from tensor2tensor.envs import trajectory
  import tensorflow.compat.v1
  from tensorflow.compat.v1.io import gfile
label_desc: Use image node_id 3 for calling the TrajectoryTest obj's underlying member method code with example usage: obj.test_change_last_time_step() without return types