code: def test_records_episode_with_correct_data():
      env = build_dummy_maze_env()
      env = ActionRecordingWrapper.wrap(
          env,
          record_maze_actions=True,
          record_actions=True,
          output_dir="action_records",
      )
  
      actions = []
  
      env.seed(1234)
      env.reset()
      cum_reward = 0.0
      for _ in range(5):
          action = env.action_space.sample()
          actions.append(action)
          observation, rew, _, _ = env.step(action)
          cum_reward += rew
  
      episode_id = env.get_episode_id()
      expected_file_path = str(episode_id) + ".pkl"
      assert not expected_file_path in os.listdir("action_records")
  
      # Now dump and load the data
      env.seed(1234)
      env.reset()
      assert expected_file_path in os.listdir("action_records")
      with open("action_records/" + expected_file_path, "rb") as in_f:
          action_record = pickle.load(in_f)
  
      assert action_record.cum_action_record_reward == cum_reward
  
      # Check the contents
      assert isinstance(action_record, ActionRecord)
      assert len(action_record) == len(actions)
      for i in range(5):
          recorded_action = action_record.get_agent_action(
              i, ActorID(0, 0)
          )
          for k in recorded_action.keys():
              assert np.all(recorded_action[k] == actions[i][k])
  
file_path: maze/maze/test/core/wrappers/test_action_recording_wrapper.py
imports: import os
  import pickle
  import numpy
  import pytest
  from maze.core.env.structured_env import ActorID
  from maze.core.trajectory_recording.records.action_record import ActionRecord
  from maze.core.wrappers.action_recording_wrapper import ActionRecordingWrapper
  from maze.test.shared_test_utils.helper_functions import build_dummy_maze_env, build_dummy_structured_env
label_desc: Use image node_id 2 for calling a global function with example usage: test_records_episode_with_correct_data() without return types