docstr: If `per_node_beam_size` (which defaults to `beam_size`) is larger than
  the size of the target vocabulary, `BeamSearch.search` should raise
  a ConfigurationError.
docstr_tok: ["If","`","per_node_beam_size","`","(","which","defaults","to","`","beam_size","`",")","is","larger","than","the","size","of","the","target","vocabulary",",","`","BeamSearch.search","`","should","raise","a","ConfigurationError","."]
code: def test_catch_bad_config(self):
      """
      If `per_node_beam_size` (which defaults to `beam_size`) is larger than
      the size of the target vocabulary, `BeamSearch.search` should raise
      a ConfigurationError.
      """
      beam_search = BeamSearch(self.end_index, beam_size=20)
      with pytest.raises(ConfigurationError):
          self._check_results(beam_search=beam_search)
  
imports: from typing import Dict, Tuple, Union
  import numpy
  import pytest
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.nn.beam_search import MultinomialSampler, BeamSearch, TopKSampler, TopPSampler, GumbelSampler, LengthNormalizedSequenceLogProbabilityScorer, RepeatedNGramBlockingConstraint, StepFunctionTypeWithTimestep, StepFunctionTypeNoTimestep
  from allennlp.common.params import Params
  from allennlp.nn.util import min_value_of_dtype
label_desc: Use image node_id 13 for calling the BeamSearchTest obj's underlying member method code with example usage: obj.test_catch_bad_config() without return types