code: def test_check_obs(test, obs, obs_space: spaces.Space, message: str):
      """Tests the check observations function."""
      if test is UserWarning:
          with pytest.warns(
              UserWarning,
              match=f"^\\x1b\\[33mWARN: {re.escape(message)}\\x1b\\[0m$",
          ):
              check_obs(obs, obs_space, "testing")
      else:
          with warnings.catch_warnings(record=True) as caught_warnings:
              with pytest.raises(test, match=f"^{re.escape(message)}$"):
                  check_obs(obs, obs_space, "testing")
          assert len(caught_warnings) == 0
  
imports: import re
  import warnings
  from typing import Dict, Union
  import numpy
  import pytest
  import gym
  from gym import spaces
  from gym.utils.passive_env_checker import check_action_space, check_obs, check_observation_space, env_render_passive_checker, env_reset_passive_checker, env_step_passive_checker
  from tests.testing_env import GenericTestEnv
label_desc: Use image node_id 4 for calling a global function with example usage: test_check_obs(test, obs, obs_space, message) without return types