code: def test_time_limit_wrapper(double_wrap):
      # The pendulum env does not terminate by default
      # so we are sure termination is only due to timeout
      env = PendulumEnv()
      max_episode_length = 20
      env = TimeLimit(env, max_episode_length)
      if double_wrap:
          env = TimeLimit(env, max_episode_length)
      env.reset()
      terminated, truncated = False, False
      n_steps = 0
      info = {}
      while not (terminated or truncated):
          n_steps += 1
          _, _, terminated, truncated, info = env.step(
              env.action_space.sample()
          )
  
      assert n_steps == max_episode_length
      assert truncated
  
imports: import pytest
  import gym
  from gym.envs.classic_control.pendulum import PendulumEnv
  from gym.wrappers import TimeLimit
label_desc: Use image node_id 2 for calling a global function with example usage: test_time_limit_wrapper(double_wrap) without return types