code: def __test_make_action_input(
      make_action_func,
      type_name,
      type_args={},
  ):
      print(
          f"Testing make_action with {type_name.__name__}([], {type_args}) type as input ..."
      )
  
      # Prepare game
      game = _init_game()
  
      prev_pos_y = game.get_game_variable(vzd.GameVariable.POSITION_Y)
      prev_ammo = game.get_game_variable(vzd.GameVariable.AMMO2)
  
      # make_action() with correct arguments
      next_action = type_name([1, 0, 1], **type_args)
      make_action_func(game, next_action, 8)
      assert prev_pos_y < game.get_game_variable(
          vzd.GameVariable.POSITION_Y
      )
      prev_pos_y = game.get_game_variable(vzd.GameVariable.POSITION_Y)
      assert prev_ammo > game.get_game_variable(vzd.GameVariable.AMMO2)
      prev_ammo = game.get_game_variable(vzd.GameVariable.AMMO2)
      _compare_actions(
          next_action, type_name(game.get_last_action(), **type_args)
      )
  
      # make_action() without skipping frames
      make_action_func(game, next_action)
  
      # make_action_func() with negative frames and other types
      error_msg = "make_action() should raise TypeError when called with negative frames or type other than unsigned int"
      _test_exception(
          lambda: make_action_func(game, next_action, -10),
          TypeError,
          error_msg,
      )
      _test_exception(
          lambda: make_action_func(game, next_action, "10"),
          TypeError,
          error_msg,
      )
  
      # make_action() with too short action
      next_action = type_name([1, 0], **type_args)
      make_action_func(game, next_action, 8)
      assert prev_pos_y < game.get_game_variable(
          vzd.GameVariable.POSITION_Y
      )
      prev_pos_y = game.get_game_variable(vzd.GameVariable.POSITION_Y)
      _compare_actions(
          next_action,
          type_name(game.get_last_action()[:2], **type_args),
      )
  
      # make_action() with too long action
      next_action = type_name([1, 0, 1, 0], **type_args)
      make_action_func(game, next_action, 8)
      assert prev_pos_y < game.get_game_variable(
          vzd.GameVariable.POSITION_Y
      )
      prev_pos_y = game.get_game_variable(vzd.GameVariable.POSITION_Y)
      assert prev_ammo > game.get_game_variable(vzd.GameVariable.AMMO2)
      prev_ammo = game.get_game_variable(vzd.GameVariable.AMMO2)
      _compare_actions(
          next_action[:3],
          type_name(game.get_last_action(), **type_args),
      )
  
      # make_action() with values other than 0 and 1
      next_action = type_name([0, 5, -5], **type_args)
      make_action_func(game, next_action, 16)
      assert prev_pos_y > game.get_game_variable(
          vzd.GameVariable.POSITION_Y
      )
      assert prev_ammo > game.get_game_variable(vzd.GameVariable.AMMO2)
      _compare_actions(
          next_action[:3],
          type_name(game.get_last_action(), **type_args),
      )
  
file_path: ViZDoom/tests/test_make_action.py
imports: import numpy
  import vizdoom
label_desc: Use image node_id 5 for calling a global function with example usage: __test_make_action_input(make_action_func, type_name, type_args) without return types