code: def test_observation_monitoring():
      """Observation logging unit test"""
  
      # instantiate env
      env = build_dummy_maze_env()
  
      env = MazeEnvMonitoringWrapper.wrap(
          env,
          observation_logging=True,
          action_logging=False,
          reward_logging=False,
      )
      env = LogStatsWrapper.wrap(
          env
      )  # for accessing events from previous steps
      env.reset()
  
      # test application of wrapper
      for ii in range(3):
          # Observation will get reported in the next step (when the agent is actually acting on it)
          obs = env.step(env.action_space.sample())[0]
  
          observation_events = env.get_last_step_events(
              query=[
                  ObservationEvents.observation_original,
                  ObservationEvents.observation_processed,
              ]
          )
          assert len(observation_events) == 4
          for event in observation_events:
              assert issubclass(
                  event.interface_class, ObservationEvents
              )
              obs_name = event.attributes["name"]
              assert obs_name in ["observation_0", "observation_1"]
              if ii > 0:
                  assert np.allclose(
                      np.asarray(obs[obs_name]),
                      np.asarray(event.attributes["value"]),
                  )
  
file_path: maze/maze/test/core/wrappers/test_monitoring_wrapper.py
imports: import numpy
  from maze.core.log_events.monitoring_events import ObservationEvents, RewardEvents, ActionEvents
  from maze.core.wrappers.log_stats_wrapper import LogStatsWrapper
  from maze.core.wrappers.monitoring_wrapper import MazeEnvMonitoringWrapper
  from maze.test.shared_test_utils.dummy_env.dummy_core_env import DummyCoreEnvironment
  from maze.test.shared_test_utils.dummy_env.dummy_maze_env import DummyEnvironment
  from maze.test.shared_test_utils.dummy_env.dummy_struct_env import DummyStructuredEnvironment
  from maze.test.shared_test_utils.dummy_env.space_interfaces.action_conversion.dict import DictActionConversion
  from maze.test.shared_test_utils.dummy_env.space_interfaces.observation_conversion.dict import ObservationConversion
  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_observation_monitoring() without return types