code: def test_make_autoreset_true(spec):
      """Tests gym.make with `autoreset=True`, and check that the reset actually happens.
  
      Note: This test assumes that the outermost wrapper is AutoResetWrapper so if that
       is being changed in the future, this test will break and need to be updated.
      Note: This test assumes that all first-party environments will terminate in a finite
       amount of time with random actions, which is true as of the time of adding this test.
      """
      env = gym.make(spec.id, autoreset=True, disable_env_checker=True)
      assert AutoResetWrapper in unwrap_env(env)
  
      env.reset(seed=0)
      env.unwrapped.reset = MagicMock(side_effect=env.unwrapped.reset)
  
      terminated, truncated = False, False
      while not (terminated or truncated):
          obs, reward, terminated, truncated, info = env.step(
              env.action_space.sample()
          )
  
      assert env.unwrapped.reset.called
      env.close()
  
file_path: gym/tests/wrappers/test_autoreset.py
imports: from typing import Generator, Optional
  from unittest.mock import MagicMock
  import numpy
  import pytest
  import gym
  from gym.wrappers import AutoResetWrapper
  from tests.envs.utils import all_testing_env_specs
label_desc: Use image node_id 2 for calling a global function with example usage: test_make_autoreset_true(spec) without return types