code: def test_GameCommand(self):
      env = deepmind_lab.Lab(
          "tests/game_command_test", [], config={"fps": "60"}
      )
      action_spec = env.action_spec()
      action_index = {
          action["name"]: i for i, action in enumerate(action_spec)
      }
      self.assertIn("NEXT_GADGET", action_index)
      action = np.zeros([len(action_spec)], dtype=np.intc)
      env.reset()
      action[action_index["NEXT_GADGET"]] = 1
      env.step(action)
      events = env.events()
      self.assertEqual(events[0][1][0], "DISC")
      action[action_index["NEXT_GADGET"]] = 0
      for _ in six.moves.range(100):
          env.step(action)
          events = env.events()
          if events[0][1][0] == "RAPID":
              break
          self.assertEqual(events[0][1][0], "DISC")
      else:
          self.fail("Failed to switch gadget")
  
      action[action_index["NEXT_GADGET"]] = 1
      env.step(action)
      action[action_index["NEXT_GADGET"]] = 0
      for _ in six.moves.range(100):
          env.step(action)
          events = env.events()
          if events[0][1][0] == "BEAM":
              break
          self.assertEqual(events[0][1][0], "RAPID")
      else:
          self.fail("Failed to switch gadget")
  
file_path: lab/python/tests/game_command_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 GameCommandTest obj's underlying member method code with example usage: obj.test_GameCommand() without return types