code: def test_get_actions_to_consider_returns_none_if_no_linked_actions(
      self,
  ):
      # pylint: disable=protected-access
      valid_actions_1 = {"e": [0, 1, 2, 4]}
      valid_actions_2 = {"e": [0, 1, 3]}
      valid_actions_3 = {"e": [2, 3, 4]}
      self.state.grammar_state[0] = GrammarState(
          ["e"], {}, valid_actions_1, {}, is_nonterminal
      )
      self.state.grammar_state[1] = GrammarState(
          ["e"], {}, valid_actions_2, {}, is_nonterminal
      )
      self.state.grammar_state[2] = GrammarState(
          ["e"], {}, valid_actions_3, {}, is_nonterminal
      )
      (
          considered,
          to_embed,
          to_link,
      ) = WikiTablesDecoderStep._get_actions_to_consider(self.state)
      # These are _global_ action indices.  All of the actions in this case are embedded, so this
      # is just a mapping from the valid actions above to their global ids.
      expected_to_embed = [[1, 0, 2, 5], [4, 0, 3], [2, 3, 5]]
      assert to_embed == expected_to_embed
      # There are no linked actions (all of them are embedded), so this should be None.
      assert to_link is None
      # These are _batch_ action indices, with padding in between the embedded actions and the
      # linked actions.  Because there are no linked actions, this is basically just the
      # valid_actions for each group element padded with -1s.
      expected_considered = [[0, 1, 2, 4], [0, 1, 3, -1], [2, 3, 4, -1]]
      assert considered == expected_considered
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/models/semantic_parsing/wikitables/wikitables_decoder_step_test.py
imports: from __future__ import absolute_import
  from numpy.testing import assert_almost_equal
  import torch
  from allennlp.common import Params
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.models.semantic_parsing.wikitables.wikitables_decoder_state import WikiTablesDecoderState
  from allennlp.models.semantic_parsing.wikitables.wikitables_decoder_step import WikiTablesDecoderStep
  from allennlp.modules import SimilarityFunction
  from allennlp.nn.decoding import GrammarState, RnnState
  from allennlp.semparse.type_declarations.type_declaration import is_nonterminal
label_desc: Use image node_id 3 for calling the WikiTablesDecoderStepTest obj's underlying member method code with example usage: obj.test_get_actions_to_consider_returns_none_if_no_linked_actions() without return types