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