code: def _test_dummy_env_for_discretization_config(
      discretization_config: Dict[str, Dict]
  ) -> None:
      """Test the Discretize action wrapper on the dummy env for a given discretization_config.
  
      :param discretization_config: The Discretize actions config to apply and test.
      """
      base_env = build_dummy_maze_env()
  
      env = DiscretizeActionsWrapper.wrap(
          base_env, discretization_config=discretization_config
      )
  
      assert isinstance(env.action_space, spaces.Dict)
      for (
          action_name,
          new_action_config,
      ) in discretization_config.items():
          assert action_name in env.action_space.spaces.keys()
          if base_env.action_space[action_name].shape[-1] == 1:
              assert isinstance(
                  env.action_space[action_name], spaces.Discrete
              )
              assert (
                  env.action_space[action_name].n
                  == new_action_config["num_bins"]
              )
          else:
              assert isinstance(
                  env.action_space[action_name], spaces.MultiDiscrete
              )
              assert np.all(
                  env.action_space[action_name].nvec
                  == np.array(
                      [new_action_config["num_bins"]]
                      * base_env.action_space[action_name].shape[-1]
                  )
              )
  
      env.reset()
      for i in range(1):
          action = env.action_space.sample()
          env.step(action)
          reverse_action = env.action(action)
          restored_action = env.reverse_action(reverse_action)
          assert isinstance(action, dict)
          for (
              action_name,
              action_config,
          ) in discretization_config.items():
              assert action_name in action
              if base_env.action_space[action_name].shape[-1] == 1:
                  assert action[action_name] in spaces.Discrete(
                      action_config["num_bins"]
                  )
              else:
                  nvec = np.array(
                      [action_config["num_bins"]]
                      * base_env.action_space[action_name].shape[-1]
                  )
                  assert action[action_name] in spaces.MultiDiscrete(
                      nvec
                  )
              assert (
                  reverse_action[action_name]
                  in base_env.action_space[action_name]
              )
              assert np.all(
                  restored_action[action_name] == action[action_name]
              )
  
file_path: maze/maze/test/core/wrappers/test_discretise_action_wrapper.py
imports: from typing import Dict
  import numpy
  import pytest
  from gym import spaces
  from maze.core.wrappers.discretize_actions_wrapper import DiscretizeActionsWrapper
  from maze.core.wrappers.maze_gym_env_wrapper import GymMazeEnv
  from maze.core.wrappers.split_actions_wrapper import SplitActionsWrapper
  from maze.test.shared_test_utils.helper_functions import build_dummy_maze_env
label_desc: Use image node_id 2 for calling a global function with example usage: _test_dummy_env_for_discretization_config(discretization_config) without return types