code: def test_lookat_run(self):
      kBrushU = 1
      kIsLooking = 3
      env = deepmind_lab.Lab(
          "tests/lookat_test",
          ["LOOK_AT"],
          config={
              "fps": "60",
              "controls": "external",
              "width": "32",
              "height": "32",
          },
      )
  
      env.reset()
      noop = np.array([0, 0, 0, 0, 0, 0, 0], dtype=np.intc)
  
      last_look_at = None
      for _ in six.moves.range(10):
          self.assertEqual(env.step(noop, 1), 0)
          next_look_at = env.observations()["LOOK_AT"]
          self.assertEqual(1, next_look_at[kIsLooking])
          if last_look_at is not None and np.allclose(
              last_look_at, next_look_at
          ):
              break
          last_look_at = next_look_at
      else:
          self.fail("Too many iterations to stablise!")
  
      self.assertAlmostEqual(last_look_at[kBrushU], 0.5, delta=0.1)
      look_left = np.array([-5, 0, 0, 0, 0, 0, 0], dtype=np.intc)
  
      for _ in six.moves.range(100):
          env.step(look_left, 1)
          next_look_at = env.observations()["LOOK_AT"]
          if next_look_at[kIsLooking] != 1:
              self.assertAlmostEqual(
                  last_look_at[kBrushU], 1.0, delta=0.1
              )
              break
          self.assertTrue(
              next_look_at[kBrushU] >= last_look_at[kBrushU]
          )
          last_look_at = next_look_at
      else:
          self.fail("Failed to look away from object")
  
      look_right = np.array([5, 0, 0, 0, 0, 0, 0], dtype=np.intc)
  
      for _ in six.moves.range(5):
          env.step(look_right, 1)
          next_look_at = env.observations()["LOOK_AT"]
          if next_look_at[kIsLooking] == 1:
              last_look_at = next_look_at
              break
      else:
          self.fail("Failed to look back to object")
  
      for _ in six.moves.range(100):
          env.step(look_right, 1)
          next_look_at = env.observations()["LOOK_AT"]
          if next_look_at[kIsLooking] != 1:
              self.assertAlmostEqual(
                  last_look_at[kBrushU], 0.0, delta=0.1
              )
              break
          self.assertTrue(
              next_look_at[kBrushU] <= last_look_at[kBrushU]
          )
          last_look_at = next_look_at
      else:
          self.fail("Failed to all the way through object")
  
file_path: lab/python/tests/lookat_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl.testing import absltest
  import numpy
  import six
  import deepmind_lab
label_desc: Use image node_id 1 for calling the LookatTest obj's underlying member method code with example usage: obj.test_lookat_run() without return types