docstr: Testing discretization with a mock environment.
  
  In the mock call we get access to the argument of the
  SimpleContinuousActionsEnv.step method which we check against
  precomputed values of continuous actions.
docstr_tok: ["Testing","discretization","with","a","mock","environment",".","In","the","mock","call","we","get","access","to","the","argument","of","the","SimpleContinuousActionsEnv.step","method","which","we","check","against","precomputed","values","of","continuous","actions","."]
code: def test_action_mapping_1d(self):
      """Testing discretization with a mock environment.
  
      In the mock call we get access to the argument of the
      SimpleContinuousActionsEnv.step method which we check against
      precomputed values of continuous actions.
      """
      num_actions = 4
  
      with unittest.mock.patch.object(
          gym_utils.RenderedEnv, "step", autospec=True
      ) as mock_step_method:
          env = gym_utils.RenderedEnv(
              SimpleContinuousActionsEnv(dimensions=1)
          )
          expected_continuous_actions = np.linspace(
              np.min(env.action_space.low),
              np.min(env.action_space.high),
              num=num_actions,
          ).flatten()
  
          env_discrete = gym_utils.ActionDiscretizeWrapper(
              env, num_actions
          )
          for discrete_action in range(num_actions):
              env_discrete.step([discrete_action])
              mock_step_method.assert_called_with(
                  unittest.mock.ANY,
                  expected_continuous_actions[discrete_action],
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import unittest
  import gym
  from gym import spaces
  import numpy
  from tensor2tensor.rl import gym_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 9 for calling the GymUtilsTest obj's underlying member method code with example usage: obj.test_action_mapping_1d() without return types