code: def test_obs_is_image(self):
      image_env = GymEnv(DummyDiscretePixelEnv(), is_image=True)
      with mock.patch(
          ("tests.fixtures.models.SimpleCNNModel._build"),
          autospec=True,
          side_effect=SimpleCNNModel._build,
      ) as build:
          with mock.patch(
              ("garage.tf.models." "cnn_mlp_merge_model.CNNModel"),
              new=SimpleCNNModel,
          ):
              with mock.patch(
                  (
                      "garage.tf.models."
                      "cnn_mlp_merge_model.MLPMergeModel"
                  ),
                  new=SimpleMLPMergeModel,
              ):
                  qf = ContinuousCNNQFunction(
                      env_spec=image_env.spec,
                      filters=((5, (3, 3)),),
                      strides=(1,),
                  )
  
                  fake_obs = [
                      np.full(
                          image_env.spec.observation_space.shape, 255
                      )
                  ]
  
                  # make sure image obses are normalized in _initialize()
                  # and get_qval
                  normalized_obs = build.call_args_list[0][0][1]
                  assert normalized_obs != qf.inputs[0]
  
                  assert (
                      self.sess.run(
                          normalized_obs,
                          feed_dict={qf.inputs[0]: fake_obs},
                      )
                      == 1.0
                  ).all()
  
                  # make sure image obses are normalized in get_qval_sim()
  
                  obs_dim = image_env.spec.observation_space.shape
                  state_input = tf.compat.v1.placeholder(
                      tf.float32, shape=(None,) + obs_dim
                  )
  
                  act_dim = image_env.spec.observation_space.shape
                  action_input = tf.compat.v1.placeholder(
                      tf.float32, shape=(None,) + act_dim
                  )
  
                  qf.build(state_input, action_input, name="another")
                  normalized_obs = build.call_args_list[1][0][1]
  
                  assert (
                      self.sess.run(
                          normalized_obs,
                          feed_dict={state_input: fake_obs},
                      )
                      == 1.0
                  ).all()
  
imports: import pickle
  from unittest import mock
  import numpy
  import pytest
  import tensorflow
  from garage.envs import GymEnv
  from garage.tf.q_functions import ContinuousCNNQFunction
  from tests.fixtures import TfGraphTestCase
  from tests.fixtures.envs.dummy import DummyDictEnv, DummyDiscreteEnv, DummyDiscretePixelEnv
  from tests.fixtures.models import SimpleCNNModel, SimpleCNNModelWithMaxPooling, SimpleMLPMergeModel
label_desc: Use image node_id 5 for calling the TestContinuousCNNQFunction obj's underlying member method code with example usage: obj.test_obs_is_image() without return types