code: def test_single_array_observation(pixels_only):
      pixel_key = "depth"
  
      env = FakeArrayObservationEnvironment()
      observation_space = env.observation_space
      assert isinstance(observation_space, spaces.Box)
  
      wrapped_env = PixelObservationWrapper(
          env, pixel_keys=(pixel_key,), pixels_only=pixels_only
      )
      wrapped_env.observation_space = wrapped_env.observation_space
      assert isinstance(wrapped_env.observation_space, spaces.Dict)
  
      if pixels_only:
          assert len(wrapped_env.observation_space.spaces) == 1
          assert list(wrapped_env.observation_space.spaces.keys()) == [
              pixel_key
          ]
      else:
          assert len(wrapped_env.observation_space.spaces) == 2
          assert list(wrapped_env.observation_space.spaces.keys()) == [
              STATE_KEY,
              pixel_key,
          ]
  
      observation, info = wrapped_env.reset()
      depth_observation = observation[pixel_key]
  
      assert isinstance(info, dict)
      assert depth_observation.shape == (32, 32, 3)
      assert depth_observation.dtype == np.uint8
  
      if not pixels_only:
          assert isinstance(observation[STATE_KEY], np.ndarray)
  
file_path: gym/tests/wrappers/test_pixel_observation.py
imports: from typing import Optional
  import numpy
  import pytest
  import gym
  from gym import spaces
  from gym.wrappers.pixel_observation import STATE_KEY, PixelObservationWrapper
label_desc: Use image node_id 2 for calling a global function with example usage: test_single_array_observation(pixels_only) without return types