code: def test_gym_cartpole(self):
      env = gym_wrapper.GymWrapper(gym.make("CartPole-v0"))
  
      # Test converted observation spec.
      observation_spec: specs.BoundedArray = env.observation_spec()
      self.assertEqual(type(observation_spec), specs.BoundedArray)
      self.assertEqual(observation_spec.shape, (4,))
      self.assertEqual(observation_spec.minimum.shape, (4,))
      self.assertEqual(observation_spec.maximum.shape, (4,))
      self.assertEqual(observation_spec.dtype, np.dtype("float32"))
  
      # Test converted action spec.
      action_spec: specs.BoundedArray = env.action_spec()
      self.assertEqual(type(action_spec), specs.DiscreteArray)
      self.assertEqual(action_spec.shape, ())
      self.assertEqual(action_spec.minimum, 0)
      self.assertEqual(action_spec.maximum, 1)
      self.assertEqual(action_spec.num_values, 2)
      self.assertEqual(action_spec.dtype, np.dtype("int64"))
  
      # Test step.
      timestep = env.reset()
      self.assertTrue(timestep.first())
      timestep = env.step(1)
      self.assertEqual(timestep.reward, 1.0)
      self.assertTrue(np.isscalar(timestep.reward))
      self.assertEqual(timestep.observation.shape, (4,))
      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 1 for calling the GymWrapperTest obj's underlying member method code with example usage: obj.test_gym_cartpole() without return types