docstr: Test if the trajectory stream samples by trajectory.
code: def test_trajectory_slice_stream_sampling_by_trajectory(self):
      """Test if the trajectory stream samples by trajectory."""
      # Long trajectory of 0s.
      tr1 = rl_task.Trajectory(0)
      for _ in range(100):
          self._extend(tr1)
      self._extend(tr1, new_observation=200, done=True)
      # Short trajectory of 101.
      tr2 = rl_task.Trajectory(101)
      self._extend(tr2, new_observation=200, done=True)
      task = rl_task.RLTask(
          DummyEnv(), initial_trajectories=[tr1, tr2], max_steps=9
      )
  
      # Stream of both. Check that we're sampling by trajectory.
      stream = task.trajectory_slice_stream(
          max_slice_length=1, sample_trajectories_uniformly=True
      )
      slices = []
      for _ in range(10):
          next_slice = next(stream)
          assert next_slice.observation.shape[0] == 1
          slices.append(next_slice.observation[-1])
      mean_obs = sum(slices) / float(len(slices))
      # Average should be around 50, sampling from {0, 101} uniformly.
      # Sampling 101 < 2 times has low probability (but it possible, flaky test).
      self.assertGreater(mean_obs, 20)
      self.assertLen(slices, 10)
  
imports: import os
  from absl.testing import absltest
  import gym
  import numpy
  from trax import test_utils
  from trax.rl import task
label_desc: Use image node_id 24 for calling the TaskTest obj's underlying member method code with example usage: obj.test_trajectory_slice_stream_sampling_by_trajectory() without return types