code: def test_early_truncation(self):
      # Pendulum has no early termination condition. Recent versions of gym force
      # to use v1. We try both in case an earlier version is installed.
      try:
          gym_env = gym.make("Pendulum-v1")
      except:  # pylint: disable=bare-except
          gym_env = gym.make("Pendulum-v0")
      env = gym_wrapper.GymWrapper(gym_env)
      ts = env.reset()
      while not ts.last():
          ts = env.step(env.action_spec().generate_value())
      self.assertEqual(ts.discount, 1.0)
      self.assertTrue(np.isscalar(ts.reward))
      env.close()
  
file_path: acme/acme/wrappers/gym_wrapper_test.py
imports: import unittest
  from dm_env import specs
  import numpy
  from absl.testing import absltest
label_desc: Use image node_id 2 for calling the GymWrapperTest obj's underlying member method code with example usage: obj.test_early_truncation() without return types