code: def test_get_filtered_observation_space():
      # error on observation space with shape not matching the filter squeeze axis configuration
      squeeze_filter = InputFilter()
      squeeze_filter.add_observation_filter(
          "observation", "squeeze", ObservationSqueezeFilter(axis=3)
      )
  
      observation_space = ObservationSpace(
          np.array([20, 1, 30, 3]), 0, 100
      )
      small_observation_space = ObservationSpace(
          np.array([20, 1, 30]), 0, 100
      )
      with pytest.raises(ValueError):
          squeeze_filter.get_filtered_observation_space(
              "observation", observation_space
          )
          squeeze_filter.get_filtered_observation_space(
              "observation", small_observation_space
          )
  
      # verify output observation space is correct
      observation_space = ObservationSpace(
          np.array([1, 2, 3, 1]), 0, 200
      )
      result = squeeze_filter.get_filtered_observation_space(
          "observation", observation_space
      )
      assert np.all(result.shape == np.array([1, 2, 3]))
  
      squeeze_filter = InputFilter()
      squeeze_filter.add_observation_filter(
          "observation", "squeeze", ObservationSqueezeFilter()
      )
  
      result = squeeze_filter.get_filtered_observation_space(
          "observation", observation_space
      )
      assert np.all(result.shape == np.array([2, 3]))
  
file_path: coach/rl_coach/tests/filters/observation/test_observation_squeeze_filter.py
imports: import os
  import sys
  import pytest
  import numpy
  from rl_coach.filters.observation.observation_squeeze_filter import ObservationSqueezeFilter
  from rl_coach.spaces import ObservationSpace
  from rl_coach.core_types import EnvResponse
  from rl_coach.filters.filter import InputFilter
label_desc: Use image node_id 2 for calling a global function with example usage: test_get_filtered_observation_space() without return types