code: def test_api_failures():
      env = GenericTestEnv(
          reset_fn=_reset_failure,
          step_fn=_step_failure,
          metadata={"render_modes": "error"},
      )
      env = PassiveEnvChecker(env)
      assert env.checked_reset is False
      assert env.checked_step is False
      assert env.checked_render is False
  
      with pytest.warns(
          UserWarning,
          match=re.escape(
              "The obs returned by the `reset()` method is not within the observation space"
          ),
      ):
          env.reset()
      assert env.checked_reset
  
      with pytest.raises(
          AssertionError,
          match="Expects step result to be a tuple, actual type: <class 'str'>",
      ):
          env.step(env.action_space.sample())
      assert env.checked_step
  
      with pytest.warns(
          UserWarning,
          match=r"Expects the render_modes to be a sequence \(i\.e\. list, tuple\), actual type: <class 'str'>",
      ):
          env.render()
      assert env.checked_render
  
      env.close()
  
file_path: gym/tests/wrappers/test_passive_env_checker.py
imports: import re
  import warnings
  import numpy
  import pytest
  import gym
  from gym.wrappers.env_checker import PassiveEnvChecker
  from tests.envs.test_envs import PASSIVE_CHECK_IGNORE_WARNING
  from tests.envs.utils import all_testing_initialised_envs
  from tests.testing_env import GenericTestEnv
label_desc: Use image node_id 5 for calling a global function with example usage: test_api_failures() without return types