code: def test_filter(env_response):
      crop_low = np.array([0, 5, 10])
      crop_high = np.array([5, 10, 20])
      crop_filter = InputFilter()
      crop_filter.add_observation_filter(
          "observation",
          "crop",
          ObservationCropFilter(crop_low, crop_high),
      )
  
      result = crop_filter.filter(env_response)[0]
      unfiltered_observation = env_response.next_state["observation"]
      filtered_observation = result.next_state["observation"]
  
      # validate the shape of the filtered observation
      assert filtered_observation.shape == (5, 5, 10)
  
      # validate the content of the filtered observation
      assert np.all(
          filtered_observation
          == unfiltered_observation[0:5, 5:10, 10:20]
      )
  
      # crop with -1 on some axes
      crop_low = np.array([0, 0, 0])
      crop_high = np.array([5, -1, -1])
      crop_filter = InputFilter()
      crop_filter.add_observation_filter(
          "observation",
          "crop",
          ObservationCropFilter(crop_low, crop_high),
      )
  
      result = crop_filter.filter(env_response)[0]
      unfiltered_observation = env_response.next_state["observation"]
      filtered_observation = result.next_state["observation"]
  
      # validate the shape of the filtered observation
      assert filtered_observation.shape == (5, 20, 30)
  
      # validate the content of the filtered observation
      assert np.all(
          filtered_observation == unfiltered_observation[0:5, :, :]
      )
  
file_path: coach/rl_coach/tests/filters/observation/test_observation_crop_filter.py
imports: import os
  import sys
  import pytest
  import numpy
  from rl_coach.filters.observation.observation_crop_filter import ObservationCropFilter
  from rl_coach.filters.filter import InputFilter
  from rl_coach.spaces import ObservationSpace
  from rl_coach.core_types import EnvResponse
label_desc: Use image node_id 2 for calling a global function with example usage: test_filter(env_response) without return types