code: def test_build_grid_cannot_limit_size(caplog):
      """Test that when choices are too large GridSearch raises ValueError"""
      dim1 = Real("dim1", "uniform", 0, 1)
      dim2 = Integer("dim2", "uniform", 0, 10)
      dim3 = Categorical("dim3", "abcde")
      dim4 = Categorical("dim4", "abcde")
      space = Space()
      space.register(dim1)
      space.register(dim2)
      space.register(dim3)
      space.register(dim4)
  
      with pytest.raises(ValueError) as exc:
          GridSearch.build_grid(space, {k: 5 for k in space}, 10)
  
      assert exc.match(
          "Cannot build a grid smaller than 10. "
          "Try reducing the number of choices in categorical dimensions."
      )
  
imports: from __future__ import annotations
  import logging
  import numpy.testing
  import pytest
  from orion.algo.gridsearch import GridSearch, categorical_grid, discrete_grid, grid, real_grid
  from orion.algo.space import Categorical, Integer, Real, Space
  from orion.testing.algo import BaseAlgoTests
label_desc: Use image node_id 14 for calling a global function with example usage: test_build_grid_cannot_limit_size(caplog) without return types