code: def test_gymnasium_wrapper_terminal_state():
      print("Testing Gymnasium rollout (checking terminal state)")
      for env_name in vizdoom_envs:
          for frame_skip in [1, 4]:
              env = gymnasium.make(
                  env_name, frame_skip=frame_skip, max_buttons_pressed=0
              )
  
              def agent(obs):
                  return env.action_space.sample()
  
              obs = env.reset()
              terminated = False
              truncated = False
              done = terminated or truncated
              while not done:
                  a = agent(obs)
                  (
                      obs,
                      _reward,
                      terminated,
                      truncated,
                      _info,
                  ) = env.step(a)
                  done = terminated or truncated
                  if done:
                      break
                  env.close()
              assert env.observation_space.contains(obs)
  
file_path: ViZDoom/tests/test_gymnasium_wrapper.py
imports: import os
  import pickle
  import gymnasium
  import numpy
  from gymnasium.spaces import Box, Dict, Discrete, MultiDiscrete
  from gymnasium.utils.env_checker import check_env, data_equivalence
  from vizdoom import gymnasium_wrapper
  from vizdoom.gymnasium_wrapper.base_gymnasium_env import VizdoomEnv
label_desc: Use image node_id 2 for calling a global function with example usage: test_gymnasium_wrapper_terminal_state() and returns: env